@undefineds.co/linx 0.3.5 → 0.3.8
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/README.md +58 -23
- package/dist/generated/version.js +1 -1
- package/dist/generated/version.js.map +1 -1
- package/dist/index.js +336 -162
- package/dist/index.js.map +1 -1
- package/dist/lib/account-session.js +4 -8
- package/dist/lib/account-session.js.map +1 -1
- package/dist/lib/ai-command.js +228 -178
- package/dist/lib/ai-command.js.map +1 -1
- package/dist/lib/auto-mode/archive.js +38 -7
- package/dist/lib/auto-mode/archive.js.map +1 -1
- package/dist/lib/auto-mode/auth.js.map +1 -1
- package/dist/lib/auto-mode/display.js +71 -45
- package/dist/lib/auto-mode/display.js.map +1 -1
- package/dist/lib/auto-mode/format.js +9 -7
- package/dist/lib/auto-mode/format.js.map +1 -1
- package/dist/lib/auto-mode/hooks/claude.js +12 -2
- package/dist/lib/auto-mode/hooks/claude.js.map +1 -1
- package/dist/lib/auto-mode/hooks/codex.js +17 -7
- package/dist/lib/auto-mode/hooks/codex.js.map +1 -1
- package/dist/lib/auto-mode/hooks/index.js +28 -8
- package/dist/lib/auto-mode/hooks/index.js.map +1 -1
- package/dist/lib/auto-mode/pod-ai.js +20 -37
- package/dist/lib/auto-mode/pod-ai.js.map +1 -1
- package/dist/lib/auto-mode/pod-approval.js +124 -195
- package/dist/lib/auto-mode/pod-approval.js.map +1 -1
- package/dist/lib/auto-mode/pod-persistence.js +169 -90
- package/dist/lib/auto-mode/pod-persistence.js.map +1 -1
- package/dist/lib/auto-mode/runner.js +683 -81
- package/dist/lib/auto-mode/runner.js.map +1 -1
- package/dist/lib/auto-mode/secretary.js +186 -41
- package/dist/lib/auto-mode/secretary.js.map +1 -1
- package/dist/lib/auto-mode-command.js +32 -32
- package/dist/lib/auto-mode-command.js.map +1 -1
- package/dist/lib/chat-api.js +242 -50
- package/dist/lib/chat-api.js.map +1 -1
- package/dist/lib/codex-plugin/bridge.js +164 -17
- package/dist/lib/codex-plugin/bridge.js.map +1 -1
- package/dist/lib/codex-plugin/codex-native-proxy.js +370 -34
- package/dist/lib/codex-plugin/codex-native-proxy.js.map +1 -1
- package/dist/lib/credentials-store.js +33 -42
- package/dist/lib/credentials-store.js.map +1 -1
- package/dist/lib/linx-cloud-errors.js +61 -0
- package/dist/lib/linx-cloud-errors.js.map +1 -0
- package/dist/lib/linx-tui-contract.js +8 -5
- package/dist/lib/linx-tui-contract.js.map +1 -1
- package/dist/lib/login-command.js +9 -2
- package/dist/lib/login-command.js.map +1 -1
- package/dist/lib/models.js +3 -20
- package/dist/lib/models.js.map +1 -1
- package/dist/lib/oidc-auth.js +143 -17
- package/dist/lib/oidc-auth.js.map +1 -1
- package/dist/lib/oidc-session-storage.js +2 -6
- package/dist/lib/oidc-session-storage.js.map +1 -1
- package/dist/lib/pi-adapter/auto-input-controller.js +988 -0
- package/dist/lib/pi-adapter/auto-input-controller.js.map +1 -0
- package/dist/lib/pi-adapter/backend-command.js +2 -0
- package/dist/lib/pi-adapter/backend-command.js.map +1 -0
- package/dist/lib/pi-adapter/backend-credentials.js +80 -0
- package/dist/lib/pi-adapter/backend-credentials.js.map +1 -0
- package/dist/lib/pi-adapter/branding.js +246 -108
- package/dist/lib/pi-adapter/branding.js.map +1 -1
- package/dist/lib/pi-adapter/control-state.js +72 -0
- package/dist/lib/pi-adapter/control-state.js.map +1 -0
- package/dist/lib/pi-adapter/interactive.js +2634 -30
- package/dist/lib/pi-adapter/interactive.js.map +1 -1
- package/dist/lib/pi-adapter/pod-approval.js +382 -210
- package/dist/lib/pi-adapter/pod-approval.js.map +1 -1
- package/dist/lib/pi-adapter/pod-mirror-mapping.js +71 -17
- package/dist/lib/pi-adapter/pod-mirror-mapping.js.map +1 -1
- package/dist/lib/pi-adapter/pod-mirror.js +531 -64
- package/dist/lib/pi-adapter/pod-mirror.js.map +1 -1
- package/dist/lib/pi-adapter/pod-native.js +81 -85
- package/dist/lib/pi-adapter/pod-native.js.map +1 -1
- package/dist/lib/pi-adapter/pod-status-output.js +54 -0
- package/dist/lib/pi-adapter/pod-status-output.js.map +1 -0
- package/dist/lib/pi-adapter/runtime.js +458 -228
- package/dist/lib/pi-adapter/runtime.js.map +1 -1
- package/dist/lib/pi-adapter/session-control.js +509 -0
- package/dist/lib/pi-adapter/session-control.js.map +1 -0
- package/dist/lib/pi-adapter/session.js +35 -22
- package/dist/lib/pi-adapter/session.js.map +1 -1
- package/dist/lib/pi-adapter/stream.js +89 -32
- package/dist/lib/pi-adapter/stream.js.map +1 -1
- package/dist/lib/pi-adapter/sync-recovery.js +89 -0
- package/dist/lib/pi-adapter/sync-recovery.js.map +1 -0
- package/dist/lib/pi-adapter/web-fetch.js +13 -14
- package/dist/lib/pi-adapter/web-fetch.js.map +1 -1
- package/dist/lib/pod-chat-store.js +254 -78
- package/dist/lib/pod-chat-store.js.map +1 -1
- package/dist/lib/pod-data-session.js +156 -35
- package/dist/lib/pod-data-session.js.map +1 -1
- package/dist/lib/solid-auth-store.js +27 -0
- package/dist/lib/solid-auth-store.js.map +1 -0
- package/dist/lib/solid-auth.js +2 -4
- package/dist/lib/solid-auth.js.map +1 -1
- package/dist/lib/solid-client-credentials-login.js +100 -0
- package/dist/lib/solid-client-credentials-login.js.map +1 -0
- package/dist/lib/solid-local-store.js +31 -0
- package/dist/lib/solid-local-store.js.map +1 -0
- package/dist/lib/symphony/archive.js +328 -18
- package/dist/lib/symphony/archive.js.map +1 -1
- package/dist/lib/symphony/pod-projection.js +2222 -0
- package/dist/lib/symphony/pod-projection.js.map +1 -0
- package/dist/lib/symphony-command.js +602 -178
- package/dist/lib/symphony-command.js.map +1 -1
- package/dist/lib/sync-checkpoint-store.js +74 -0
- package/dist/lib/sync-checkpoint-store.js.map +1 -0
- package/dist/skills/symphony/SKILL.md +665 -0
- package/package.json +15 -9
- package/vendor/agent-runtime/dist/agent-runtime.d.ts +137 -0
- package/vendor/agent-runtime/dist/agent-runtime.js +211 -0
- package/vendor/agent-runtime/dist/auto-mode.d.ts +78 -13
- package/vendor/agent-runtime/dist/auto-mode.js +288 -31
- package/vendor/agent-runtime/dist/control-plane.d.ts +28 -0
- package/vendor/agent-runtime/dist/control-plane.js +79 -0
- package/vendor/agent-runtime/dist/file-sync.d.ts +157 -0
- package/vendor/agent-runtime/dist/file-sync.js +314 -0
- package/vendor/agent-runtime/dist/index.d.ts +7 -0
- package/vendor/agent-runtime/dist/index.js +7 -0
- package/vendor/agent-runtime/dist/reconciler.d.ts +117 -0
- package/vendor/agent-runtime/dist/reconciler.js +361 -0
- package/vendor/agent-runtime/dist/symphony.d.ts +128 -8
- package/vendor/agent-runtime/dist/symphony.js +362 -57
- package/vendor/agent-runtime/dist/sync.d.ts +271 -0
- package/vendor/agent-runtime/dist/sync.js +550 -0
- package/vendor/agent-runtime/dist/thread-reconciler-controller.d.ts +58 -0
- package/vendor/agent-runtime/dist/thread-reconciler-controller.js +137 -0
- package/vendor/agent-runtime/dist/turn-controller.js +2 -2
- package/vendor/agent-runtime/dist/wake-scheduler.d.ts +67 -0
- package/vendor/agent-runtime/dist/wake-scheduler.js +194 -0
- package/vendor/agent-runtime/package.json +8 -1
- package/vendor/pi-web-access/CHANGELOG.md +387 -0
- package/vendor/pi-web-access/LICENSE +21 -0
- package/vendor/pi-web-access/README.md +352 -0
- package/vendor/pi-web-access/activity.ts +101 -0
- package/vendor/pi-web-access/banner.png +0 -0
- package/vendor/pi-web-access/chrome-cookies.ts +322 -0
- package/vendor/pi-web-access/code-search.ts +107 -0
- package/vendor/pi-web-access/curator-page.ts +3359 -0
- package/vendor/pi-web-access/curator-server.ts +605 -0
- package/vendor/pi-web-access/exa.ts +520 -0
- package/vendor/pi-web-access/extract.ts +641 -0
- package/vendor/pi-web-access/gemini-api.ts +112 -0
- package/vendor/pi-web-access/gemini-search.ts +361 -0
- package/vendor/pi-web-access/gemini-url-context.ts +126 -0
- package/vendor/pi-web-access/gemini-web-config.ts +52 -0
- package/vendor/pi-web-access/gemini-web.ts +396 -0
- package/vendor/pi-web-access/github-api.ts +196 -0
- package/vendor/pi-web-access/github-extract.ts +634 -0
- package/vendor/pi-web-access/index.ts +2346 -0
- package/vendor/pi-web-access/package.json +45 -0
- package/vendor/pi-web-access/pdf-extract.ts +192 -0
- package/vendor/pi-web-access/perplexity.ts +195 -0
- package/vendor/pi-web-access/pi-web-fetch-demo.mp4 +0 -0
- package/vendor/pi-web-access/rsc-extract.ts +338 -0
- package/vendor/pi-web-access/skills/librarian/SKILL.md +195 -0
- package/vendor/pi-web-access/storage.ts +72 -0
- package/vendor/pi-web-access/summary-review.ts +276 -0
- package/vendor/pi-web-access/test/gemini-web-cookie-opt-in.test.mjs +41 -0
- package/vendor/pi-web-access/test/pdf-extract.test.mjs +95 -0
- package/vendor/pi-web-access/utils.ts +44 -0
- package/vendor/pi-web-access/video-extract.ts +378 -0
- package/vendor/pi-web-access/youtube-extract.ts +310 -0
- package/dist/lib/pi-adapter/auth.js +0 -68
- package/dist/lib/pi-adapter/auth.js.map +0 -1
- package/dist/lib/pi-adapter/pod-tools.js +0 -140
- package/dist/lib/pi-adapter/pod-tools.js.map +0 -1
- package/dist/skills/drizzle-solid/SKILL.md +0 -340
- package/dist/skills/pod-storage/SKILL.md +0 -100
- package/dist/skills/solid-modeling/SKILL.md +0 -274
- package/dist/skills/xpod-componentsjs/SKILL.md +0 -284
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { chmodSync, existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { isLinxClientCredentialsSecrets, LINX_CONFIG_FILE_NAME, LINX_HOME_DIRNAME, LINX_SECRETS_FILE_NAME, parseLinxClientConfig, parseLinxClientSecrets, } from '@undefineds.co/models/client';
|
|
5
|
-
function linxDir() {
|
|
6
|
-
return join(homedir(), LINX_HOME_DIRNAME);
|
|
7
|
-
}
|
|
8
|
-
export function getConfigPath() {
|
|
9
|
-
return join(linxDir(), LINX_CONFIG_FILE_NAME);
|
|
10
|
-
}
|
|
11
|
-
export function getSecretsPath() {
|
|
12
|
-
return join(linxDir(), LINX_SECRETS_FILE_NAME);
|
|
13
|
-
}
|
|
2
|
+
import { isLinxClientCredentialsSecrets, parseLinxClientConfig, parseLinxClientSecrets, } from '@undefineds.co/models/client';
|
|
3
|
+
import { getSolidAuthCredentialsPath, getSolidAuthDir } from './solid-auth-store.js';
|
|
14
4
|
function readJson(filePath) {
|
|
15
5
|
try {
|
|
16
6
|
return JSON.parse(readFileSync(filePath, 'utf-8'));
|
|
@@ -19,22 +9,38 @@ function readJson(filePath) {
|
|
|
19
9
|
return null;
|
|
20
10
|
}
|
|
21
11
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
12
|
+
function parseStoredCredentialsEnvelope(raw) {
|
|
13
|
+
const config = parseLinxClientConfig(raw);
|
|
14
|
+
if (!config || typeof raw !== 'object' || raw === null || !('secrets' in raw)) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const secrets = parseLinxClientSecrets(raw.secrets);
|
|
18
|
+
if (!secrets) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
url: config.url,
|
|
23
|
+
webId: config.webId,
|
|
24
|
+
authType: config.authType,
|
|
25
|
+
sourceDir: getSolidAuthDir(),
|
|
26
|
+
secrets,
|
|
27
|
+
};
|
|
24
28
|
}
|
|
25
29
|
export function saveCredentials(creds) {
|
|
26
|
-
const dir =
|
|
30
|
+
const dir = getSolidAuthDir();
|
|
27
31
|
mkdirSync(dir, { recursive: true });
|
|
28
|
-
writeFileSync(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
writeFileSync(getSolidAuthCredentialsPath(), `${JSON.stringify({
|
|
33
|
+
url: creds.url,
|
|
34
|
+
webId: creds.webId,
|
|
35
|
+
authType: creds.authType,
|
|
36
|
+
secrets: creds.secrets,
|
|
37
|
+
}, null, 2)}\n`, 'utf-8');
|
|
38
|
+
chmodSync(getSolidAuthCredentialsPath(), 0o600);
|
|
32
39
|
}
|
|
33
40
|
export function clearCredentials() {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
41
|
+
const path = getSolidAuthCredentialsPath();
|
|
42
|
+
if (existsSync(path)) {
|
|
43
|
+
unlinkSync(path);
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
46
|
export function isClientCredentials(secrets) {
|
|
@@ -56,25 +62,10 @@ export function getOidcOAuthSecrets(creds) {
|
|
|
56
62
|
: null;
|
|
57
63
|
}
|
|
58
64
|
export function loadCredentials() {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (!existsSync(configPath) || !existsSync(secretsPath)) {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
const config = parseLinxClientConfig(readJson(configPath));
|
|
66
|
-
const secrets = parseLinxClientSecrets(readJson(secretsPath));
|
|
67
|
-
if (!config || !secrets) {
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
url: config.url,
|
|
72
|
-
webId: config.webId,
|
|
73
|
-
authType: config.authType,
|
|
74
|
-
sourceDir,
|
|
75
|
-
secrets,
|
|
76
|
-
};
|
|
65
|
+
const path = getSolidAuthCredentialsPath();
|
|
66
|
+
if (!existsSync(path)) {
|
|
67
|
+
return null;
|
|
77
68
|
}
|
|
78
|
-
return
|
|
69
|
+
return parseStoredCredentialsEnvelope(readJson(path));
|
|
79
70
|
}
|
|
80
71
|
//# sourceMappingURL=credentials-store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials-store.js","sourceRoot":"","sources":["../../src/lib/credentials-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACnG,OAAO,
|
|
1
|
+
{"version":3,"file":"credentials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O;QAChG,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,IAAI,CAAA;AACV,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,IAAI,GAAG,2BAA2B,EAAE,CAAA;IAC1C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,8BAA8B,CAAC,QAAQ,CAAU,IAAI,CAAC,CAAC,CAAA;AAChE,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export function normalizeMisclassifiedCloudCompletionPodTimeoutMessage(errorOrMessage) {
|
|
2
|
+
const message = stripAnsi(errorOrMessage instanceof Error ? errorOrMessage.message : String(errorOrMessage));
|
|
3
|
+
const match = message.match(/LinX Pod request timed out after (\d+)s:\s+\w+\s+(https?:\/\/[^\s"'<>]+)/);
|
|
4
|
+
if (!match) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
const [, seconds, rawUrl] = match;
|
|
8
|
+
try {
|
|
9
|
+
const target = new URL(trimTrailingPunctuation(rawUrl));
|
|
10
|
+
if (!isCloudChatCompletionsPath(target.pathname)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return formatLinxCloudTransientMessage(`Request exceeded ${seconds}s.`);
|
|
18
|
+
}
|
|
19
|
+
export function formatLinxCliErrorMessage(errorOrMessage) {
|
|
20
|
+
return normalizeMisclassifiedCloudCompletionPodTimeoutMessage(errorOrMessage)
|
|
21
|
+
?? (errorOrMessage instanceof Error ? errorOrMessage.message : String(errorOrMessage));
|
|
22
|
+
}
|
|
23
|
+
export function formatLinxCloudTransientMessage(detail) {
|
|
24
|
+
const suffix = detail?.trim();
|
|
25
|
+
return suffix
|
|
26
|
+
? `LinX Cloud is temporarily unavailable. ${suffix} Please retry shortly.`
|
|
27
|
+
: 'LinX Cloud is temporarily unavailable. Please retry shortly.';
|
|
28
|
+
}
|
|
29
|
+
export function isLinxCloudTransientMessage(errorOrMessage) {
|
|
30
|
+
const normalized = stripAnsi(errorOrMessage instanceof Error ? errorOrMessage.message : String(errorOrMessage)).toLowerCase();
|
|
31
|
+
return normalized.includes('linx cloud is temporarily unavailable')
|
|
32
|
+
|| normalized.includes('chat request failed (500): fetch failed')
|
|
33
|
+
|| normalized.includes('outgoing request timed out')
|
|
34
|
+
|| (normalized.includes('502') && normalized.includes('bad gateway'))
|
|
35
|
+
|| (normalized.includes('503') && normalized.includes('service unavailable'))
|
|
36
|
+
|| (normalized.includes('504') && normalized.includes('gateway timeout'));
|
|
37
|
+
}
|
|
38
|
+
export function isLinxCloudAuthExpiredMessage(errorOrMessage) {
|
|
39
|
+
const normalized = stripAnsi(errorOrMessage instanceof Error ? errorOrMessage.message : String(errorOrMessage)).toLowerCase();
|
|
40
|
+
return normalized.includes('linx cloud login expired')
|
|
41
|
+
|| normalized.includes('invalid solid token')
|
|
42
|
+
|| (normalized.includes('401') && normalized.includes('unauthorized'));
|
|
43
|
+
}
|
|
44
|
+
function isCloudChatCompletionsPath(pathname) {
|
|
45
|
+
const segments = normalizePathname(pathname).split('/').filter(Boolean);
|
|
46
|
+
return segments.length >= 3
|
|
47
|
+
&& /^v\d+$/.test(segments.at(-3) ?? '')
|
|
48
|
+
&& segments.at(-2) === 'chat'
|
|
49
|
+
&& segments.at(-1) === 'completions';
|
|
50
|
+
}
|
|
51
|
+
function normalizePathname(pathname) {
|
|
52
|
+
const normalized = pathname.endsWith('/') ? pathname : `${pathname}/`;
|
|
53
|
+
return normalized.replace(/\/{2,}/g, '/');
|
|
54
|
+
}
|
|
55
|
+
function stripAnsi(text) {
|
|
56
|
+
return text.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, '');
|
|
57
|
+
}
|
|
58
|
+
function trimTrailingPunctuation(url) {
|
|
59
|
+
return url.replace(/[),.;:!?]+$/g, '');
|
|
60
|
+
}
|
|
61
|
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AK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACvE,OAAO,QAAQ,CAAC,MAAM,IAAI,CAAC;WACtB,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;WACpC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM;WAC1B,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,aAAa,CAAA;AACxC,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IACzC,MAAM,UAAU,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAA;IACrE,OAAO,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;AAC3C,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAA;AACrD,CAAC;AAED,SAAS,uBAAuB,CAAC,GAAW;IAC1C,OAAO,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;AACxC,CAAC"}
|
|
@@ -10,16 +10,19 @@ export const LINX_TUI_RUNNING_FOOTER_HINT = `ctrl+c interrupt · ${LINX_TUI_KEYM
|
|
|
10
10
|
export const LINX_TUI_RUNNING_DRAFT_HINT = 'enter steer · shift+enter newline · alt+enter follow-up';
|
|
11
11
|
export const LINX_TUI_AUTO_MODE_HEADER_HINT = ' enter send | ctrl+l model | alt+up restore | ctrl+o tools | ctrl+c clear / double quit ';
|
|
12
12
|
export const LINX_TUI_AUTO_MODE_READY_NOTE = `Use ${LINX_TUI_KEYMAP_COMMAND} for ${LINX_TUI_KEYMAP_LABEL}. Type ${LINX_TUI_EXIT_COMMAND} to leave this session.`;
|
|
13
|
-
export const LINX_TUI_AUTO_MODE_HELP_ACTIVITY = `Keymap: enter send · ctrl+l model · /
|
|
13
|
+
export const LINX_TUI_AUTO_MODE_HELP_ACTIVITY = `Keymap: enter send · ctrl+l model · /auto on|off|status · /goal <peer-command> · /rewind [turns] · ${LINX_TUI_EXIT_COMMAND}`;
|
|
14
14
|
export const LINX_TUI_AUTO_MODE_HELP_TEXT = [
|
|
15
15
|
`${LINX_TUI_KEYMAP_COMMAND} ${LINX_TUI_KEYMAP_LABEL}`,
|
|
16
16
|
`${LINX_TUI_LOGIN_COMMAND} refresh LinX Cloud login`,
|
|
17
17
|
`${LINX_TUI_LOGOUT_COMMAND} clear LinX Cloud login`,
|
|
18
|
-
`${LINX_TUI_EXIT_COMMAND}
|
|
18
|
+
`${LINX_TUI_EXIT_COMMAND} leave this session`,
|
|
19
19
|
'/model <id> switch backend model',
|
|
20
|
-
'/
|
|
21
|
-
'/
|
|
22
|
-
'/auto
|
|
20
|
+
'/auto status show whether auto is active',
|
|
21
|
+
'/auto on let Secretary drive and ask when blocked',
|
|
22
|
+
'/auto off return to direct user-driven chat',
|
|
23
|
+
'/goal <peer-command> send a goal command to the current chat peer',
|
|
24
|
+
'/rewind [turns] move the active session branch before recent user turns',
|
|
25
|
+
'/symphony on|off|status switch current chat peer: Secretary vs worker/backend',
|
|
23
26
|
'/debug on|off protocol view',
|
|
24
27
|
'',
|
|
25
28
|
].join('\n');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linx-tui-contract.js","sourceRoot":"","sources":["../../src/lib/linx-tui-contract.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAA;AACjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAA;AAC7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAO,CAAA;AAC5C,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAA;AAC9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,SAAS,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AAsB,uBAAuB,IAAI,qBAAqB,MAAM,qBAAqB,EAAE,CAAA;AAC/I,MAAM,CAAC,MAAM,2BAA2B,GAAG,yDAAyD,CAAA;AACpG,MAAM,CAAC,MAAM,8BAA8B,GAAG,0FAA0F,CAAA;AACxI,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,uBAAuB,QAAQ,qBAAqB,UAAU,qBAAqB,yBAAyB,CAAA;AAChK,MAAM,CAAC,MAAM,gCAAgC,GAAG,sGAAsG,qBAAqB,EAAE,CAAA;AAC7K,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,GAAG,uBAAuB,IAAI,qBAAqB,EAAE;IACrD,GAAG,sBAAsB,2BAA2B;IACpD,GAAG,uBAAuB,yBAAyB;IACnD,GAAG,qBAAqB,qBAAqB;IAC7C,kCAAkC;IAClC,0CAA0C;IAC1C,mDAAmD;IACnD,6CAA6C;IAC7C,mEAAmE;IACnE,yEAAyE;IACzE,+EAA+E;IAC/E,6BAA6B;IAC7B,EAAE;CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -11,9 +11,10 @@ export async function runLinxLoginCommand(argv, deps = {}) {
|
|
|
11
11
|
const doPromptText = deps.promptText ?? promptText;
|
|
12
12
|
const write = deps.write ?? ((chunk) => process.stdout.write(chunk));
|
|
13
13
|
let browserLoginStarted = false;
|
|
14
|
+
const forceFresh = argv.fresh === true || argv.force === true;
|
|
14
15
|
const result = await doBrowserConsentLogin({
|
|
15
16
|
issuerUrl: argv.url,
|
|
16
|
-
forceFresh
|
|
17
|
+
forceFresh,
|
|
17
18
|
onAuthUrl(url) {
|
|
18
19
|
browserLoginStarted = true;
|
|
19
20
|
write('Opening LinX Cloud login in your browser...\n');
|
|
@@ -39,7 +40,7 @@ export function runLinxLogoutCommand(deps = {}) {
|
|
|
39
40
|
clearAccountSession();
|
|
40
41
|
clearCredentials();
|
|
41
42
|
clearOidcSessionStorage();
|
|
42
|
-
write('Logged out. Local
|
|
43
|
+
write('Logged out. Local Solid auth credentials removed.\n');
|
|
43
44
|
}
|
|
44
45
|
export const loginCommand = {
|
|
45
46
|
command: 'login',
|
|
@@ -50,6 +51,12 @@ export const loginCommand = {
|
|
|
50
51
|
type: 'string',
|
|
51
52
|
default: resolveAccountBaseUrl(),
|
|
52
53
|
description: 'Solid / account issuer URL',
|
|
54
|
+
})
|
|
55
|
+
.option('fresh', {
|
|
56
|
+
alias: 'force',
|
|
57
|
+
type: 'boolean',
|
|
58
|
+
default: false,
|
|
59
|
+
description: 'Ignore saved LinX OIDC session and start a fresh browser consent flow',
|
|
53
60
|
}),
|
|
54
61
|
handler: async (argv) => {
|
|
55
62
|
await runLinxLoginCommand(argv);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-command.js","sourceRoot":"","sources":["../../src/lib/login-command.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,GACrB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"login-command.js","sourceRoot":"","sources":["../../src/lib/login-command.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,GACrB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,gB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C,CAAA;IACjB,CAAC;CACF,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAkB;IAC1C,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,iDAAiD;IAC3D,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,oBAAoB,EAAE,CAAA;IACxB,CAAC;CACF,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAsC;IAC9D,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,sCAAsC;IAChD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAChF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACtB,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAA;QACpC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;QAC3D,CAAC;QAED,KAAK,MAAM,KAAK,IAAI,oBAAoB,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;YAC7E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,KAAK,IAAI,CAAC,CAAA;QACxD,CAAC;IACH,CAAC;CACF,CAAA"}
|
package/dist/lib/models.js
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
export function buildApprovalSubjectPath(approvalId, createdAt = new Date()) {
|
|
6
|
-
return buildResourceSubjectPath(approvalResource, { id: approvalId, createdAt });
|
|
7
|
-
}
|
|
8
|
-
export function buildAuditSubjectPath(auditId, createdAt = new Date()) {
|
|
9
|
-
return buildResourceSubjectPath(auditResource, { id: auditId, createdAt });
|
|
10
|
-
}
|
|
11
|
-
export function buildGrantSubjectPath(grantId) {
|
|
12
|
-
return buildResourceSubjectPath(grantResource, { id: grantId });
|
|
13
|
-
}
|
|
14
|
-
export function buildSessionResourceId(sessionId, createdAt = new Date()) {
|
|
15
|
-
return sessionResource.buildId({ id: sessionId, createdAt });
|
|
16
|
-
}
|
|
17
|
-
export function buildSessionSubjectPath(sessionId, createdAt = new Date()) {
|
|
18
|
-
return sessionResource.resolveUri(buildSessionResourceId(sessionId, createdAt));
|
|
19
|
-
}
|
|
20
|
-
export { ContactType, agentResource, agentTable, applySolidComunicaPatches, aiConfigModelUri, aiConfigProviderRef, aiConfigProviderUri, aiModelResource, aiModelTable, aiProviderResource, aiProviderTable, approvalResource, approvalTable, auditTable, buildAIConfigDisconnectPlan, buildAIConfigMutationPlan, buildAIConfigProviderStateMap, chatResource, chatTable, contactTable, createPodStorage, credentialResource, credentialTable, auditResource, drizzle, eq, getAIConfigProviderFamilyIds, getAIConfigProviderMetadata, getDefaultAIConfigCredentialId, grantResource, grantTable, inboxNotificationResource, inboxNotificationTable, extractChatIdFromChatRef, extractSessionIdFromSessionRef, extractThreadIdFromThreadRef, solidSchema, solidResources, initSolidResources, initSolidTables, podSchema, messageResource, messageTable, sessionResource, sessionTable, normalizeAIConfigProviderId, normalizeAIConfigResourceId, sameAIConfigProviderFamily, selectAIConfigCredential, sessionRepository, threadResource, threadTable, };
|
|
1
|
+
import { getBuiltinModels as getSharedBuiltinModels, } from '@undefineds.co/models/discovery';
|
|
2
|
+
import { aiConfigProviderRef, aiConfigModelUri, aiConfigProviderUri, aiConfigRepository, aiModelResource, aiModelTable, aiProviderResource, aiProviderTable, approvalResource, approvalTable, auditTable, buildAIConfigDisconnectPlan, buildAIConfigMutationPlan, buildAIConfigProviderStateMap, chatRepository, credentialResource, credentialTable, ContactClass, ContactType, auditResource, agentResource, agentTable, applySolidComunicaPatches, chatResource, chatTable, contactResource, contactTable, drizzle, eq, getAIConfigProviderFamilyIds, getAIConfigProviderIdsForBackend, getAIConfigProviderCatalog, getAIConfigProviderMetadata, getDefaultAIConfigCredentialId, grantResource, grantTable, ideaResource, inboxNotificationResource, inboxNotificationTable, initSolidResources, initSolidTables, extractSessionIdFromSessionRef, solidResources, solidSchema, messageResource, messageTable, issueResource, issueTable, taskResource, taskTable, deliveryResource, deliveryTable, runResource, runStepResource, runTable, runStepTable, sessionResource, sessionTable, skillResource, skillTable, normalizeAIConfigProviderId, normalizeAIConfigResourceId, sameAIConfigProviderFamily, selectAIConfigCredential, selectAIConfigCredentialForBackend, sessionRepository, threadRepository, threadResource, threadTable, } from '@undefineds.co/models';
|
|
3
|
+
export { ContactClass, ContactType, agentResource, agentTable, applySolidComunicaPatches, aiConfigModelUri, aiConfigProviderRef, aiConfigProviderUri, aiConfigRepository, aiModelResource, aiModelTable, aiProviderResource, aiProviderTable, approvalResource, approvalTable, auditTable, buildAIConfigDisconnectPlan, buildAIConfigMutationPlan, buildAIConfigProviderStateMap, chatRepository, chatResource, chatTable, contactResource, contactTable, credentialResource, credentialTable, auditResource, drizzle, eq, getAIConfigProviderFamilyIds, getAIConfigProviderIdsForBackend, getAIConfigProviderCatalog, getAIConfigProviderMetadata, getDefaultAIConfigCredentialId, grantResource, grantTable, ideaResource, inboxNotificationResource, inboxNotificationTable, extractSessionIdFromSessionRef, solidSchema, solidResources, initSolidResources, initSolidTables, messageResource, messageTable, issueResource, issueTable, taskResource, taskTable, deliveryResource, deliveryTable, runResource, runStepResource, runTable, runStepTable, sessionResource, sessionTable, skillResource, skillTable, normalizeAIConfigProviderId, normalizeAIConfigResourceId, sameAIConfigProviderFamily, selectAIConfigCredential, selectAIConfigCredentialForBackend, sessionRepository, threadRepository, threadResource, threadTable, };
|
|
21
4
|
export function getBuiltinModels() {
|
|
22
5
|
return getSharedBuiltinModels();
|
|
23
6
|
}
|
package/dist/lib/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/lib/models.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,6BAA6B,EAC7B,kBAAkB,EAClB,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/lib/models.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,IAAI,sBAAsB,GAC3C,MAAM,iCAAiC,CAAA;AAExC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,6BAA6B,EAC7B,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,WAAW,EACX,aAAa,EACb,aAAa,EACb,UAAU,EACV,yBAAyB,EACzB,YAAY,EACZ,SAAS,EACT,eAAe,EACf,YAAY,EACZ,OAAO,EACP,EAAE,EACF,4BAA4B,EAC5B,gCAAgC,EAChC,0BAA0B,EAC1B,2BAA2B,EAC3B,8BAA8B,EAC9B,aAAa,EACb,UAAU,EACV,YAAY,EACZ,yBAAyB,EACzB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,8BAA8B,EAC9B,cAAc,EACd,WAAW,EACX,eAAe,EACf,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,aAAa,EACb,UAAU,EACV,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,kCAAkC,EAClC,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,WAAW,GA4BZ,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,UAAU,EACV,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,6BAA6B,EAC7B,cAAc,EACd,YAAY,EACZ,SAAS,EACT,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,OAAO,EACP,EAAE,EACF,4BAA4B,EAC5B,gCAAgC,EAChC,0BAA0B,EAC1B,2BAA2B,EAC3B,8BAA8B,EAC9B,aAAa,EACb,UAAU,EACV,YAAY,EACZ,yBAAyB,EACzB,sBAAsB,EACtB,8BAA8B,EAC9B,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,aAAa,EACb,UAAU,EACV,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,kCAAkC,EAClC,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,WAAW,GACZ,CAAA;AA+BD,MAAM,UAAU,gBAAgB;IAC9B,OAAO,sBAAsB,EAAE,CAAA;AACjC,CAAC"}
|
package/dist/lib/oidc-auth.js
CHANGED
|
@@ -3,16 +3,17 @@ import { execFile } from 'node:child_process';
|
|
|
3
3
|
import { promisify } from 'node:util';
|
|
4
4
|
import { EVENTS, getSessionFromStorage, refreshSession, Session, } from '@inrupt/solid-client-authn-node';
|
|
5
5
|
import { isLinxOidcOAuthSecrets, resolveLinxCloudAccountBaseUrl } from '@undefineds.co/models/client';
|
|
6
|
-
import { saveAccountSession } from './account-session.js';
|
|
7
|
-
import { loadCredentials, saveCredentials } from './credentials-store.js';
|
|
8
|
-
import { createOidcSessionStorage } from './oidc-session-storage.js';
|
|
6
|
+
import { clearAccountSession, saveAccountSession } from './account-session.js';
|
|
7
|
+
import { clearCredentials, loadCredentials, saveCredentials } from './credentials-store.js';
|
|
8
|
+
import { clearOidcSessionStorage, createOidcSessionStorage } from './oidc-session-storage.js';
|
|
9
9
|
const execFileAsync = promisify(execFile);
|
|
10
10
|
const DEFAULT_CALLBACK_HOST = '127.0.0.1';
|
|
11
11
|
const DEFAULT_CALLBACK_PATH = '/auth/callback';
|
|
12
12
|
const DEFAULT_CLIENT_NAME = 'LinX CLI';
|
|
13
|
+
const TRANSIENT_OIDC_REMOTE_STATUS_CODES = new Set([502, 503, 504]);
|
|
13
14
|
export async function ensureBrowserConsentLogin(options = {}) {
|
|
14
15
|
if (!options.forceFresh) {
|
|
15
|
-
const reused = await reuseExistingBrowserConsentLogin(options)
|
|
16
|
+
const reused = await reuseExistingBrowserConsentLogin(options);
|
|
16
17
|
if (reused) {
|
|
17
18
|
return {
|
|
18
19
|
...reused,
|
|
@@ -20,6 +21,9 @@ export async function ensureBrowserConsentLogin(options = {}) {
|
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
}
|
|
24
|
+
if (options.forceFresh) {
|
|
25
|
+
clearOidcSessionStorage();
|
|
26
|
+
}
|
|
23
27
|
const fresh = await loginWithBrowserConsent(options);
|
|
24
28
|
return {
|
|
25
29
|
...fresh,
|
|
@@ -99,17 +103,29 @@ export async function restoreStoredOidcSession(credentials, options = {}) {
|
|
|
99
103
|
const storage = createOidcSessionStorage();
|
|
100
104
|
const sessionId = await resolveStoredOidcSessionId(storage, credentials.webId, credentials.url);
|
|
101
105
|
if (!sessionId) {
|
|
106
|
+
if (options.forceRefresh) {
|
|
107
|
+
clearStoredOidcLoginState();
|
|
108
|
+
throw new LinxOidcLoginExpiredError('Stored OIDC session is missing.');
|
|
109
|
+
}
|
|
102
110
|
return null;
|
|
103
111
|
}
|
|
104
112
|
const session = await getSessionFromStorage(sessionId, {
|
|
105
113
|
storage,
|
|
106
114
|
refreshSession: false,
|
|
115
|
+
}).catch((error) => {
|
|
116
|
+
throw normalizeOidcSessionRefreshError(error);
|
|
107
117
|
});
|
|
108
118
|
if (!session) {
|
|
119
|
+
if (options.forceRefresh) {
|
|
120
|
+
clearStoredOidcLoginState();
|
|
121
|
+
throw new LinxOidcLoginExpiredError('Stored OIDC session cannot be restored.');
|
|
122
|
+
}
|
|
109
123
|
return null;
|
|
110
124
|
}
|
|
111
125
|
if (options.forceRefresh || !session.info.isLoggedIn) {
|
|
112
|
-
await refreshSession(session, { storage })
|
|
126
|
+
await refreshSession(session, { storage }).catch((error) => {
|
|
127
|
+
throw normalizeOidcSessionRefreshError(error);
|
|
128
|
+
});
|
|
113
129
|
}
|
|
114
130
|
return session.info.isLoggedIn ? session : null;
|
|
115
131
|
}
|
|
@@ -358,8 +374,21 @@ async function reuseExistingBrowserConsentLogin(options) {
|
|
|
358
374
|
if (requestedIssuer !== storedIssuer) {
|
|
359
375
|
return null;
|
|
360
376
|
}
|
|
361
|
-
|
|
377
|
+
let accessToken;
|
|
378
|
+
try {
|
|
379
|
+
// Reuse is valid only after a real server refresh. Local expiry/WebID checks
|
|
380
|
+
// are insufficient when an account was deleted and recreated with the same WebID.
|
|
381
|
+
accessToken = await getOidcAccessToken(stored, { forceRefresh: true });
|
|
382
|
+
}
|
|
383
|
+
catch (error) {
|
|
384
|
+
if (isOidcLoginExpiredError(error)) {
|
|
385
|
+
clearStoredOidcLoginState();
|
|
386
|
+
return null;
|
|
387
|
+
}
|
|
388
|
+
throw error;
|
|
389
|
+
}
|
|
362
390
|
if (!accessToken || !isLinxOidcOAuthSecrets(stored.secrets)) {
|
|
391
|
+
clearStoredOidcLoginState();
|
|
363
392
|
return null;
|
|
364
393
|
}
|
|
365
394
|
return {
|
|
@@ -392,23 +421,30 @@ async function refreshStoredOidcSession(credentials, secrets) {
|
|
|
392
421
|
const storage = createOidcSessionStorage();
|
|
393
422
|
const sessionId = await resolveStoredOidcSessionId(storage, credentials.webId, credentials.url);
|
|
394
423
|
if (!sessionId) {
|
|
395
|
-
|
|
424
|
+
clearStoredOidcLoginState();
|
|
425
|
+
throw new LinxOidcLoginExpiredError('Stored OIDC session is missing.');
|
|
396
426
|
}
|
|
397
427
|
const session = await getSessionFromStorage(sessionId, {
|
|
398
428
|
storage,
|
|
399
429
|
refreshSession: false,
|
|
430
|
+
}).catch((error) => {
|
|
431
|
+
throw normalizeOidcSessionRefreshError(error);
|
|
400
432
|
});
|
|
401
433
|
if (!session) {
|
|
402
|
-
|
|
434
|
+
clearStoredOidcLoginState();
|
|
435
|
+
throw new LinxOidcLoginExpiredError('Stored OIDC session cannot be restored.');
|
|
403
436
|
}
|
|
404
437
|
let refreshedTokenSet = null;
|
|
405
438
|
session.events.on(EVENTS.NEW_TOKENS, (tokenSet) => {
|
|
406
439
|
refreshedTokenSet = tokenSet;
|
|
407
440
|
});
|
|
408
|
-
await refreshSession(session, { storage })
|
|
441
|
+
await refreshSession(session, { storage }).catch((error) => {
|
|
442
|
+
throw normalizeOidcSessionRefreshError(error);
|
|
443
|
+
});
|
|
409
444
|
const nextTokenSet = refreshedTokenSet;
|
|
410
445
|
if (!nextTokenSet?.accessToken) {
|
|
411
|
-
|
|
446
|
+
clearStoredOidcLoginState();
|
|
447
|
+
throw new LinxOidcLoginExpiredError('Stored OIDC session refresh did not return an access token.');
|
|
412
448
|
}
|
|
413
449
|
secrets.oidcRefreshToken = nextTokenSet.refreshToken ?? secrets.oidcRefreshToken;
|
|
414
450
|
secrets.oidcAccessToken = nextTokenSet.accessToken;
|
|
@@ -456,7 +492,8 @@ async function resolveStoredOidcSessionId(storage, webId, issuerUrl) {
|
|
|
456
492
|
const parsed = JSON.parse(stored);
|
|
457
493
|
const sessionWebId = typeof parsed.webId === 'string' ? parsed.webId : null;
|
|
458
494
|
const sessionIssuer = typeof parsed.issuer === 'string' ? parsed.issuer.replace(/\/+$/, '') : null;
|
|
459
|
-
|
|
495
|
+
const sessionUsesDpop = parsed.dpop === true || parsed.dpop === 'true';
|
|
496
|
+
if (sessionWebId === webId && sessionIssuer === normalizedIssuer && !sessionUsesDpop) {
|
|
460
497
|
return sessionId;
|
|
461
498
|
}
|
|
462
499
|
}
|
|
@@ -500,11 +537,7 @@ async function waitForManualRedirect(onCallback, manualRedirectUrl, signal) {
|
|
|
500
537
|
await new Promise(() => undefined);
|
|
501
538
|
return;
|
|
502
539
|
}
|
|
503
|
-
if (signal?.aborted) {
|
|
504
|
-
return;
|
|
505
|
-
}
|
|
506
|
-
if (!requestUrl) {
|
|
507
|
-
await new Promise(() => undefined);
|
|
540
|
+
if (signal?.aborted || !requestUrl) {
|
|
508
541
|
return;
|
|
509
542
|
}
|
|
510
543
|
assertOidcCallbackDidNotReturnError(requestUrl);
|
|
@@ -530,17 +563,110 @@ export class LinxOidcLoginExpiredError extends Error {
|
|
|
530
563
|
this.cause = cause;
|
|
531
564
|
}
|
|
532
565
|
}
|
|
566
|
+
export class LinxOidcTransientRemoteError extends Error {
|
|
567
|
+
transientRemote = true;
|
|
568
|
+
status;
|
|
569
|
+
constructor(cause) {
|
|
570
|
+
const status = resolveOidcTransientRemoteStatus(cause);
|
|
571
|
+
const detail = status ? fallbackOidcTransientStatusMessage(status) : 'Service Unavailable';
|
|
572
|
+
super(status
|
|
573
|
+
? `LinX Cloud is temporarily unavailable (${status}): ${detail}. Your login was not cleared; retry shortly.`
|
|
574
|
+
: 'LinX Cloud is temporarily unavailable. Your login was not cleared; retry shortly.');
|
|
575
|
+
this.name = 'LinxOidcTransientRemoteError';
|
|
576
|
+
if (status !== null)
|
|
577
|
+
this.status = status;
|
|
578
|
+
if (cause !== undefined)
|
|
579
|
+
this.cause = cause;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
export function clearStoredOidcLoginState() {
|
|
583
|
+
clearAccountSession();
|
|
584
|
+
clearCredentials();
|
|
585
|
+
clearOidcSessionStorage();
|
|
586
|
+
}
|
|
533
587
|
export function isOidcLoginExpiredError(error) {
|
|
534
588
|
if (error instanceof LinxOidcLoginExpiredError)
|
|
535
589
|
return true;
|
|
536
590
|
if (typeof error === 'object' && error !== null && 'authExpired' in error && error.authExpired === true)
|
|
537
591
|
return true;
|
|
592
|
+
if (isOidcTransientRemoteError(error))
|
|
593
|
+
return false;
|
|
538
594
|
const message = error instanceof Error ? error.message : String(error);
|
|
539
595
|
const normalized = message.toLowerCase();
|
|
540
596
|
return normalized.includes('linx cloud login expired')
|
|
541
597
|
|| normalized.includes('invalid refresh credentials')
|
|
542
598
|
|| normalized.includes('missing static client secret')
|
|
543
599
|
|| normalized.includes('invalid_client')
|
|
544
|
-
|| normalized.includes('invalid_grant')
|
|
600
|
+
|| normalized.includes('invalid_grant')
|
|
601
|
+
|| normalized.includes('invalid_redirect_uri')
|
|
602
|
+
|| normalized.includes('unauthorized_client');
|
|
603
|
+
}
|
|
604
|
+
export function isOidcTransientRemoteError(error) {
|
|
605
|
+
if (error instanceof LinxOidcTransientRemoteError)
|
|
606
|
+
return true;
|
|
607
|
+
if (typeof error === 'object' && error !== null && 'transientRemote' in error && error.transientRemote === true)
|
|
608
|
+
return true;
|
|
609
|
+
return resolveOidcTransientRemoteStatus(error) !== null;
|
|
610
|
+
}
|
|
611
|
+
function normalizeOidcSessionRefreshError(error) {
|
|
612
|
+
if (isOidcTransientRemoteError(error)) {
|
|
613
|
+
return new LinxOidcTransientRemoteError(error);
|
|
614
|
+
}
|
|
615
|
+
if (isOidcLoginExpiredError(error)) {
|
|
616
|
+
clearStoredOidcLoginState();
|
|
617
|
+
return new LinxOidcLoginExpiredError(error);
|
|
618
|
+
}
|
|
619
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
620
|
+
}
|
|
621
|
+
function resolveOidcTransientRemoteStatus(error) {
|
|
622
|
+
if (typeof error === 'object' && error !== null) {
|
|
623
|
+
const candidates = [
|
|
624
|
+
error.status,
|
|
625
|
+
error.statusCode,
|
|
626
|
+
error.response?.status,
|
|
627
|
+
error.cause?.status,
|
|
628
|
+
error.cause?.statusCode,
|
|
629
|
+
];
|
|
630
|
+
for (const candidate of candidates) {
|
|
631
|
+
if (typeof candidate === 'number' && TRANSIENT_OIDC_REMOTE_STATUS_CODES.has(candidate)) {
|
|
632
|
+
return candidate;
|
|
633
|
+
}
|
|
634
|
+
if (typeof candidate === 'string') {
|
|
635
|
+
const parsed = Number.parseInt(candidate, 10);
|
|
636
|
+
if (TRANSIENT_OIDC_REMOTE_STATUS_CODES.has(parsed)) {
|
|
637
|
+
return parsed;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
643
|
+
const normalized = message.toLowerCase();
|
|
644
|
+
if (normalized.includes('502') && normalized.includes('bad gateway')) {
|
|
645
|
+
return 502;
|
|
646
|
+
}
|
|
647
|
+
if (normalized.includes('503') && normalized.includes('service unavailable')) {
|
|
648
|
+
return 503;
|
|
649
|
+
}
|
|
650
|
+
if (normalized.includes('504') && normalized.includes('gateway timeout')) {
|
|
651
|
+
return 504;
|
|
652
|
+
}
|
|
653
|
+
if (normalized.includes('expected 200 ok') && normalized.includes('bad gateway')) {
|
|
654
|
+
return 502;
|
|
655
|
+
}
|
|
656
|
+
return null;
|
|
657
|
+
}
|
|
658
|
+
function fallbackOidcTransientStatusMessage(status) {
|
|
659
|
+
switch (status) {
|
|
660
|
+
case 502:
|
|
661
|
+
return 'Bad Gateway';
|
|
662
|
+
case 503:
|
|
663
|
+
return 'Service Unavailable';
|
|
664
|
+
case 504:
|
|
665
|
+
return 'Gateway Timeout';
|
|
666
|
+
default:
|
|
667
|
+
return 'Service Unavailable';
|
|
668
|
+
}
|
|
545
669
|
}
|
|
670
|
+
export const __testReuseExistingBrowserConsentLogin = reuseExistingBrowserConsentLogin;
|
|
671
|
+
export const __testNormalizeOidcSessionRefreshError = normalizeOidcSessionRefreshError;
|
|
546
672
|
//# sourceMappingURL=oidc-auth.js.map
|