dsh-cliworker-now 0.0.0-stage → 0.7.7
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/LICENSE +21 -0
- package/README.en.md +364 -0
- package/README.md +368 -2
- package/cordis.patch.yml +3 -0
- package/lib/account-models.mjs +262 -0
- package/lib/client.js +22139 -0
- package/lib/client.js.map +1 -0
- package/lib/grok-catalog.mjs +145 -0
- package/lib/hermes-native-entry.py +96 -0
- package/lib/hermes-nous-refresh.py +331 -0
- package/lib/index.js +14544 -0
- package/lib/index.js.map +1 -0
- package/lib/native-launch.mjs +234 -0
- package/lib/native-spawn.mjs +32 -0
- package/lib/own-account-lease.mjs +105 -0
- package/lib/pi-installation.mjs +87 -0
- package/lib/pi-login.mjs +80 -0
- package/lib/pi-native-catalog.mjs +417 -0
- package/lib/pi-omp-bridge.mjs +602 -0
- package/lib/pi-omp-environment.mjs +15 -0
- package/lib/pi-omp-refresh.mjs +324 -0
- package/lib/private-launch.mjs +23 -0
- package/lib/terminal-bridge.mjs +18 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +1430 -0
- package/lib/typert.remote-client.d.ts +72 -0
- package/lib/typert.remote-client.d.ts.map +1 -0
- package/lib/typert.remote-client.js +1256 -0
- package/lib/types/client/account-query-queue.d.ts +16 -0
- package/lib/types/client/account-query-queue.js +61 -0
- package/lib/types/client/account-query-queue.js.map +1 -0
- package/lib/types/client/account-terminal-css.d.ts +1 -0
- package/lib/types/client/account-terminal-css.js +3 -0
- package/lib/types/client/account-terminal-css.js.map +1 -0
- package/lib/types/client/account-terminal.d.ts +17 -0
- package/lib/types/client/account-terminal.js +525 -0
- package/lib/types/client/account-terminal.js.map +1 -0
- package/lib/types/client/assets/antigravity.png +0 -0
- package/lib/types/client/assets/claude-code.png +0 -0
- package/lib/types/client/assets/cliworker-now-logo.png +0 -0
- package/lib/types/client/assets/codex.png +0 -0
- package/lib/types/client/assets/grok.png +0 -0
- package/lib/types/client/assets/hermes.png +0 -0
- package/lib/types/client/assets/kimi-dark.png +0 -0
- package/lib/types/client/assets/kimi-light.png +0 -0
- package/lib/types/client/assets/mimo-code.png +0 -0
- package/lib/types/client/assets/omp.png +0 -0
- package/lib/types/client/assets/opencode.png +0 -0
- package/lib/types/client/assets/pi.png +0 -0
- package/lib/types/client/assets/zcode.png +0 -0
- package/lib/types/client/composer-keymap.d.ts +18 -0
- package/lib/types/client/composer-keymap.js +49 -0
- package/lib/types/client/composer-keymap.js.map +1 -0
- package/lib/types/client/conversation-timeline.d.ts +6 -0
- package/lib/types/client/conversation-timeline.js +65 -0
- package/lib/types/client/conversation-timeline.js.map +1 -0
- package/lib/types/client/copy-text.d.ts +5 -0
- package/lib/types/client/copy-text.js +45 -0
- package/lib/types/client/copy-text.js.map +1 -0
- package/lib/types/client/icons.d.ts +21 -0
- package/lib/types/client/icons.js +68 -0
- package/lib/types/client/icons.js.map +1 -0
- package/lib/types/client/index.d.ts +3 -0
- package/lib/types/client/index.js +124 -0
- package/lib/types/client/index.js.map +1 -0
- package/lib/types/client/management-styles.d.ts +1 -0
- package/lib/types/client/management-styles.js +17 -0
- package/lib/types/client/management-styles.js.map +1 -0
- package/lib/types/client/name-copy.d.ts +5 -0
- package/lib/types/client/name-copy.js +107 -0
- package/lib/types/client/name-copy.js.map +1 -0
- package/lib/types/client/native-job-overlay.d.ts +11 -0
- package/lib/types/client/native-job-overlay.js +129 -0
- package/lib/types/client/native-job-overlay.js.map +1 -0
- package/lib/types/client/operation-error.d.ts +2 -0
- package/lib/types/client/operation-error.js +12 -0
- package/lib/types/client/operation-error.js.map +1 -0
- package/lib/types/client/panel.d.ts +8 -0
- package/lib/types/client/panel.js +310 -0
- package/lib/types/client/panel.js.map +1 -0
- package/lib/types/client/rename-copy-styles.d.ts +1 -0
- package/lib/types/client/rename-copy-styles.js +21 -0
- package/lib/types/client/rename-copy-styles.js.map +1 -0
- package/lib/types/client/rename-worker.d.ts +9 -0
- package/lib/types/client/rename-worker.js +53 -0
- package/lib/types/client/rename-worker.js.map +1 -0
- package/lib/types/client/role-presets.d.ts +6 -0
- package/lib/types/client/role-presets.js +111 -0
- package/lib/types/client/role-presets.js.map +1 -0
- package/lib/types/client/settings-dialog.d.ts +13 -0
- package/lib/types/client/settings-dialog.js +442 -0
- package/lib/types/client/settings-dialog.js.map +1 -0
- package/lib/types/client/stat-popover.d.ts +10 -0
- package/lib/types/client/stat-popover.js +32 -0
- package/lib/types/client/stat-popover.js.map +1 -0
- package/lib/types/client/styles.d.ts +9 -0
- package/lib/types/client/styles.js +221 -0
- package/lib/types/client/styles.js.map +1 -0
- package/lib/types/client/telemetry.d.ts +11 -0
- package/lib/types/client/telemetry.js +24 -0
- package/lib/types/client/telemetry.js.map +1 -0
- package/lib/types/client/worker-card.d.ts +10 -0
- package/lib/types/client/worker-card.js +75 -0
- package/lib/types/client/worker-card.js.map +1 -0
- package/lib/types/client/worker-model-menu.d.ts +9 -0
- package/lib/types/client/worker-model-menu.js +136 -0
- package/lib/types/client/worker-model-menu.js.map +1 -0
- package/lib/types/client/workers.d.ts +21 -0
- package/lib/types/client/workers.js +59 -0
- package/lib/types/client/workers.js.map +1 -0
- package/lib/types/client/zcode-login-link-provider.d.ts +9 -0
- package/lib/types/client/zcode-login-link-provider.js +105 -0
- package/lib/types/client/zcode-login-link-provider.js.map +1 -0
- package/lib/types/client/zcode-login-link.d.ts +16 -0
- package/lib/types/client/zcode-login-link.js +194 -0
- package/lib/types/client/zcode-login-link.js.map +1 -0
- package/lib/types/host/account-identity.d.ts +16 -0
- package/lib/types/host/account-identity.js +126 -0
- package/lib/types/host/account-identity.js.map +1 -0
- package/lib/types/host/account-login.d.ts +10 -0
- package/lib/types/host/account-login.js +126 -0
- package/lib/types/host/account-login.js.map +1 -0
- package/lib/types/host/account-models.d.mts +21 -0
- package/lib/types/host/account-models.mjs +262 -0
- package/lib/types/host/accounts.d.ts +42 -0
- package/lib/types/host/accounts.js +945 -0
- package/lib/types/host/accounts.js.map +1 -0
- package/lib/types/host/adapters.d.ts +24 -0
- package/lib/types/host/adapters.js +380 -0
- package/lib/types/host/adapters.js.map +1 -0
- package/lib/types/host/agy-context.d.ts +8 -0
- package/lib/types/host/agy-context.js +122 -0
- package/lib/types/host/agy-context.js.map +1 -0
- package/lib/types/host/agy-models.d.ts +5 -0
- package/lib/types/host/agy-models.js +37 -0
- package/lib/types/host/agy-models.js.map +1 -0
- package/lib/types/host/agy-windows-account.d.ts +14 -0
- package/lib/types/host/agy-windows-account.js +104 -0
- package/lib/types/host/agy-windows-account.js.map +1 -0
- package/lib/types/host/authorized-catalog.d.ts +14 -0
- package/lib/types/host/authorized-catalog.js +35 -0
- package/lib/types/host/authorized-catalog.js.map +1 -0
- package/lib/types/host/bridge-protocol.d.ts +15 -0
- package/lib/types/host/bridge-protocol.js +80 -0
- package/lib/types/host/bridge-protocol.js.map +1 -0
- package/lib/types/host/claude-native-oauth.d.ts +17 -0
- package/lib/types/host/claude-native-oauth.js +272 -0
- package/lib/types/host/claude-native-oauth.js.map +1 -0
- package/lib/types/host/claude-own-route.d.ts +33 -0
- package/lib/types/host/claude-own-route.js +250 -0
- package/lib/types/host/claude-own-route.js.map +1 -0
- package/lib/types/host/cli-account-binding.d.ts +33 -0
- package/lib/types/host/cli-account-binding.js +540 -0
- package/lib/types/host/cli-account-binding.js.map +1 -0
- package/lib/types/host/cli-protocol.d.ts +27 -0
- package/lib/types/host/cli-protocol.js +212 -0
- package/lib/types/host/cli-protocol.js.map +1 -0
- package/lib/types/host/codex-account.d.ts +8 -0
- package/lib/types/host/codex-account.js +143 -0
- package/lib/types/host/codex-account.js.map +1 -0
- package/lib/types/host/codex-models.d.ts +6 -0
- package/lib/types/host/codex-models.js +169 -0
- package/lib/types/host/codex-models.js.map +1 -0
- package/lib/types/host/extended-adapters.d.ts +44 -0
- package/lib/types/host/extended-adapters.js +207 -0
- package/lib/types/host/extended-adapters.js.map +1 -0
- package/lib/types/host/first-party-account-context.d.ts +26 -0
- package/lib/types/host/first-party-account-context.js +55 -0
- package/lib/types/host/first-party-account-context.js.map +1 -0
- package/lib/types/host/first-party-models.d.ts +29 -0
- package/lib/types/host/first-party-models.js +459 -0
- package/lib/types/host/first-party-models.js.map +1 -0
- package/lib/types/host/grok-adapter.d.ts +44 -0
- package/lib/types/host/grok-adapter.js +293 -0
- package/lib/types/host/grok-adapter.js.map +1 -0
- package/lib/types/host/grok-models.d.ts +47 -0
- package/lib/types/host/grok-models.js +320 -0
- package/lib/types/host/grok-models.js.map +1 -0
- package/lib/types/host/harness-opencode-accounts.d.ts +17 -0
- package/lib/types/host/harness-opencode-accounts.js +80 -0
- package/lib/types/host/harness-opencode-accounts.js.map +1 -0
- package/lib/types/host/hermes-account-context.d.ts +8 -0
- package/lib/types/host/hermes-account-context.js +99 -0
- package/lib/types/host/hermes-account-context.js.map +1 -0
- package/lib/types/host/hermes-accounts.d.ts +19 -0
- package/lib/types/host/hermes-accounts.js +356 -0
- package/lib/types/host/hermes-accounts.js.map +1 -0
- package/lib/types/host/hermes-adapter.d.ts +93 -0
- package/lib/types/host/hermes-adapter.js +455 -0
- package/lib/types/host/hermes-adapter.js.map +1 -0
- package/lib/types/host/hermes-env.d.ts +4 -0
- package/lib/types/host/hermes-env.js +22 -0
- package/lib/types/host/hermes-env.js.map +1 -0
- package/lib/types/host/hermes-installation.d.ts +10 -0
- package/lib/types/host/hermes-installation.js +181 -0
- package/lib/types/host/hermes-installation.js.map +1 -0
- package/lib/types/host/hermes-models.d.ts +26 -0
- package/lib/types/host/hermes-models.js +328 -0
- package/lib/types/host/hermes-models.js.map +1 -0
- package/lib/types/host/hermes-native-entry.py +96 -0
- package/lib/types/host/hermes-nous-refresh.py +331 -0
- package/lib/types/host/hermes-nous.d.ts +53 -0
- package/lib/types/host/hermes-nous.js +343 -0
- package/lib/types/host/hermes-nous.js.map +1 -0
- package/lib/types/host/hermes-renewal.d.ts +27 -0
- package/lib/types/host/hermes-renewal.js +292 -0
- package/lib/types/host/hermes-renewal.js.map +1 -0
- package/lib/types/host/hermes-suppression.d.ts +7 -0
- package/lib/types/host/hermes-suppression.js +69 -0
- package/lib/types/host/hermes-suppression.js.map +1 -0
- package/lib/types/host/hermes-windows-installation.d.ts +5 -0
- package/lib/types/host/hermes-windows-installation.js +91 -0
- package/lib/types/host/hermes-windows-installation.js.map +1 -0
- package/lib/types/host/index.d.ts +140 -0
- package/lib/types/host/index.js +947 -0
- package/lib/types/host/index.js.map +1 -0
- package/lib/types/host/kimi-accounts.d.ts +17 -0
- package/lib/types/host/kimi-accounts.js +220 -0
- package/lib/types/host/kimi-accounts.js.map +1 -0
- package/lib/types/host/kimi-oauth-models.d.ts +14 -0
- package/lib/types/host/kimi-oauth-models.js +246 -0
- package/lib/types/host/kimi-oauth-models.js.map +1 -0
- package/lib/types/host/managed-agent.d.ts +4 -0
- package/lib/types/host/managed-agent.js +127 -0
- package/lib/types/host/managed-agent.js.map +1 -0
- package/lib/types/host/mimo-configuration.d.ts +22 -0
- package/lib/types/host/mimo-configuration.js +258 -0
- package/lib/types/host/mimo-configuration.js.map +1 -0
- package/lib/types/host/mimo-metadata-cache.d.ts +22 -0
- package/lib/types/host/mimo-metadata-cache.js +121 -0
- package/lib/types/host/mimo-metadata-cache.js.map +1 -0
- package/lib/types/host/native-capability-cache.d.ts +11 -0
- package/lib/types/host/native-capability-cache.js +94 -0
- package/lib/types/host/native-capability-cache.js.map +1 -0
- package/lib/types/host/native-launch.d.mts +2 -0
- package/lib/types/host/native-launch.mjs +234 -0
- package/lib/types/host/native-process.d.ts +5 -0
- package/lib/types/host/native-process.js +41 -0
- package/lib/types/host/native-process.js.map +1 -0
- package/lib/types/host/native-spawn.mjs +32 -0
- package/lib/types/host/opencode-adapter.d.ts +94 -0
- package/lib/types/host/opencode-adapter.js +507 -0
- package/lib/types/host/opencode-adapter.js.map +1 -0
- package/lib/types/host/opencode-native.d.ts +27 -0
- package/lib/types/host/opencode-native.js +403 -0
- package/lib/types/host/opencode-native.js.map +1 -0
- package/lib/types/host/own-account-lease.d.mts +5 -0
- package/lib/types/host/own-account-lease.mjs +105 -0
- package/lib/types/host/pi-installation.d.mts +7 -0
- package/lib/types/host/pi-installation.mjs +87 -0
- package/lib/types/host/pi-omp-accounts.d.ts +28 -0
- package/lib/types/host/pi-omp-accounts.js +175 -0
- package/lib/types/host/pi-omp-accounts.js.map +1 -0
- package/lib/types/host/pi-omp-adapter.d.ts +32 -0
- package/lib/types/host/pi-omp-adapter.js +190 -0
- package/lib/types/host/pi-omp-adapter.js.map +1 -0
- package/lib/types/host/pi-omp-environment.d.mts +1 -0
- package/lib/types/host/pi-omp-environment.mjs +15 -0
- package/lib/types/host/pi-omp-identity.d.ts +2 -0
- package/lib/types/host/pi-omp-identity.js +142 -0
- package/lib/types/host/pi-omp-identity.js.map +1 -0
- package/lib/types/host/pi-omp-logout.d.ts +3 -0
- package/lib/types/host/pi-omp-logout.js +152 -0
- package/lib/types/host/pi-omp-logout.js.map +1 -0
- package/lib/types/host/pi-omp-native.d.ts +71 -0
- package/lib/types/host/pi-omp-native.js +753 -0
- package/lib/types/host/pi-omp-native.js.map +1 -0
- package/lib/types/host/pi-omp-refresh.d.mts +7 -0
- package/lib/types/host/pi-omp-refresh.mjs +324 -0
- package/lib/types/host/private-launch.mjs +23 -0
- package/lib/types/host/process.d.ts +43 -0
- package/lib/types/host/process.js +134 -0
- package/lib/types/host/process.js.map +1 -0
- package/lib/types/host/protocol.d.ts +23 -0
- package/lib/types/host/protocol.js +112 -0
- package/lib/types/host/protocol.js.map +1 -0
- package/lib/types/host/roles.d.ts +34 -0
- package/lib/types/host/roles.js +80 -0
- package/lib/types/host/roles.js.map +1 -0
- package/lib/types/host/routing.d.ts +31 -0
- package/lib/types/host/routing.js +248 -0
- package/lib/types/host/routing.js.map +1 -0
- package/lib/types/host/runtime.d.ts +60 -0
- package/lib/types/host/runtime.js +598 -0
- package/lib/types/host/runtime.js.map +1 -0
- package/lib/types/host/storage.d.ts +48 -0
- package/lib/types/host/storage.js +449 -0
- package/lib/types/host/storage.js.map +1 -0
- package/lib/types/host/telemetry.d.ts +17 -0
- package/lib/types/host/telemetry.js +158 -0
- package/lib/types/host/telemetry.js.map +1 -0
- package/lib/types/host/windows-account-bootstrap.ps1 +44 -0
- package/lib/types/host/windows-account-launch.mjs +47 -0
- package/lib/types/host/windows-account-owner.ps1 +137 -0
- package/lib/types/host/windows-account-stdio.mjs +19 -0
- package/lib/types/host/windows-account-terminal.d.ts +17 -0
- package/lib/types/host/windows-account-terminal.js +208 -0
- package/lib/types/host/windows-account-terminal.js.map +1 -0
- package/lib/types/host/windows-agy-account.ps1 +81 -0
- package/lib/types/host/windows-cli-installation.d.ts +31 -0
- package/lib/types/host/windows-cli-installation.js +157 -0
- package/lib/types/host/windows-cli-installation.js.map +1 -0
- package/lib/types/host/windows-hidden-launch.mjs +49 -0
- package/lib/types/host/windows-hidden-process.d.ts +12 -0
- package/lib/types/host/windows-hidden-process.js +116 -0
- package/lib/types/host/windows-hidden-process.js.map +1 -0
- package/lib/types/host/zcode-account-models.d.ts +16 -0
- package/lib/types/host/zcode-account-models.js +114 -0
- package/lib/types/host/zcode-account-models.js.map +1 -0
- package/lib/types/host/zcode-adapter.d.ts +93 -0
- package/lib/types/host/zcode-adapter.js +808 -0
- package/lib/types/host/zcode-adapter.js.map +1 -0
- package/lib/types/host/zcode-grok-accounts.d.ts +30 -0
- package/lib/types/host/zcode-grok-accounts.js +408 -0
- package/lib/types/host/zcode-grok-accounts.js.map +1 -0
- package/lib/types/shared/accounts.d.ts +47 -0
- package/lib/types/shared/accounts.js +2 -0
- package/lib/types/shared/accounts.js.map +1 -0
- package/lib/types/shared/builtin-presets.d.ts +2 -0
- package/lib/types/shared/builtin-presets.js +231 -0
- package/lib/types/shared/builtin-presets.js.map +1 -0
- package/lib/types/shared/cli-settings.d.ts +5 -0
- package/lib/types/shared/cli-settings.js +2 -0
- package/lib/types/shared/cli-settings.js.map +1 -0
- package/lib/types/shared/model-presentation.d.ts +10 -0
- package/lib/types/shared/model-presentation.js +95 -0
- package/lib/types/shared/model-presentation.js.map +1 -0
- package/lib/types/shared/models.d.ts +7 -0
- package/lib/types/shared/models.js +35 -0
- package/lib/types/shared/models.js.map +1 -0
- package/lib/types/shared/telemetry.d.ts +18 -0
- package/lib/types/shared/telemetry.js +16 -0
- package/lib/types/shared/telemetry.js.map +1 -0
- package/lib/types/shared/types.d.ts +127 -0
- package/lib/types/shared/types.js +147 -0
- package/lib/types/shared/types.js.map +1 -0
- package/lib/windows-account-bootstrap.ps1 +44 -0
- package/lib/windows-account-launch.mjs +47 -0
- package/lib/windows-account-owner.ps1 +137 -0
- package/lib/windows-account-stdio.mjs +19 -0
- package/lib/windows-agy-account.ps1 +81 -0
- package/lib/windows-hidden-launch.mjs +49 -0
- package/lib/zcode-resume.mjs +423 -0
- package/package.json +109 -4
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { lstat, mkdir, mkdtemp, realpath, rm, symlink, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { readPiOmpLogoutSources, safePiOmpAncestors } from "./pi-omp-native.js";
|
|
5
|
+
import { projectDirectory } from "./process.js";
|
|
6
|
+
import { ompConfigurationEnvironment } from './pi-omp-environment.mjs';
|
|
7
|
+
/** No snapshot, migration or credential deletion here: only native user-operated menus. */
|
|
8
|
+
export async function preparePiOmpLogout(input) {
|
|
9
|
+
const { cli, signal } = input;
|
|
10
|
+
signal?.throwIfAborted();
|
|
11
|
+
projectDirectory(input.project);
|
|
12
|
+
const sources = await readPiOmpLogoutSources(cli, input.stateDirectory, signal ?? new AbortController().signal, { nativeHome: input.nativeHome });
|
|
13
|
+
const source = input.source
|
|
14
|
+
? sources.find((item) => item.id === input.source)
|
|
15
|
+
: sources.length === 1
|
|
16
|
+
? sources[0]
|
|
17
|
+
: undefined;
|
|
18
|
+
if (!source)
|
|
19
|
+
throw new Error(sources.length > 1 && !input.source ? '请选择要退出的账号来源' : '账号来源已变化,请刷新后重试');
|
|
20
|
+
const directory = await realpath(source.directory);
|
|
21
|
+
await safePiOmpAncestors(directory);
|
|
22
|
+
signal?.throwIfAborted();
|
|
23
|
+
const parent = join(resolve(input.stateDirectory), 'account-runtime');
|
|
24
|
+
await safePiOmpAncestors(parent);
|
|
25
|
+
await mkdir(parent, { recursive: true, mode: 0o700 });
|
|
26
|
+
const parentIdentity = await lstat(parent);
|
|
27
|
+
const runtime = await mkdtemp(join(parent, `${cli}-logout-`));
|
|
28
|
+
const identity = await lstat(runtime);
|
|
29
|
+
let removed = false;
|
|
30
|
+
const cleanup = async () => {
|
|
31
|
+
if (removed)
|
|
32
|
+
return;
|
|
33
|
+
const currentParent = await lstat(parent);
|
|
34
|
+
if (currentParent.isSymbolicLink() ||
|
|
35
|
+
currentParent.dev !== parentIdentity.dev ||
|
|
36
|
+
currentParent.ino !== parentIdentity.ino)
|
|
37
|
+
throw new Error('Account runtime parent changed before cleanup');
|
|
38
|
+
try {
|
|
39
|
+
const current = await lstat(runtime);
|
|
40
|
+
if (current.isSymbolicLink() || current.dev !== identity.dev || current.ino !== identity.ino)
|
|
41
|
+
throw new Error('Account runtime changed before cleanup');
|
|
42
|
+
await rm(runtime, { recursive: true, force: true });
|
|
43
|
+
removed = true;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
if (error.code === 'ENOENT')
|
|
47
|
+
removed = true;
|
|
48
|
+
else
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
try {
|
|
53
|
+
const agent = join(runtime, 'agent'), temporary = join(runtime, 'tmp');
|
|
54
|
+
for (const path of [agent, temporary, join(runtime, 'sessions'), join(runtime, 'logs')])
|
|
55
|
+
await mkdir(path, { mode: 0o700 });
|
|
56
|
+
const env = {
|
|
57
|
+
...source.env,
|
|
58
|
+
PI_CODING_AGENT_DIR: agent,
|
|
59
|
+
TMPDIR: temporary,
|
|
60
|
+
TMP: temporary,
|
|
61
|
+
TEMP: temporary,
|
|
62
|
+
ELECTRON_RUN_AS_NODE: '1',
|
|
63
|
+
OMP_AUTH_BROKER_URL: '',
|
|
64
|
+
OMP_AUTH_BROKER_TOKEN: '',
|
|
65
|
+
OMP_PROFILE: '',
|
|
66
|
+
PI_PROFILE: '',
|
|
67
|
+
};
|
|
68
|
+
let native;
|
|
69
|
+
if (cli === 'pi') {
|
|
70
|
+
const auth = source.stored ? join(directory, 'auth.json') : join(agent, 'auth.json');
|
|
71
|
+
if (!source.stored)
|
|
72
|
+
await writeFile(auth, '{}', { flag: 'wx', mode: 0o600 });
|
|
73
|
+
native = [
|
|
74
|
+
process.execPath,
|
|
75
|
+
fileURLToPath(new URL('./pi-login.mjs', import.meta.url)),
|
|
76
|
+
input.executable,
|
|
77
|
+
'logout',
|
|
78
|
+
auth,
|
|
79
|
+
];
|
|
80
|
+
env.PI_OFFLINE = '1';
|
|
81
|
+
env.PI_TELEMETRY = '0';
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// Operate on the selected real DB, never a copied DB/WAL. Windows uses the
|
|
85
|
+
// native agent root directly without requiring symlink privileges.
|
|
86
|
+
if (source.stored) {
|
|
87
|
+
if (process.platform === 'win32') {
|
|
88
|
+
if (source.brokerConfigured)
|
|
89
|
+
throw new Error('请先在 OMP 自身配置中停用账号代理,再退出该来源');
|
|
90
|
+
env.PI_CODING_AGENT_DIR = directory;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
await symlink(join(directory, 'agent.db'), join(agent, 'agent.db'));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
await writeFile(join(agent, 'config.yml'), JSON.stringify({
|
|
97
|
+
...source.config,
|
|
98
|
+
auth: { ...(source.config.auth ?? {}), broker: undefined },
|
|
99
|
+
startup: { setupWizard: false, showSplash: false, checkUpdate: false },
|
|
100
|
+
disabledProviders: [
|
|
101
|
+
'native',
|
|
102
|
+
'claude',
|
|
103
|
+
'claude-plugins',
|
|
104
|
+
'codex',
|
|
105
|
+
'cursor',
|
|
106
|
+
'gemini',
|
|
107
|
+
'opencode',
|
|
108
|
+
'mcp-json',
|
|
109
|
+
'vscode',
|
|
110
|
+
'windsurf',
|
|
111
|
+
'omp-plugins',
|
|
112
|
+
],
|
|
113
|
+
mcp: { enableProjectConfig: false },
|
|
114
|
+
retry: { modelFallback: false },
|
|
115
|
+
memory: { backend: 'off' },
|
|
116
|
+
tools: { approvalMode: 'always-ask' },
|
|
117
|
+
}), { mode: 0o600 });
|
|
118
|
+
Object.assign(env, ompConfigurationEnvironment(runtime));
|
|
119
|
+
native = [
|
|
120
|
+
input.executable,
|
|
121
|
+
'--no-session',
|
|
122
|
+
'--no-tools',
|
|
123
|
+
'--no-extensions',
|
|
124
|
+
'--no-skills',
|
|
125
|
+
'--no-rules',
|
|
126
|
+
'--no-title',
|
|
127
|
+
'--no-lsp',
|
|
128
|
+
'--no-pty',
|
|
129
|
+
'--approval-mode',
|
|
130
|
+
'always-ask',
|
|
131
|
+
'--session-dir',
|
|
132
|
+
join(runtime, 'sessions'),
|
|
133
|
+
'--config',
|
|
134
|
+
join(agent, 'config.yml'),
|
|
135
|
+
];
|
|
136
|
+
}
|
|
137
|
+
signal?.throwIfAborted();
|
|
138
|
+
const argv = [process.execPath, fileURLToPath(new URL('./private-launch.mjs', import.meta.url)), ...native];
|
|
139
|
+
return {
|
|
140
|
+
argv,
|
|
141
|
+
cwd: runtime,
|
|
142
|
+
env,
|
|
143
|
+
cleanup,
|
|
144
|
+
instruction: `${source.label}:${cli === 'pi' ? '选择要退出的服务商。' : '输入 /logout,选择服务商和凭据。'}其他来源保留;.env 或模型配置中的 API 请在原配置中管理。`,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
await cleanup();
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=pi-omp-logout.js.map
|
|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K,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,sBAAsB,mCAAmC;SACxH,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,EAAE,CAAA;QACf,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { AccountIdentity } from './account-identity.ts';
|
|
2
|
+
import type { AccountSource } from '../shared/accounts.ts';
|
|
3
|
+
import type { PiOmpCli } from './pi-omp-adapter.ts';
|
|
4
|
+
export interface PiOmpNativeOptions {
|
|
5
|
+
accountRoot?: string;
|
|
6
|
+
nativeHome?: string;
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
/** Deprecated. Worker copies are never authoritative credential sources. */
|
|
9
|
+
preserveCredentials?: boolean;
|
|
10
|
+
/** Internal runtime mode; direct metadata projections never write native accounts. */
|
|
11
|
+
sharedOAuth?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const piOmpAccountDirectory: (cli: PiOmpCli, root?: string) => string;
|
|
14
|
+
/** Preserve drive and UNC roots instead of treating them as ordinary path components. */
|
|
15
|
+
export declare function nativeAccountAncestors(path: string, paths?: {
|
|
16
|
+
resolve: (...paths: string[]) => string;
|
|
17
|
+
parse: (path: string) => import("path").ParsedPath;
|
|
18
|
+
relative: (from: string, to: string) => string;
|
|
19
|
+
join: (...paths: string[]) => string;
|
|
20
|
+
sep: "\\" | "/";
|
|
21
|
+
}): string[];
|
|
22
|
+
export declare function safePiOmpAncestors(path: string): Promise<void>;
|
|
23
|
+
/** Current native roots only. Account actions must never remove a merged worker copy. */
|
|
24
|
+
export declare function readPiOmpLogoutSources(cli: PiOmpCli, stateDirectory: string | undefined, signal: AbortSignal, options?: {
|
|
25
|
+
nativeHome?: string;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
id: AccountSource;
|
|
28
|
+
label: string;
|
|
29
|
+
directory: string;
|
|
30
|
+
env: Record<string, string>;
|
|
31
|
+
config: Record<string, any>;
|
|
32
|
+
stored: boolean;
|
|
33
|
+
brokerConfigured: boolean;
|
|
34
|
+
}[]>;
|
|
35
|
+
export declare function listPiOmpAccountSources(cli: PiOmpCli, stateDirectory: string | undefined, signal: AbortSignal, options?: {
|
|
36
|
+
nativeHome?: string;
|
|
37
|
+
}): Promise<{
|
|
38
|
+
id: AccountSource;
|
|
39
|
+
label: string;
|
|
40
|
+
}[]>;
|
|
41
|
+
/** Internal binding material only. Never expose these values through public status. */
|
|
42
|
+
export declare function readPiOmpAccountMaterial(cli: PiOmpCli, options?: PiOmpNativeOptions): Promise<{
|
|
43
|
+
auth: any;
|
|
44
|
+
credentials: any[];
|
|
45
|
+
env: Record<string, string>;
|
|
46
|
+
models: {
|
|
47
|
+
providers: any;
|
|
48
|
+
};
|
|
49
|
+
configAuth: any;
|
|
50
|
+
sourceIds: string[];
|
|
51
|
+
}>;
|
|
52
|
+
/** Global native input then plugin account overrides by provider; empty plugin auth never hides global accounts. */
|
|
53
|
+
export declare function snapshotPiOmpNative(cli: PiOmpCli, destination: string, options?: PiOmpNativeOptions): Promise<{
|
|
54
|
+
leaseDirectory?: string | undefined;
|
|
55
|
+
receipt?: {
|
|
56
|
+
version: number;
|
|
57
|
+
cli: PiOmpCli;
|
|
58
|
+
revision: string;
|
|
59
|
+
entries: any[];
|
|
60
|
+
fixed: any[];
|
|
61
|
+
} | undefined;
|
|
62
|
+
configured: boolean;
|
|
63
|
+
expired: boolean;
|
|
64
|
+
providers: string[];
|
|
65
|
+
env: Record<string, string>;
|
|
66
|
+
directory: string;
|
|
67
|
+
}>;
|
|
68
|
+
export declare function inspectPiOmpNativeAccount(cli: PiOmpCli, stateDirectory: string | undefined, signal: AbortSignal, options?: {
|
|
69
|
+
nativeHome?: string;
|
|
70
|
+
}): Promise<AccountIdentity>;
|
|
71
|
+
export declare function restorePiOmpEnvironment(directory: string): Promise<Record<string, string>>;
|