t3code-cli 0.13.0 → 0.14.1
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 +87 -1
- package/dist/application.d.ts +2 -0
- package/dist/application.js +1 -1
- package/dist/auth.d.ts +50 -0
- package/dist/auth.js +1 -1
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +355 -606
- package/dist/cli.d.ts +66 -0
- package/dist/cli.js +1 -1
- package/dist/client-runtime/authorization.d.ts +2 -0
- package/dist/client-runtime/authorization.js +2 -0
- package/dist/client-runtime/connection.d.ts +2 -0
- package/dist/client-runtime/connection.js +2 -0
- package/dist/client-runtime/environment.d.ts +57 -0
- package/dist/client-runtime/environment.js +2 -0
- package/dist/client-runtime/errors.d.ts +28 -0
- package/dist/client-runtime/errors.js +35 -0
- package/dist/client-runtime/operations/projects.d.ts +2 -0
- package/dist/client-runtime/operations/projects.js +2 -0
- package/dist/client-runtime/operations.d.ts +2 -0
- package/dist/client-runtime/operations.js +2 -0
- package/dist/client-runtime/platform.d.ts +26 -0
- package/dist/client-runtime/platform.js +74 -0
- package/dist/client-runtime/relay.d.ts +121 -0
- package/dist/client-runtime/relay.js +245 -0
- package/dist/client-runtime/rpc.d.ts +2 -0
- package/dist/client-runtime/rpc.js +2 -0
- package/dist/client-runtime/state/assets.d.ts +40 -0
- package/dist/client-runtime/state/assets.js +53 -0
- package/dist/client-runtime/state/auth.d.ts +98 -0
- package/dist/client-runtime/state/auth.js +48 -0
- package/dist/client-runtime/state/connections.d.ts +2 -0
- package/dist/client-runtime/state/connections.js +52 -0
- package/dist/client-runtime/state/entities.d.ts +33 -0
- package/dist/client-runtime/state/entities.js +2 -0
- package/dist/client-runtime/state/filesystem.d.ts +42 -0
- package/dist/client-runtime/state/filesystem.js +48 -0
- package/dist/client-runtime/state/git.d.ts +43 -0
- package/dist/client-runtime/state/git.js +18 -0
- package/dist/client-runtime/state/models.d.ts +2 -0
- package/dist/client-runtime/state/models.js +2 -0
- package/dist/client-runtime/state/orchestration.d.ts +128 -0
- package/dist/client-runtime/state/orchestration.js +20 -0
- package/dist/client-runtime/state/presentation.d.ts +277 -0
- package/dist/client-runtime/state/presentation.js +34 -0
- package/dist/client-runtime/state/preview.d.ts +447 -0
- package/dist/client-runtime/state/preview.js +103 -0
- package/dist/client-runtime/state/project-grouping.d.ts +26 -0
- package/dist/client-runtime/state/project-grouping.js +73 -0
- package/dist/client-runtime/state/projects.d.ts +192 -0
- package/dist/client-runtime/state/projects.js +2 -0
- package/dist/client-runtime/state/relay.d.ts +10 -0
- package/dist/client-runtime/state/relay.js +19 -0
- package/dist/client-runtime/state/review.d.ts +28 -0
- package/dist/client-runtime/state/review.js +11 -0
- package/dist/client-runtime/state/runtime.d.ts +2 -0
- package/dist/client-runtime/state/runtime.js +2 -0
- package/dist/client-runtime/state/server.d.ts +1495 -0
- package/dist/client-runtime/state/server.js +207 -0
- package/dist/client-runtime/state/session.d.ts +532 -0
- package/dist/client-runtime/state/session.js +21 -0
- package/dist/client-runtime/state/shell.d.ts +529 -0
- package/dist/client-runtime/state/shell.js +2 -0
- package/dist/client-runtime/state/source-control.d.ts +92 -0
- package/dist/client-runtime/state/source-control.js +36 -0
- package/dist/client-runtime/state/terminal.d.ts +237 -0
- package/dist/client-runtime/state/terminal.js +173 -0
- package/dist/client-runtime/state/thread-settled.d.ts +104 -0
- package/dist/client-runtime/state/thread-settled.js +157 -0
- package/dist/client-runtime/state/thread-sort.d.ts +23 -0
- package/dist/client-runtime/state/thread-sort.js +47 -0
- package/dist/client-runtime/state/threads.d.ts +538 -0
- package/dist/client-runtime/state/threads.js +934 -0
- package/dist/client-runtime/state/vcs.d.ts +442 -0
- package/dist/client-runtime/state/vcs.js +756 -0
- package/dist/config.d.ts +84 -0
- package/dist/config.js +1 -1
- package/dist/connection.d.ts +7 -0
- package/dist/connection.js +1 -1
- package/dist/contracts.d.ts +2 -0
- package/dist/contracts.js +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/node.d.ts +6 -0
- package/dist/node.js +1 -1
- package/dist/orchestration.d.ts +1420 -0
- package/dist/orchestration.js +1 -1
- package/dist/preview.d.ts +2 -0
- package/dist/preview.js +2 -0
- package/dist/rpc.d.ts +6043 -0
- package/dist/rpc.js +1 -1
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +2 -2
- package/dist/shared/DrainableWorker.d.ts +28 -0
- package/dist/shared/DrainableWorker.js +24 -0
- package/dist/shared/KeyedCoalescingWorker.d.ts +13 -0
- package/dist/shared/KeyedCoalescingWorker.js +89 -0
- package/dist/shared/Net.d.ts +43 -0
- package/dist/shared/Net.js +126 -0
- package/dist/shared/String.d.ts +4 -0
- package/dist/shared/String.js +8 -0
- package/dist/shared/Struct.d.ts +5 -0
- package/dist/shared/Struct.js +2 -0
- package/dist/shared/advertisedEndpoint.d.ts +2 -0
- package/dist/shared/advertisedEndpoint.js +2 -0
- package/dist/shared/agentAwareness.d.ts +27 -0
- package/dist/shared/agentAwareness.js +54 -0
- package/dist/shared/backgroundActivitySettings.d.ts +23 -0
- package/dist/shared/backgroundActivitySettings.js +2 -0
- package/dist/shared/chatList.d.ts +12 -0
- package/dist/shared/chatList.js +14 -0
- package/dist/shared/cliArgs.d.ts +33 -0
- package/dist/shared/cliArgs.js +103 -0
- package/dist/shared/composerInlineTokens.d.ts +20 -0
- package/dist/shared/composerInlineTokens.js +72 -0
- package/dist/shared/composerTrigger.d.ts +26 -0
- package/dist/shared/composerTrigger.js +97 -0
- package/dist/shared/connectAuth.d.ts +58 -0
- package/dist/shared/connectAuth.js +89 -0
- package/dist/shared/devHome.d.ts +21 -0
- package/dist/shared/devHome.js +65 -0
- package/dist/shared/devProxy.d.ts +15 -0
- package/dist/shared/devProxy.js +22 -0
- package/dist/shared/dpop.d.ts +32 -0
- package/dist/shared/dpop.js +2724 -0
- package/dist/shared/dpopCommon.d.ts +2 -0
- package/dist/shared/dpopCommon.js +2 -0
- package/dist/shared/filePreview.d.ts +8 -0
- package/dist/shared/filePreview.js +31 -0
- package/dist/shared/git.d.ts +41 -0
- package/dist/shared/git.js +2 -0
- package/dist/shared/hostProcess.d.ts +13 -0
- package/dist/shared/hostProcess.js +2 -0
- package/dist/shared/httpObservability.d.ts +5 -0
- package/dist/shared/httpObservability.js +2 -0
- package/dist/shared/httpReadiness.d.ts +38 -0
- package/dist/shared/httpReadiness.js +110 -0
- package/dist/shared/keybindings.d.ts +35 -0
- package/dist/shared/keybindings.js +330 -0
- package/dist/shared/logging.d.ts +39 -0
- package/dist/shared/logging.js +2 -0
- package/dist/shared/model.d.ts +44 -0
- package/dist/shared/model.js +2 -0
- package/dist/shared/oauthScope.d.ts +23 -0
- package/dist/shared/oauthScope.js +2 -0
- package/dist/shared/observability.d.ts +105 -0
- package/dist/shared/observability.js +346 -0
- package/dist/shared/orchestrationTiming.d.ts +16 -0
- package/dist/shared/orchestrationTiming.js +32 -0
- package/dist/shared/path.d.ts +2 -0
- package/dist/shared/path.js +2 -0
- package/dist/shared/preview.d.ts +35 -0
- package/dist/shared/preview.js +103 -0
- package/dist/shared/previewViewport.d.ts +16 -0
- package/dist/shared/previewViewport.js +159 -0
- package/dist/shared/projectFavicon.d.ts +5 -0
- package/dist/shared/projectFavicon.js +13 -0
- package/dist/shared/projectScripts.d.ts +19 -0
- package/dist/shared/projectScripts.js +18 -0
- package/dist/shared/qrCode.d.ts +87 -0
- package/dist/shared/qrCode.js +870 -0
- package/dist/shared/relayAuth.d.ts +27 -0
- package/dist/shared/relayAuth.js +83 -0
- package/dist/shared/relayClient.d.ts +58 -0
- package/dist/shared/relayClient.js +245 -0
- package/dist/shared/relayJwt.d.ts +39 -0
- package/dist/shared/relayJwt.js +2 -0
- package/dist/shared/relaySigning.d.ts +4 -0
- package/dist/shared/relaySigning.js +2 -0
- package/dist/shared/relayTracing.d.ts +25 -0
- package/dist/shared/relayTracing.js +2 -0
- package/dist/shared/relayUrl.d.ts +5 -0
- package/dist/shared/relayUrl.js +2 -0
- package/dist/shared/remote.d.ts +57 -0
- package/dist/shared/remote.js +2 -0
- package/dist/shared/schemaJson.d.ts +35 -0
- package/dist/shared/schemaJson.js +2 -0
- package/dist/shared/schemaYaml.d.ts +86 -0
- package/dist/shared/schemaYaml.js +99 -0
- package/dist/shared/searchRanking.d.ts +30 -0
- package/dist/shared/searchRanking.js +99 -0
- package/dist/shared/semver.d.ts +23 -0
- package/dist/shared/semver.js +124 -0
- package/dist/shared/serverSettings.d.ts +19 -0
- package/dist/shared/serverSettings.js +103 -0
- package/dist/shared/shell.d.ts +51 -0
- package/dist/shared/shell.js +408 -0
- package/dist/shared/sourceControl.d.ts +26 -0
- package/dist/shared/sourceControl.js +2 -0
- package/dist/shared/t3ProjectFile.d.ts +27 -0
- package/dist/shared/t3ProjectFile.js +25 -0
- package/dist/shared/terminalLabels.d.ts +16 -0
- package/dist/shared/terminalLabels.js +28 -0
- package/dist/shared/toolActivity.d.ts +16 -0
- package/dist/shared/toolActivity.js +159 -0
- package/dist/shared.d.ts +43036 -0
- package/dist/shared.js +25428 -12277
- package/dist/t3tools.d.ts +2 -0
- package/dist/t3tools.js +1 -1
- package/package.json +39 -21
- package/src/auth/index.ts +2 -0
- package/src/auth/pairing.ts +8 -5
- package/src/auth/service.ts +2 -1
- package/src/auth/transport.ts +4 -0
- package/src/auth/type.ts +6 -0
- package/src/bin.ts +10 -7
- package/src/cli/auth.ts +7 -1
- package/src/contracts/index.ts +8 -0
- package/src/orchestration/layer.ts +36 -0
- package/src/orchestration/service.ts +5 -0
- package/src/preview/index.ts +11 -0
- package/src/preview/service.ts +52 -0
- package/src/rpc/error.ts +2 -0
- package/src/rpc/layer.ts +5 -4
- package/src/rpc/operation.ts +5 -4
- package/src/rpc/ws-group.ts +6 -0
- package/src/runtime/index.ts +1 -0
- package/src/runtime/layer.ts +5 -0
- package/src/sql/node-sqlite-client.ts +3 -0
- package/dist/src/application/actions.d.ts +0 -25
- package/dist/src/application/error.d.ts +0 -3
- package/dist/src/application/index.d.ts +0 -4
- package/dist/src/application/layer.d.ts +0 -117
- package/dist/src/application/model-selection.d.ts +0 -34
- package/dist/src/application/models.d.ts +0 -8
- package/dist/src/application/project-commands.d.ts +0 -44
- package/dist/src/application/projects.d.ts +0 -23
- package/dist/src/application/service.d.ts +0 -243
- package/dist/src/application/shell-sequence.d.ts +0 -96
- package/dist/src/application/terminals.d.ts +0 -66
- package/dist/src/application/thread-commands.d.ts +0 -157
- package/dist/src/application/thread-update.d.ts +0 -8
- package/dist/src/application/thread-wait.d.ts +0 -106
- package/dist/src/application/threads.d.ts +0 -660
- package/dist/src/auth/error.d.ts +0 -50
- package/dist/src/auth/index.d.ts +0 -10
- package/dist/src/auth/layer.d.ts +0 -53
- package/dist/src/auth/local-base-dir.d.ts +0 -8
- package/dist/src/auth/local-origin.d.ts +0 -18
- package/dist/src/auth/local-token.d.ts +0 -26
- package/dist/src/auth/local.d.ts +0 -24
- package/dist/src/auth/pairing.d.ts +0 -22
- package/dist/src/auth/remote-error.d.ts +0 -3
- package/dist/src/auth/schema.d.ts +0 -58
- package/dist/src/auth/service.d.ts +0 -27
- package/dist/src/auth/transport.d.ts +0 -22
- package/dist/src/auth/type.d.ts +0 -83
- package/dist/src/cli/env/flag.d.ts +0 -2
- package/dist/src/cli/env/index.d.ts +0 -2
- package/dist/src/cli/env/selection-layer.d.ts +0 -3
- package/dist/src/cli/flags.d.ts +0 -20
- package/dist/src/cli/format/index.d.ts +0 -1
- package/dist/src/cli/format/output.d.ts +0 -12
- package/dist/src/cli/index.d.ts +0 -5
- package/dist/src/cli/runtime/index.d.ts +0 -1
- package/dist/src/cli/runtime/service.d.ts +0 -16
- package/dist/src/cli/scope/index.d.ts +0 -1
- package/dist/src/cli/scope/resolve.d.ts +0 -20
- package/dist/src/cli-path/layer.d.ts +0 -3
- package/dist/src/cli-path/service.d.ts +0 -8
- package/dist/src/config/config.d.ts +0 -49
- package/dist/src/config/credential/cipher-node.d.ts +0 -3
- package/dist/src/config/credential/cipher-web.d.ts +0 -3
- package/dist/src/config/credential/cipher.d.ts +0 -29
- package/dist/src/config/credential/env.d.ts +0 -3
- package/dist/src/config/credential/error.d.ts +0 -8
- package/dist/src/config/credential/index.d.ts +0 -6
- package/dist/src/config/credential/service.d.ts +0 -34
- package/dist/src/config/env/env.d.ts +0 -55
- package/dist/src/config/env/index.d.ts +0 -2
- package/dist/src/config/env/layout.d.ts +0 -11
- package/dist/src/config/environment-name/index.d.ts +0 -1
- package/dist/src/config/environment-name/name.d.ts +0 -10
- package/dist/src/config/error.d.ts +0 -11
- package/dist/src/config/index.d.ts +0 -10
- package/dist/src/config/keystore/error.d.ts +0 -8
- package/dist/src/config/keystore/file.d.ts +0 -9
- package/dist/src/config/keystore/index.d.ts +0 -4
- package/dist/src/config/keystore/keyring-node.d.ts +0 -4
- package/dist/src/config/keystore/service.d.ts +0 -33
- package/dist/src/config/paths/index.d.ts +0 -1
- package/dist/src/config/paths/paths.d.ts +0 -6
- package/dist/src/config/persist/file-mode.d.ts +0 -4
- package/dist/src/config/persist/migration.d.ts +0 -68
- package/dist/src/config/persist/persist.d.ts +0 -40
- package/dist/src/config/persist/schema.d.ts +0 -68
- package/dist/src/config/resolve/resolve.d.ts +0 -40
- package/dist/src/config/selection/index.d.ts +0 -1
- package/dist/src/config/selection/resolve.d.ts +0 -4
- package/dist/src/config/selection/service.d.ts +0 -10
- package/dist/src/config/types.d.ts +0 -36
- package/dist/src/config/url/error.d.ts +0 -10
- package/dist/src/config/url/index.d.ts +0 -2
- package/dist/src/config/url/url.d.ts +0 -6
- package/dist/src/connection/error.d.ts +0 -10
- package/dist/src/connection/index.d.ts +0 -4
- package/dist/src/connection/layer.d.ts +0 -3
- package/dist/src/connection/prepared.d.ts +0 -14
- package/dist/src/connection/service.d.ts +0 -13
- package/dist/src/connection/type.d.ts +0 -10
- package/dist/src/contracts/index.d.ts +0 -1
- package/dist/src/domain/error.d.ts +0 -57
- package/dist/src/domain/helpers.d.ts +0 -179
- package/dist/src/domain/model-config.d.ts +0 -330
- package/dist/src/domain/thread-activities.d.ts +0 -14
- package/dist/src/domain/thread-lifecycle.d.ts +0 -120
- package/dist/src/index.d.ts +0 -3
- package/dist/src/node/connection.d.ts +0 -2
- package/dist/src/node/index.d.ts +0 -1
- package/dist/src/orchestration/index.d.ts +0 -2
- package/dist/src/orchestration/layer.d.ts +0 -1419
- package/dist/src/orchestration/service.d.ts +0 -28
- package/dist/src/rpc/error.d.ts +0 -16
- package/dist/src/rpc/index.d.ts +0 -6
- package/dist/src/rpc/layer.d.ts +0 -5862
- package/dist/src/rpc/operation.d.ts +0 -24
- package/dist/src/rpc/service.d.ts +0 -15
- package/dist/src/rpc/session.d.ts +0 -22
- package/dist/src/rpc/ws-group.d.ts +0 -1984
- package/dist/src/runtime/index.d.ts +0 -1
- package/dist/src/runtime/layer.d.ts +0 -15
- package/dist/src/sql/node-sqlite-client.d.ts +0 -10
- package/dist/src/sql/service.d.ts +0 -17
- package/dist/src/t3tools/index.d.ts +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/filePreview.d.ts
|
|
2
|
+
declare const WORKSPACE_BROWSER_PREVIEW_EXTENSIONS: readonly [".htm", ".html", ".pdf"];
|
|
3
|
+
declare const WORKSPACE_IMAGE_PREVIEW_EXTENSIONS: readonly [".avif", ".gif", ".ico", ".jpeg", ".jpg", ".png", ".svg", ".webp"];
|
|
4
|
+
declare function isWorkspaceBrowserPreviewPath(path: string): boolean;
|
|
5
|
+
declare function isWorkspaceImagePreviewPath(path: string): boolean;
|
|
6
|
+
declare function isWorkspacePreviewEntryPath(path: string): boolean;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { WORKSPACE_BROWSER_PREVIEW_EXTENSIONS, WORKSPACE_IMAGE_PREVIEW_EXTENSIONS, isWorkspaceBrowserPreviewPath, isWorkspaceImagePreviewPath, isWorkspacePreviewEntryPath };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/filePreview.ts
|
|
2
|
+
const WORKSPACE_BROWSER_PREVIEW_EXTENSIONS = [
|
|
3
|
+
".htm",
|
|
4
|
+
".html",
|
|
5
|
+
".pdf"
|
|
6
|
+
];
|
|
7
|
+
const WORKSPACE_IMAGE_PREVIEW_EXTENSIONS = [
|
|
8
|
+
".avif",
|
|
9
|
+
".gif",
|
|
10
|
+
".ico",
|
|
11
|
+
".jpeg",
|
|
12
|
+
".jpg",
|
|
13
|
+
".png",
|
|
14
|
+
".svg",
|
|
15
|
+
".webp"
|
|
16
|
+
];
|
|
17
|
+
function hasPreviewExtension(path, extensions) {
|
|
18
|
+
const pathWithoutQuery = path.split(/[?#]/, 1)[0]?.toLowerCase() ?? "";
|
|
19
|
+
return extensions.some((extension) => pathWithoutQuery.endsWith(extension));
|
|
20
|
+
}
|
|
21
|
+
function isWorkspaceBrowserPreviewPath(path) {
|
|
22
|
+
return hasPreviewExtension(path, WORKSPACE_BROWSER_PREVIEW_EXTENSIONS);
|
|
23
|
+
}
|
|
24
|
+
function isWorkspaceImagePreviewPath(path) {
|
|
25
|
+
return hasPreviewExtension(path, WORKSPACE_IMAGE_PREVIEW_EXTENSIONS);
|
|
26
|
+
}
|
|
27
|
+
function isWorkspacePreviewEntryPath(path) {
|
|
28
|
+
return isWorkspaceBrowserPreviewPath(path) || isWorkspaceImagePreviewPath(path);
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { WORKSPACE_BROWSER_PREVIEW_EXTENSIONS, WORKSPACE_IMAGE_PREVIEW_EXTENSIONS, isWorkspaceBrowserPreviewPath, isWorkspaceImagePreviewPath, isWorkspacePreviewEntryPath };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { $S as VcsStatusLocalResult, XS as VcsRef, eC as VcsStatusRemoteResult, gC as SourceControlProviderInfo, nC as VcsStatusStreamEvent, tC as VcsStatusResult } from "../shared.js";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/git.d.ts
|
|
3
|
+
declare const WORKTREE_BRANCH_PREFIX = "t3code";
|
|
4
|
+
/**
|
|
5
|
+
* Sanitize an arbitrary string into a valid, lowercase git refName fragment.
|
|
6
|
+
* Strips quotes, collapses separators, limits to 64 chars.
|
|
7
|
+
*/
|
|
8
|
+
declare function sanitizeBranchFragment(raw: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Sanitize a string into a `feature/…` refName name.
|
|
11
|
+
* Preserves an existing `feature/` prefix or slash-separated namespace.
|
|
12
|
+
*/
|
|
13
|
+
declare function sanitizeFeatureBranchName(raw: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a unique `feature/…` refName name that doesn't collide with
|
|
16
|
+
* any existing refName. Appends a numeric suffix when needed.
|
|
17
|
+
*/
|
|
18
|
+
declare function resolveAutoFeatureBranchName(existingBranchNames: readonly string[], preferredBranch?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Strip the remote prefix from a remote ref such as `origin/feature/demo`.
|
|
21
|
+
*/
|
|
22
|
+
declare function deriveLocalBranchNameFromRemoteRef(branchName: string): string;
|
|
23
|
+
declare function buildTemporaryWorktreeBranchName(randomHex: (byteLength: number) => string): string;
|
|
24
|
+
declare function isTemporaryWorktreeBranch(refName: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Normalize a git remote URL into a stable comparison key.
|
|
27
|
+
*/
|
|
28
|
+
declare function normalizeGitRemoteUrl(value: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Best-effort parse of a GitHub `owner/repo` identifier from common remote URL shapes.
|
|
31
|
+
*/
|
|
32
|
+
declare function parseGitHubRepositoryNameWithOwnerFromRemoteUrl(url: string | null): string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Hide `origin/*` remote refs when a matching local refName already exists.
|
|
35
|
+
*/
|
|
36
|
+
declare function dedupeRemoteBranchesWithLocalMatches(refs: ReadonlyArray<VcsRef>): ReadonlyArray<VcsRef>;
|
|
37
|
+
declare function detectSourceControlProviderFromGitRemoteUrl(remoteUrl: string): SourceControlProviderInfo | null;
|
|
38
|
+
declare function mergeGitStatusParts(local: VcsStatusLocalResult, remote: VcsStatusRemoteResult | null): VcsStatusResult;
|
|
39
|
+
declare function applyGitStatusStreamEvent(current: VcsStatusResult | null, event: VcsStatusStreamEvent): VcsStatusResult;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { WORKTREE_BRANCH_PREFIX, applyGitStatusStreamEvent, buildTemporaryWorktreeBranchName, dedupeRemoteBranchesWithLocalMatches, deriveLocalBranchNameFromRemoteRef, detectSourceControlProviderFromGitRemoteUrl, isTemporaryWorktreeBranch, mergeGitStatusParts, normalizeGitRemoteUrl, parseGitHubRepositoryNameWithOwnerFromRemoteUrl, resolveAutoFeatureBranchName, sanitizeBranchFragment, sanitizeFeatureBranchName };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { $ as buildTemporaryWorktreeBranchName, Q as applyGitStatusStreamEvent, Z as WORKTREE_BRANCH_PREFIX, at as normalizeGitRemoteUrl, ct as sanitizeBranchFragment, et as dedupeRemoteBranchesWithLocalMatches, it as mergeGitStatusParts, lt as sanitizeFeatureBranchName, nt as detectSourceControlProviderFromGitRemoteUrl, ot as parseGitHubRepositoryNameWithOwnerFromRemoteUrl, rt as isTemporaryWorktreeBranch, st as resolveAutoFeatureBranchName, tt as deriveLocalBranchNameFromRemoteRef } from "../shared.js";
|
|
2
|
+
export { WORKTREE_BRANCH_PREFIX, applyGitStatusStreamEvent, buildTemporaryWorktreeBranchName, dedupeRemoteBranchesWithLocalMatches, deriveLocalBranchNameFromRemoteRef, detectSourceControlProviderFromGitRemoteUrl, isTemporaryWorktreeBranch, mergeGitStatusParts, normalizeGitRemoteUrl, parseGitHubRepositoryNameWithOwnerFromRemoteUrl, resolveAutoFeatureBranchName, sanitizeBranchFragment, sanitizeFeatureBranchName };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
//#region upstream-t3code/packages/shared/src/hostProcess.d.ts
|
|
4
|
+
declare const HostProcessPlatform: Context.Reference<NodeJS.Platform>;
|
|
5
|
+
declare const HostProcessArchitecture: Context.Reference<NodeJS.Architecture>;
|
|
6
|
+
declare const HostProcessHostname: Context.Reference<string>;
|
|
7
|
+
declare const HostProcessEnvironment: Context.Reference<NodeJS.ProcessEnv>;
|
|
8
|
+
declare const HostProcessWorkingDirectory: Context.Reference<string>;
|
|
9
|
+
declare const HostProcessExecutablePath: Context.Reference<string>;
|
|
10
|
+
declare const HostProcessArguments: Context.Reference<readonly string[]>;
|
|
11
|
+
declare const isHostWindows: Effect.Effect<boolean, never, never>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { HostProcessArchitecture, HostProcessArguments, HostProcessEnvironment, HostProcessExecutablePath, HostProcessHostname, HostProcessPlatform, HostProcessWorkingDirectory, isHostWindows };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as HostProcessHostname, E as isHostWindows, S as HostProcessExecutablePath, T as HostProcessWorkingDirectory, b as HostProcessArguments, w as HostProcessPlatform, x as HostProcessEnvironment, y as HostProcessArchitecture } from "../shared.js";
|
|
2
|
+
export { HostProcessArchitecture, HostProcessArguments, HostProcessEnvironment, HostProcessExecutablePath, HostProcessHostname, HostProcessPlatform, HostProcessWorkingDirectory, isHostWindows };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { HttpClient } from "effect/unstable/http";
|
|
3
|
+
//#region upstream-t3code/packages/shared/src/httpReadiness.d.ts
|
|
4
|
+
declare const DEFAULT_HTTP_READY_PROBE_TIMEOUT_MS = 1000;
|
|
5
|
+
/**
|
|
6
|
+
* Normalizes an arbitrary readiness probe failure into a plain, structured value
|
|
7
|
+
* suitable for diagnostic logging. Preserves the tagged-error `_tag` (and
|
|
8
|
+
* message/cause) shape for Effect tagged errors while recursing through nested
|
|
9
|
+
* `cause`/`reason` chains.
|
|
10
|
+
*/
|
|
11
|
+
declare function describeReadinessCause(cause: unknown): unknown;
|
|
12
|
+
/**
|
|
13
|
+
* Generic HTTP readiness probe shared by the SSH tunnel and the desktop backend
|
|
14
|
+
* manager. Polls `baseUrl + path` until it returns a 2xx response or the overall
|
|
15
|
+
* `timeoutMs` elapses. Each individual probe is bounded by `probeTimeoutMs` so a
|
|
16
|
+
* single hung request cannot stall the retry loop, and the retry cadence is
|
|
17
|
+
* `intervalMs` bounded to roughly `timeoutMs / intervalMs` attempts.
|
|
18
|
+
*
|
|
19
|
+
* The error type is left to the caller via `makeError`, so each consumer keeps
|
|
20
|
+
* its own tagged error. `makeError` is called at every failure site; callers can
|
|
21
|
+
* inspect `cause` (which carries a `kind` discriminator for the probe-timeout and
|
|
22
|
+
* overall-timeout cases) to reproduce phase-specific messages, or ignore it.
|
|
23
|
+
*/
|
|
24
|
+
declare const waitForHttpReady: <E>(input: {
|
|
25
|
+
readonly baseUrl: string;
|
|
26
|
+
readonly path?: string;
|
|
27
|
+
readonly timeoutMs?: number;
|
|
28
|
+
readonly intervalMs?: number;
|
|
29
|
+
readonly probeTimeoutMs?: number;
|
|
30
|
+
readonly makeError: (info: {
|
|
31
|
+
readonly requestUrl: string;
|
|
32
|
+
readonly probeTimeoutMs: number;
|
|
33
|
+
readonly attempt: number;
|
|
34
|
+
readonly cause: unknown;
|
|
35
|
+
}) => E;
|
|
36
|
+
}) => Effect.Effect<void, E, HttpClient.HttpClient>;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { DEFAULT_HTTP_READY_PROBE_TIMEOUT_MS, describeReadinessCause, waitForHttpReady };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { AO as tapError, BC as transform, EO as succeed, GC as set, HC as get, Hk as match, IC as HttpClient, LC as filterStatusOk, QD as fail, RC as retry, Tk as millis, UC as get$1, UO as spaced, WC as make, WO as upTo, aO as gen, cO as logDebug, dO as mapError, eO as fn, jO as timeoutOption, lO as logWarning, oO as ignore, zC as tap } from "../shared.js";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/httpReadiness.ts
|
|
3
|
+
const DEFAULT_HTTP_READY_PROBE_TIMEOUT_MS = 1e3;
|
|
4
|
+
/**
|
|
5
|
+
* Normalizes an arbitrary readiness probe failure into a plain, structured value
|
|
6
|
+
* suitable for diagnostic logging. Preserves the tagged-error `_tag` (and
|
|
7
|
+
* message/cause) shape for Effect tagged errors while recursing through nested
|
|
8
|
+
* `cause`/`reason` chains.
|
|
9
|
+
*/
|
|
10
|
+
function describeReadinessCause(cause) {
|
|
11
|
+
if (cause instanceof Error) {
|
|
12
|
+
const tag = cause._tag;
|
|
13
|
+
const nested = cause.cause;
|
|
14
|
+
return {
|
|
15
|
+
...typeof tag === "string" ? { _tag: tag } : { name: cause.name },
|
|
16
|
+
message: cause.message,
|
|
17
|
+
...nested === void 0 ? {} : { cause: describeReadinessCause(nested) }
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
if (typeof cause !== "object" || cause === null) return cause;
|
|
21
|
+
const record = cause;
|
|
22
|
+
return {
|
|
23
|
+
...typeof record._tag === "string" ? { _tag: record._tag } : {},
|
|
24
|
+
...typeof record.message === "string" ? { message: record.message } : {},
|
|
25
|
+
...record.reason === void 0 ? {} : { reason: describeReadinessCause(record.reason) },
|
|
26
|
+
...record.cause === void 0 ? {} : { cause: describeReadinessCause(record.cause) }
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Generic HTTP readiness probe shared by the SSH tunnel and the desktop backend
|
|
31
|
+
* manager. Polls `baseUrl + path` until it returns a 2xx response or the overall
|
|
32
|
+
* `timeoutMs` elapses. Each individual probe is bounded by `probeTimeoutMs` so a
|
|
33
|
+
* single hung request cannot stall the retry loop, and the retry cadence is
|
|
34
|
+
* `intervalMs` bounded to roughly `timeoutMs / intervalMs` attempts.
|
|
35
|
+
*
|
|
36
|
+
* The error type is left to the caller via `makeError`, so each consumer keeps
|
|
37
|
+
* its own tagged error. `makeError` is called at every failure site; callers can
|
|
38
|
+
* inspect `cause` (which carries a `kind` discriminator for the probe-timeout and
|
|
39
|
+
* overall-timeout cases) to reproduce phase-specific messages, or ignore it.
|
|
40
|
+
*/
|
|
41
|
+
const waitForHttpReady = fn("shared.httpReadiness.waitForHttpReady")(function* (input) {
|
|
42
|
+
const timeoutMs = input.timeoutMs ?? 3e4;
|
|
43
|
+
const intervalMs = input.intervalMs ?? 100;
|
|
44
|
+
const probeTimeoutMs = input.probeTimeoutMs ?? 1e3;
|
|
45
|
+
const retryPolicy = spaced(millis(intervalMs)).pipe(upTo({ times: Math.max(0, Math.ceil(timeoutMs / intervalMs)) }));
|
|
46
|
+
const requestUrl = new URL(input.path ?? "/", input.baseUrl).toString();
|
|
47
|
+
const client = yield* HttpClient;
|
|
48
|
+
const lastProbeFailure = yield* make(null);
|
|
49
|
+
let attempt = 0;
|
|
50
|
+
const makeError = input.makeError;
|
|
51
|
+
const madeErrors = /* @__PURE__ */ new WeakSet();
|
|
52
|
+
const fail$1 = (cause) => {
|
|
53
|
+
const error = makeError({
|
|
54
|
+
requestUrl,
|
|
55
|
+
probeTimeoutMs,
|
|
56
|
+
attempt,
|
|
57
|
+
cause
|
|
58
|
+
});
|
|
59
|
+
if (typeof error === "object" && error !== null) madeErrors.add(error);
|
|
60
|
+
return error;
|
|
61
|
+
};
|
|
62
|
+
const isMadeError = (value) => typeof value === "object" && value !== null && madeErrors.has(value);
|
|
63
|
+
yield* logDebug("httpReadiness.start", {
|
|
64
|
+
baseUrl: input.baseUrl,
|
|
65
|
+
requestUrl,
|
|
66
|
+
timeoutMs,
|
|
67
|
+
intervalMs,
|
|
68
|
+
probeTimeoutMs
|
|
69
|
+
});
|
|
70
|
+
return yield* match(yield* client.pipe(filterStatusOk, transform((effect) => gen(function* () {
|
|
71
|
+
attempt += 1;
|
|
72
|
+
return yield* match(yield* effect.pipe(timeoutOption(millis(probeTimeoutMs)), mapError((cause) => fail$1(cause))), {
|
|
73
|
+
onSome: succeed,
|
|
74
|
+
onNone: () => fail(fail$1({
|
|
75
|
+
kind: "probe-timeout",
|
|
76
|
+
attempt,
|
|
77
|
+
probeTimeoutMs
|
|
78
|
+
}))
|
|
79
|
+
});
|
|
80
|
+
}).pipe(mapError((cause) => isMadeError(cause) ? cause : fail$1(cause)), tapError((cause) => set(lastProbeFailure, {
|
|
81
|
+
attempt,
|
|
82
|
+
cause: describeReadinessCause(cause)
|
|
83
|
+
})))), tap((response) => response.text.pipe(ignore)), retry(retryPolicy)).execute(get(requestUrl)).pipe(mapError((cause) => isMadeError(cause) ? cause : fail$1(cause)), timeoutOption(millis(timeoutMs))), {
|
|
84
|
+
onSome: () => logDebug("httpReadiness.succeeded", {
|
|
85
|
+
baseUrl: input.baseUrl,
|
|
86
|
+
requestUrl,
|
|
87
|
+
attempts: attempt
|
|
88
|
+
}),
|
|
89
|
+
onNone: () => gen(function* () {
|
|
90
|
+
const lastFailure = yield* get$1(lastProbeFailure);
|
|
91
|
+
yield* logWarning("httpReadiness.timedOut", {
|
|
92
|
+
baseUrl: input.baseUrl,
|
|
93
|
+
requestUrl,
|
|
94
|
+
timeoutMs,
|
|
95
|
+
intervalMs,
|
|
96
|
+
probeTimeoutMs,
|
|
97
|
+
attempts: attempt,
|
|
98
|
+
lastFailure
|
|
99
|
+
});
|
|
100
|
+
return yield* fail(fail$1({
|
|
101
|
+
kind: "overall-timeout",
|
|
102
|
+
baseUrl: input.baseUrl,
|
|
103
|
+
timeoutMs,
|
|
104
|
+
lastFailure
|
|
105
|
+
}));
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
//#endregion
|
|
110
|
+
export { DEFAULT_HTTP_READY_PROBE_TIMEOUT_MS, describeReadinessCause, waitForHttpReady };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Hu as KeybindingRule, Ku as KeybindingWhenNode, Uu as KeybindingShortcut, ad as ResolvedKeybindingsConfig, id as ResolvedKeybindingRule } from "../shared.js";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/keybindings.d.ts
|
|
3
|
+
declare const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule>;
|
|
4
|
+
declare function parseKeybindingShortcut(value: string): KeybindingShortcut | null;
|
|
5
|
+
declare function parseKeybindingWhenExpression(expression: string): KeybindingWhenNode | null;
|
|
6
|
+
declare function compileResolvedKeybindingRule(rule: KeybindingRule): ResolvedKeybindingRule | null;
|
|
7
|
+
declare function compileResolvedKeybindingsConfig(config: ReadonlyArray<KeybindingRule>): ResolvedKeybindingsConfig;
|
|
8
|
+
declare const DEFAULT_RESOLVED_KEYBINDINGS: readonly {
|
|
9
|
+
readonly command: "chat.new" | "chat.newLocal" | "commandPalette.toggle" | "composer.stash" | "diff.toggle" | "editor.openFavorite" | "modelPicker.jump.1" | "modelPicker.jump.2" | "modelPicker.jump.3" | "modelPicker.jump.4" | "modelPicker.jump.5" | "modelPicker.jump.6" | "modelPicker.jump.7" | "modelPicker.jump.8" | "modelPicker.jump.9" | "modelPicker.toggle" | "preview.focusUrl" | "preview.refresh" | "preview.resetZoom" | "preview.toggle" | "preview.zoomIn" | "preview.zoomOut" | "rightPanel.toggle" | "sidebar.toggle" | "terminal.close" | "terminal.new" | "terminal.split" | "terminal.splitVertical" | "terminal.toggle" | "thread.jump.1" | "thread.jump.2" | "thread.jump.3" | "thread.jump.4" | "thread.jump.5" | "thread.jump.6" | "thread.jump.7" | "thread.jump.8" | "thread.jump.9" | "thread.next" | "thread.previous" | `script.${string}.run`;
|
|
10
|
+
readonly shortcut: {
|
|
11
|
+
readonly key: string;
|
|
12
|
+
readonly metaKey: boolean;
|
|
13
|
+
readonly ctrlKey: boolean;
|
|
14
|
+
readonly shiftKey: boolean;
|
|
15
|
+
readonly altKey: boolean;
|
|
16
|
+
readonly modKey: boolean;
|
|
17
|
+
};
|
|
18
|
+
readonly whenAst?: {
|
|
19
|
+
readonly type: "identifier";
|
|
20
|
+
readonly name: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly type: "not";
|
|
23
|
+
readonly node: KeybindingWhenNode;
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: "and";
|
|
26
|
+
readonly left: KeybindingWhenNode;
|
|
27
|
+
readonly right: KeybindingWhenNode;
|
|
28
|
+
} | {
|
|
29
|
+
readonly type: "or";
|
|
30
|
+
readonly left: KeybindingWhenNode;
|
|
31
|
+
readonly right: KeybindingWhenNode;
|
|
32
|
+
} | undefined;
|
|
33
|
+
}[];
|
|
34
|
+
//#endregion
|
|
35
|
+
export { DEFAULT_KEYBINDINGS, DEFAULT_RESOLVED_KEYBINDINGS, compileResolvedKeybindingRule, compileResolvedKeybindingsConfig, parseKeybindingShortcut, parseKeybindingWhenExpression };
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { Nm as MODEL_PICKER_JUMP_KEYBINDING_COMMANDS, Rm as THREAD_JUMP_KEYBINDING_COMMANDS } from "../shared.js";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/keybindings.ts
|
|
3
|
+
const DEFAULT_KEYBINDINGS = [
|
|
4
|
+
{
|
|
5
|
+
key: "mod+b",
|
|
6
|
+
command: "sidebar.toggle"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
key: "mod+j",
|
|
10
|
+
command: "terminal.toggle"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
key: "mod+alt+b",
|
|
14
|
+
command: "rightPanel.toggle"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: "mod+d",
|
|
18
|
+
command: "terminal.split",
|
|
19
|
+
when: "terminalFocus"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
key: "mod+shift+d",
|
|
23
|
+
command: "terminal.splitVertical",
|
|
24
|
+
when: "terminalFocus"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
key: "mod+n",
|
|
28
|
+
command: "terminal.new",
|
|
29
|
+
when: "terminalFocus"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: "mod+w",
|
|
33
|
+
command: "terminal.close",
|
|
34
|
+
when: "terminalFocus"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
key: "mod+d",
|
|
38
|
+
command: "diff.toggle",
|
|
39
|
+
when: "!terminalFocus"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
key: "mod+shift+j",
|
|
43
|
+
command: "preview.toggle"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: "mod+r",
|
|
47
|
+
command: "preview.refresh",
|
|
48
|
+
when: "previewFocus"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: "mod+l",
|
|
52
|
+
command: "preview.focusUrl",
|
|
53
|
+
when: "previewFocus"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: "mod+=",
|
|
57
|
+
command: "preview.zoomIn",
|
|
58
|
+
when: "previewFocus"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
key: "mod++",
|
|
62
|
+
command: "preview.zoomIn",
|
|
63
|
+
when: "previewFocus"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: "mod+-",
|
|
67
|
+
command: "preview.zoomOut",
|
|
68
|
+
when: "previewFocus"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key: "mod+0",
|
|
72
|
+
command: "preview.resetZoom",
|
|
73
|
+
when: "previewFocus"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: "mod+k",
|
|
77
|
+
command: "commandPalette.toggle",
|
|
78
|
+
when: "!terminalFocus"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
key: "mod+s",
|
|
82
|
+
command: "composer.stash",
|
|
83
|
+
when: "!terminalFocus"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
key: "mod+n",
|
|
87
|
+
command: "chat.new",
|
|
88
|
+
when: "!terminalFocus"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
key: "mod+shift+o",
|
|
92
|
+
command: "chat.new",
|
|
93
|
+
when: "!terminalFocus"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
key: "mod+shift+n",
|
|
97
|
+
command: "chat.newLocal",
|
|
98
|
+
when: "!terminalFocus"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: "mod+shift+m",
|
|
102
|
+
command: "modelPicker.toggle",
|
|
103
|
+
when: "!terminalFocus"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: "mod+o",
|
|
107
|
+
command: "editor.openFavorite"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
key: "mod+shift+[",
|
|
111
|
+
command: "thread.previous"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
key: "mod+shift+]",
|
|
115
|
+
command: "thread.next"
|
|
116
|
+
},
|
|
117
|
+
...THREAD_JUMP_KEYBINDING_COMMANDS.map((command, index) => ({
|
|
118
|
+
key: `mod+${index + 1}`,
|
|
119
|
+
command
|
|
120
|
+
})),
|
|
121
|
+
...MODEL_PICKER_JUMP_KEYBINDING_COMMANDS.map((command, index) => ({
|
|
122
|
+
key: `mod+${index + 1}`,
|
|
123
|
+
command,
|
|
124
|
+
when: "modelPickerOpen"
|
|
125
|
+
}))
|
|
126
|
+
];
|
|
127
|
+
function normalizeKeyToken(token) {
|
|
128
|
+
if (token === "space") return " ";
|
|
129
|
+
if (token === "esc") return "escape";
|
|
130
|
+
return token;
|
|
131
|
+
}
|
|
132
|
+
function parseKeybindingShortcut(value) {
|
|
133
|
+
const tokens = [...value.toLowerCase().split("+").map((token) => token.trim())];
|
|
134
|
+
let trailingEmptyCount = 0;
|
|
135
|
+
while (tokens[tokens.length - 1] === "") {
|
|
136
|
+
trailingEmptyCount += 1;
|
|
137
|
+
tokens.pop();
|
|
138
|
+
}
|
|
139
|
+
if (trailingEmptyCount > 0) tokens.push("+");
|
|
140
|
+
if (tokens.some((token) => token.length === 0)) return null;
|
|
141
|
+
if (tokens.length === 0) return null;
|
|
142
|
+
let key = null;
|
|
143
|
+
let metaKey = false;
|
|
144
|
+
let ctrlKey = false;
|
|
145
|
+
let shiftKey = false;
|
|
146
|
+
let altKey = false;
|
|
147
|
+
let modKey = false;
|
|
148
|
+
for (const token of tokens) switch (token) {
|
|
149
|
+
case "cmd":
|
|
150
|
+
case "meta":
|
|
151
|
+
metaKey = true;
|
|
152
|
+
break;
|
|
153
|
+
case "ctrl":
|
|
154
|
+
case "control":
|
|
155
|
+
ctrlKey = true;
|
|
156
|
+
break;
|
|
157
|
+
case "shift":
|
|
158
|
+
shiftKey = true;
|
|
159
|
+
break;
|
|
160
|
+
case "alt":
|
|
161
|
+
case "option":
|
|
162
|
+
altKey = true;
|
|
163
|
+
break;
|
|
164
|
+
case "mod":
|
|
165
|
+
modKey = true;
|
|
166
|
+
break;
|
|
167
|
+
default:
|
|
168
|
+
if (key !== null) return null;
|
|
169
|
+
key = normalizeKeyToken(token);
|
|
170
|
+
}
|
|
171
|
+
if (key === null) return null;
|
|
172
|
+
return {
|
|
173
|
+
key,
|
|
174
|
+
metaKey,
|
|
175
|
+
ctrlKey,
|
|
176
|
+
shiftKey,
|
|
177
|
+
altKey,
|
|
178
|
+
modKey
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function tokenizeWhenExpression(expression) {
|
|
182
|
+
const tokens = [];
|
|
183
|
+
let index = 0;
|
|
184
|
+
while (index < expression.length) {
|
|
185
|
+
const current = expression[index];
|
|
186
|
+
if (!current) break;
|
|
187
|
+
if (/\s/.test(current)) {
|
|
188
|
+
index += 1;
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (expression.startsWith("&&", index)) {
|
|
192
|
+
tokens.push({ type: "and" });
|
|
193
|
+
index += 2;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (expression.startsWith("||", index)) {
|
|
197
|
+
tokens.push({ type: "or" });
|
|
198
|
+
index += 2;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (current === "!") {
|
|
202
|
+
tokens.push({ type: "not" });
|
|
203
|
+
index += 1;
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (current === "(") {
|
|
207
|
+
tokens.push({ type: "lparen" });
|
|
208
|
+
index += 1;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (current === ")") {
|
|
212
|
+
tokens.push({ type: "rparen" });
|
|
213
|
+
index += 1;
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
const identifier = /^[A-Za-z_][A-Za-z0-9_.-]*/.exec(expression.slice(index));
|
|
217
|
+
if (!identifier) return null;
|
|
218
|
+
tokens.push({
|
|
219
|
+
type: "identifier",
|
|
220
|
+
value: identifier[0]
|
|
221
|
+
});
|
|
222
|
+
index += identifier[0].length;
|
|
223
|
+
}
|
|
224
|
+
return tokens;
|
|
225
|
+
}
|
|
226
|
+
function parseKeybindingWhenExpression(expression) {
|
|
227
|
+
const tokens = tokenizeWhenExpression(expression);
|
|
228
|
+
if (!tokens || tokens.length === 0) return null;
|
|
229
|
+
let index = 0;
|
|
230
|
+
const parsePrimary = (depth) => {
|
|
231
|
+
if (depth > 64) return null;
|
|
232
|
+
const token = tokens[index];
|
|
233
|
+
if (!token) return null;
|
|
234
|
+
if (token.type === "identifier") {
|
|
235
|
+
index += 1;
|
|
236
|
+
return {
|
|
237
|
+
type: "identifier",
|
|
238
|
+
name: token.value
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
if (token.type === "lparen") {
|
|
242
|
+
index += 1;
|
|
243
|
+
const expressionNode = parseOr(depth + 1);
|
|
244
|
+
const closeToken = tokens[index];
|
|
245
|
+
if (!expressionNode || !closeToken || closeToken.type !== "rparen") return null;
|
|
246
|
+
index += 1;
|
|
247
|
+
return expressionNode;
|
|
248
|
+
}
|
|
249
|
+
return null;
|
|
250
|
+
};
|
|
251
|
+
const parseUnary = (depth) => {
|
|
252
|
+
let notCount = 0;
|
|
253
|
+
while (tokens[index]?.type === "not") {
|
|
254
|
+
index += 1;
|
|
255
|
+
notCount += 1;
|
|
256
|
+
if (notCount > 64) return null;
|
|
257
|
+
}
|
|
258
|
+
let node = parsePrimary(depth);
|
|
259
|
+
if (!node) return null;
|
|
260
|
+
while (notCount > 0) {
|
|
261
|
+
node = {
|
|
262
|
+
type: "not",
|
|
263
|
+
node
|
|
264
|
+
};
|
|
265
|
+
notCount -= 1;
|
|
266
|
+
}
|
|
267
|
+
return node;
|
|
268
|
+
};
|
|
269
|
+
const parseAnd = (depth) => {
|
|
270
|
+
let left = parseUnary(depth);
|
|
271
|
+
if (!left) return null;
|
|
272
|
+
while (tokens[index]?.type === "and") {
|
|
273
|
+
index += 1;
|
|
274
|
+
const right = parseUnary(depth);
|
|
275
|
+
if (!right) return null;
|
|
276
|
+
left = {
|
|
277
|
+
type: "and",
|
|
278
|
+
left,
|
|
279
|
+
right
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
return left;
|
|
283
|
+
};
|
|
284
|
+
const parseOr = (depth) => {
|
|
285
|
+
let left = parseAnd(depth);
|
|
286
|
+
if (!left) return null;
|
|
287
|
+
while (tokens[index]?.type === "or") {
|
|
288
|
+
index += 1;
|
|
289
|
+
const right = parseAnd(depth);
|
|
290
|
+
if (!right) return null;
|
|
291
|
+
left = {
|
|
292
|
+
type: "or",
|
|
293
|
+
left,
|
|
294
|
+
right
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
return left;
|
|
298
|
+
};
|
|
299
|
+
const ast = parseOr(0);
|
|
300
|
+
if (!ast || index !== tokens.length) return null;
|
|
301
|
+
return ast;
|
|
302
|
+
}
|
|
303
|
+
function compileResolvedKeybindingRule(rule) {
|
|
304
|
+
const shortcut = parseKeybindingShortcut(rule.key);
|
|
305
|
+
if (!shortcut) return null;
|
|
306
|
+
if (rule.when !== void 0) {
|
|
307
|
+
const whenAst = parseKeybindingWhenExpression(rule.when);
|
|
308
|
+
if (!whenAst) return null;
|
|
309
|
+
return {
|
|
310
|
+
command: rule.command,
|
|
311
|
+
shortcut,
|
|
312
|
+
whenAst
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
return {
|
|
316
|
+
command: rule.command,
|
|
317
|
+
shortcut
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function compileResolvedKeybindingsConfig(config) {
|
|
321
|
+
const compiled = [];
|
|
322
|
+
for (const rule of config) {
|
|
323
|
+
const result = compileResolvedKeybindingRule(rule);
|
|
324
|
+
if (result) compiled.push(result);
|
|
325
|
+
}
|
|
326
|
+
return compiled.slice(-256);
|
|
327
|
+
}
|
|
328
|
+
const DEFAULT_RESOLVED_KEYBINDINGS = compileResolvedKeybindingsConfig(DEFAULT_KEYBINDINGS);
|
|
329
|
+
//#endregion
|
|
330
|
+
export { DEFAULT_KEYBINDINGS, DEFAULT_RESOLVED_KEYBINDINGS, compileResolvedKeybindingRule, compileResolvedKeybindingsConfig, parseKeybindingShortcut, parseKeybindingWhenExpression };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/logging.d.ts
|
|
3
|
+
interface RotatingFileSinkOptions {
|
|
4
|
+
readonly filePath: string;
|
|
5
|
+
readonly maxBytes: number;
|
|
6
|
+
readonly maxFiles: number;
|
|
7
|
+
readonly throwOnError?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const RotatingFileSinkConfigurationError_base: Schema.Class<RotatingFileSinkConfigurationError, Schema.TaggedStruct<"RotatingFileSinkConfigurationError", {
|
|
10
|
+
readonly option: Schema.Literals<readonly ["maxBytes", "maxFiles"]>;
|
|
11
|
+
readonly received: Schema.Number;
|
|
12
|
+
readonly minimum: Schema.Number;
|
|
13
|
+
}>, import("effect/Cause").YieldableError>;
|
|
14
|
+
declare class RotatingFileSinkConfigurationError extends RotatingFileSinkConfigurationError_base {
|
|
15
|
+
get message(): string;
|
|
16
|
+
}
|
|
17
|
+
declare const RotatingFileSinkError_base: Schema.Class<RotatingFileSinkError, Schema.TaggedStruct<"RotatingFileSinkError", {
|
|
18
|
+
readonly operation: Schema.Literals<readonly ["initialize", "read", "write", "rotate", "prune"]>;
|
|
19
|
+
readonly filePath: Schema.String;
|
|
20
|
+
readonly cause: Schema.Defect;
|
|
21
|
+
}>, import("effect/Cause").YieldableError>;
|
|
22
|
+
declare class RotatingFileSinkError extends RotatingFileSinkError_base {
|
|
23
|
+
get message(): string;
|
|
24
|
+
}
|
|
25
|
+
declare class RotatingFileSink {
|
|
26
|
+
private readonly filePath;
|
|
27
|
+
private readonly maxBytes;
|
|
28
|
+
private readonly maxFiles;
|
|
29
|
+
private readonly throwOnError;
|
|
30
|
+
private currentSize;
|
|
31
|
+
constructor(options: RotatingFileSinkOptions);
|
|
32
|
+
write(chunk: string | Buffer): void;
|
|
33
|
+
private rotate;
|
|
34
|
+
private pruneOverflowBackups;
|
|
35
|
+
private readCurrentSize;
|
|
36
|
+
private withSuffix;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { RotatingFileSink, RotatingFileSinkConfigurationError, RotatingFileSinkError, RotatingFileSinkOptions };
|