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,103 @@
|
|
|
1
|
+
import { GT as Defect, JT as Literals, QT as String, ZT as Number, cE as is, eE as TaggedErrorClass, uE as optional } from "../shared.js";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/preview.ts
|
|
3
|
+
/**
|
|
4
|
+
* Pure URL helpers shared between the preview server, desktop main process,
|
|
5
|
+
* and web renderer. Centralising these guarantees the four call sites agree
|
|
6
|
+
* on what counts as "loopback" and how to normalise a free-form URL string.
|
|
7
|
+
*/
|
|
8
|
+
const TAB_ID_PREFIX = "tab_";
|
|
9
|
+
let nextPreviewTabSequence = 0;
|
|
10
|
+
/**
|
|
11
|
+
* Generate a fresh preview tab id. Lives in shared (not contracts) because
|
|
12
|
+
* the contracts package is schema-only — runtime helpers belong here.
|
|
13
|
+
*/
|
|
14
|
+
function newPreviewTabId() {
|
|
15
|
+
nextPreviewTabSequence += 1;
|
|
16
|
+
return `${TAB_ID_PREFIX}${nextPreviewTabSequence.toString(36)}`;
|
|
17
|
+
}
|
|
18
|
+
const LOOPBACK_HOSTS = /* @__PURE__ */ new Set([
|
|
19
|
+
"localhost",
|
|
20
|
+
"127.0.0.1",
|
|
21
|
+
"0.0.0.0",
|
|
22
|
+
"::1"
|
|
23
|
+
]);
|
|
24
|
+
/** Internal — used by `lsof` parsing where the host string is wire-formatted. */
|
|
25
|
+
const LSOF_LOCAL_HOST_TOKENS = /* @__PURE__ */ new Set([
|
|
26
|
+
...LOOPBACK_HOSTS,
|
|
27
|
+
"*",
|
|
28
|
+
"[::]",
|
|
29
|
+
"[::1]"
|
|
30
|
+
]);
|
|
31
|
+
const LOOPBACK_PREFIX_PATTERN = /^(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1?\])(?::|\/|$)/i;
|
|
32
|
+
function isLoopbackHost(host) {
|
|
33
|
+
if (LOOPBACK_HOSTS.has(host)) return true;
|
|
34
|
+
if (host === "[::1]") return true;
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
/** True when a raw URL string looks like a loopback dev URL we can preview. */
|
|
38
|
+
function isPreviewableUrl(rawUrl) {
|
|
39
|
+
try {
|
|
40
|
+
const parsed = new URL(rawUrl);
|
|
41
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return false;
|
|
42
|
+
return isLoopbackHost(parsed.hostname);
|
|
43
|
+
} catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
var PreviewUrlNormalizationError = class extends TaggedErrorClass()("PreviewUrlNormalizationError", {
|
|
48
|
+
inputLength: Number,
|
|
49
|
+
reason: Literals([
|
|
50
|
+
"empty",
|
|
51
|
+
"parse",
|
|
52
|
+
"unsupported-protocol"
|
|
53
|
+
]),
|
|
54
|
+
protocol: optional(String),
|
|
55
|
+
cause: optional(Defect())
|
|
56
|
+
}) {
|
|
57
|
+
get message() {
|
|
58
|
+
const protocol = this.protocol === void 0 ? "" : `: ${this.protocol}`;
|
|
59
|
+
return `Invalid preview URL (${this.reason}${protocol}; input length ${this.inputLength}).`;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const isPreviewUrlNormalizationError = is(PreviewUrlNormalizationError);
|
|
63
|
+
function previewUrlProtocol(rawUrl) {
|
|
64
|
+
return /^([A-Za-z][A-Za-z\d+.-]*):/.exec(rawUrl)?.[1]?.toLowerCase().concat(":");
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Normalise a free-form URL string into a fully-qualified `http(s)://` URL.
|
|
68
|
+
*
|
|
69
|
+
* - Bare loopback hosts (`localhost`, `localhost:5173`) become `http://...`.
|
|
70
|
+
* - Bare public hosts (`example.com`) become `https://...`.
|
|
71
|
+
* - Already-qualified URLs are validated and returned as `URL.href`.
|
|
72
|
+
*
|
|
73
|
+
* Throws `PreviewUrlNormalizationError` for empty, unparseable, or
|
|
74
|
+
* unsupported-protocol inputs.
|
|
75
|
+
*/
|
|
76
|
+
function normalizePreviewUrl(rawUrl) {
|
|
77
|
+
const trimmed = rawUrl.trim();
|
|
78
|
+
if (trimmed.length === 0) throw new PreviewUrlNormalizationError({
|
|
79
|
+
inputLength: rawUrl.length,
|
|
80
|
+
reason: "empty"
|
|
81
|
+
});
|
|
82
|
+
const useHttp = LOOPBACK_PREFIX_PATTERN.test(trimmed);
|
|
83
|
+
const candidate = trimmed.includes("://") ? trimmed : `${useHttp ? "http" : "https"}://${trimmed}`;
|
|
84
|
+
let parsed;
|
|
85
|
+
try {
|
|
86
|
+
parsed = new URL(candidate);
|
|
87
|
+
} catch (cause) {
|
|
88
|
+
throw new PreviewUrlNormalizationError({
|
|
89
|
+
inputLength: rawUrl.length,
|
|
90
|
+
reason: "parse",
|
|
91
|
+
protocol: previewUrlProtocol(candidate),
|
|
92
|
+
cause
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new PreviewUrlNormalizationError({
|
|
96
|
+
inputLength: rawUrl.length,
|
|
97
|
+
reason: "unsupported-protocol",
|
|
98
|
+
protocol: parsed.protocol
|
|
99
|
+
});
|
|
100
|
+
return parsed.href;
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { LSOF_LOCAL_HOST_TOKENS, PreviewUrlNormalizationError, isLoopbackHost, isPreviewUrlNormalizationError, isPreviewableUrl, newPreviewTabId, normalizePreviewUrl };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Gy as PreviewAutomationResizeInput, Nb as PreviewViewportPresetId, Pb as PreviewViewportSetting } from "../shared.js";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/previewViewport.d.ts
|
|
3
|
+
interface PreviewViewportPreset {
|
|
4
|
+
readonly id: PreviewViewportPresetId;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly category: "Desktop" | "Tablet" | "Phone";
|
|
7
|
+
readonly detail: string;
|
|
8
|
+
readonly width: number;
|
|
9
|
+
readonly height: number;
|
|
10
|
+
}
|
|
11
|
+
declare const PREVIEW_VIEWPORT_PRESETS: ReadonlyArray<PreviewViewportPreset>;
|
|
12
|
+
declare function resolvePreviewViewport(input: PreviewAutomationResizeInput): PreviewViewportSetting;
|
|
13
|
+
declare function previewViewportLabel(viewport: PreviewViewportSetting): string;
|
|
14
|
+
declare function previewViewportPresetOrientation(viewport: PreviewViewportSetting): "portrait" | "landscape" | null;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { PREVIEW_VIEWPORT_PRESETS, PreviewViewportPreset, previewViewportLabel, previewViewportPresetOrientation, resolvePreviewViewport };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { J_ as PREVIEW_VIEWPORT_PRESET_IDS } from "../shared.js";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/previewViewport.ts
|
|
3
|
+
const PREVIEW_VIEWPORT_PRESET_DEFINITIONS = {
|
|
4
|
+
"iphone-se": {
|
|
5
|
+
label: "iPhone SE",
|
|
6
|
+
category: "Phone",
|
|
7
|
+
detail: "375 × 667",
|
|
8
|
+
width: 375,
|
|
9
|
+
height: 667
|
|
10
|
+
},
|
|
11
|
+
"iphone-xr": {
|
|
12
|
+
label: "iPhone XR",
|
|
13
|
+
category: "Phone",
|
|
14
|
+
detail: "414 × 896",
|
|
15
|
+
width: 414,
|
|
16
|
+
height: 896
|
|
17
|
+
},
|
|
18
|
+
"iphone-12-pro": {
|
|
19
|
+
label: "iPhone 12 Pro",
|
|
20
|
+
category: "Phone",
|
|
21
|
+
detail: "390 × 844",
|
|
22
|
+
width: 390,
|
|
23
|
+
height: 844
|
|
24
|
+
},
|
|
25
|
+
"iphone-14-pro-max": {
|
|
26
|
+
label: "iPhone 14 Pro Max",
|
|
27
|
+
category: "Phone",
|
|
28
|
+
detail: "430 × 932",
|
|
29
|
+
width: 430,
|
|
30
|
+
height: 932
|
|
31
|
+
},
|
|
32
|
+
"pixel-7": {
|
|
33
|
+
label: "Pixel 7",
|
|
34
|
+
category: "Phone",
|
|
35
|
+
detail: "412 × 915",
|
|
36
|
+
width: 412,
|
|
37
|
+
height: 915
|
|
38
|
+
},
|
|
39
|
+
"samsung-galaxy-s8-plus": {
|
|
40
|
+
label: "Samsung Galaxy S8+",
|
|
41
|
+
category: "Phone",
|
|
42
|
+
detail: "360 × 740",
|
|
43
|
+
width: 360,
|
|
44
|
+
height: 740
|
|
45
|
+
},
|
|
46
|
+
"samsung-galaxy-s20-ultra": {
|
|
47
|
+
label: "Samsung Galaxy S20 Ultra",
|
|
48
|
+
category: "Phone",
|
|
49
|
+
detail: "412 × 915",
|
|
50
|
+
width: 412,
|
|
51
|
+
height: 915
|
|
52
|
+
},
|
|
53
|
+
"ipad-mini": {
|
|
54
|
+
label: "iPad Mini",
|
|
55
|
+
category: "Tablet",
|
|
56
|
+
detail: "768 × 1024",
|
|
57
|
+
width: 768,
|
|
58
|
+
height: 1024
|
|
59
|
+
},
|
|
60
|
+
"ipad-air": {
|
|
61
|
+
label: "iPad Air",
|
|
62
|
+
category: "Tablet",
|
|
63
|
+
detail: "820 × 1180",
|
|
64
|
+
width: 820,
|
|
65
|
+
height: 1180
|
|
66
|
+
},
|
|
67
|
+
"ipad-pro": {
|
|
68
|
+
label: "iPad Pro",
|
|
69
|
+
category: "Tablet",
|
|
70
|
+
detail: "1024 × 1366",
|
|
71
|
+
width: 1024,
|
|
72
|
+
height: 1366
|
|
73
|
+
},
|
|
74
|
+
"surface-pro-7": {
|
|
75
|
+
label: "Surface Pro 7",
|
|
76
|
+
category: "Tablet",
|
|
77
|
+
detail: "912 × 1368",
|
|
78
|
+
width: 912,
|
|
79
|
+
height: 1368
|
|
80
|
+
},
|
|
81
|
+
"surface-duo": {
|
|
82
|
+
label: "Surface Duo",
|
|
83
|
+
category: "Phone",
|
|
84
|
+
detail: "540 × 720",
|
|
85
|
+
width: 540,
|
|
86
|
+
height: 720
|
|
87
|
+
},
|
|
88
|
+
"galaxy-z-fold-5": {
|
|
89
|
+
label: "Galaxy Z Fold 5",
|
|
90
|
+
category: "Phone",
|
|
91
|
+
detail: "344 × 882",
|
|
92
|
+
width: 344,
|
|
93
|
+
height: 882
|
|
94
|
+
},
|
|
95
|
+
"asus-zenbook-fold": {
|
|
96
|
+
label: "Asus Zenbook Fold",
|
|
97
|
+
category: "Tablet",
|
|
98
|
+
detail: "853 × 1280",
|
|
99
|
+
width: 853,
|
|
100
|
+
height: 1280
|
|
101
|
+
},
|
|
102
|
+
"samsung-galaxy-a51-71": {
|
|
103
|
+
label: "Samsung Galaxy A51/71",
|
|
104
|
+
category: "Phone",
|
|
105
|
+
detail: "412 × 914",
|
|
106
|
+
width: 412,
|
|
107
|
+
height: 914
|
|
108
|
+
},
|
|
109
|
+
"nest-hub": {
|
|
110
|
+
label: "Nest Hub",
|
|
111
|
+
category: "Tablet",
|
|
112
|
+
detail: "1024 × 600",
|
|
113
|
+
width: 1024,
|
|
114
|
+
height: 600
|
|
115
|
+
},
|
|
116
|
+
"nest-hub-max": {
|
|
117
|
+
label: "Nest Hub Max",
|
|
118
|
+
category: "Tablet",
|
|
119
|
+
detail: "1280 × 800",
|
|
120
|
+
width: 1280,
|
|
121
|
+
height: 800
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const PREVIEW_VIEWPORT_PRESETS = PREVIEW_VIEWPORT_PRESET_IDS.map((id) => ({
|
|
125
|
+
id,
|
|
126
|
+
...PREVIEW_VIEWPORT_PRESET_DEFINITIONS[id]
|
|
127
|
+
}));
|
|
128
|
+
function resolvePreviewViewport(input) {
|
|
129
|
+
if (input.mode === "fill") return { _tag: "fill" };
|
|
130
|
+
if (input.mode === "preset" && input.preset !== void 0) {
|
|
131
|
+
const preset = PREVIEW_VIEWPORT_PRESETS.find((candidate) => candidate.id === input.preset);
|
|
132
|
+
if (!preset) throw new Error(`Unknown preview viewport preset: ${input.preset}`);
|
|
133
|
+
const landscape = input.orientation === "landscape";
|
|
134
|
+
const portrait = input.orientation === "portrait";
|
|
135
|
+
const nativePortrait = preset.height >= preset.width;
|
|
136
|
+
const shouldSwap = landscape && nativePortrait || portrait && !nativePortrait;
|
|
137
|
+
return {
|
|
138
|
+
_tag: "preset",
|
|
139
|
+
width: shouldSwap ? preset.height : preset.width,
|
|
140
|
+
height: shouldSwap ? preset.width : preset.height,
|
|
141
|
+
presetId: preset.id
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
if (input.width === void 0 || input.height === void 0) throw new Error("Custom preview viewport requires width and height");
|
|
145
|
+
return {
|
|
146
|
+
_tag: "freeform",
|
|
147
|
+
width: input.width,
|
|
148
|
+
height: input.height
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function previewViewportLabel(viewport) {
|
|
152
|
+
return viewport._tag === "fill" ? "Fill panel" : `${viewport.width} × ${viewport.height}`;
|
|
153
|
+
}
|
|
154
|
+
function previewViewportPresetOrientation(viewport) {
|
|
155
|
+
if (viewport._tag === "fill" || viewport.width === viewport.height) return null;
|
|
156
|
+
return viewport.width > viewport.height ? "landscape" : "portrait";
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
159
|
+
export { PREVIEW_VIEWPORT_PRESETS, previewViewportLabel, previewViewportPresetOrientation, resolvePreviewViewport };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/projectFavicon.d.ts
|
|
2
|
+
declare const PROJECT_FAVICON_FALLBACK_MARKER = "project-favicon-missing";
|
|
3
|
+
declare function isProjectFaviconFallbackUrl(url: string | null | undefined): boolean;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { PROJECT_FAVICON_FALLBACK_MARKER, isProjectFaviconFallbackUrl };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/projectFavicon.ts
|
|
2
|
+
const PROJECT_FAVICON_FALLBACK_MARKER = "project-favicon-missing";
|
|
3
|
+
function isProjectFaviconFallbackUrl(url) {
|
|
4
|
+
if (!url) return false;
|
|
5
|
+
try {
|
|
6
|
+
const pathname = new URL(url, "https://t3.invalid").pathname;
|
|
7
|
+
return pathname.slice(pathname.lastIndexOf("/") + 1) === PROJECT_FAVICON_FALLBACK_MARKER;
|
|
8
|
+
} catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { PROJECT_FAVICON_FALLBACK_MARKER, isProjectFaviconFallbackUrl };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Ev as ProjectScript } from "../shared.js";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/projectScripts.d.ts
|
|
3
|
+
interface ProjectScriptRuntimeEnvInput {
|
|
4
|
+
project: {
|
|
5
|
+
cwd: string;
|
|
6
|
+
};
|
|
7
|
+
worktreePath?: string | null;
|
|
8
|
+
extraEnv?: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
declare function projectScriptCwd(input: {
|
|
11
|
+
project: {
|
|
12
|
+
cwd: string;
|
|
13
|
+
};
|
|
14
|
+
worktreePath?: string | null;
|
|
15
|
+
}): string;
|
|
16
|
+
declare function projectScriptRuntimeEnv(input: ProjectScriptRuntimeEnvInput): Record<string, string>;
|
|
17
|
+
declare function setupProjectScript(scripts: readonly ProjectScript[]): ProjectScript | null;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { projectScriptCwd, projectScriptRuntimeEnv, setupProjectScript };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/projectScripts.ts
|
|
2
|
+
function projectScriptCwd(input) {
|
|
3
|
+
return input.worktreePath ?? input.project.cwd;
|
|
4
|
+
}
|
|
5
|
+
function projectScriptRuntimeEnv(input) {
|
|
6
|
+
const env = { T3CODE_PROJECT_ROOT: input.project.cwd };
|
|
7
|
+
if (input.worktreePath) env.T3CODE_WORKTREE_PATH = input.worktreePath;
|
|
8
|
+
if (input.extraEnv) return {
|
|
9
|
+
...env,
|
|
10
|
+
...input.extraEnv
|
|
11
|
+
};
|
|
12
|
+
return env;
|
|
13
|
+
}
|
|
14
|
+
function setupProjectScript(scripts) {
|
|
15
|
+
return scripts.find((script) => script.runOnWorktreeCreate) ?? null;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { projectScriptCwd, projectScriptRuntimeEnv, setupProjectScript };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/qrCode.d.ts
|
|
2
|
+
type bit = number;
|
|
3
|
+
type byte = number;
|
|
4
|
+
type int = number;
|
|
5
|
+
declare class QrCode {
|
|
6
|
+
static Ecc: typeof QrCodeEcc;
|
|
7
|
+
static encodeText(text: string, ecl: QrCodeEcc): QrCode;
|
|
8
|
+
static encodeBinary(data: Readonly<Array<byte>>, ecl: QrCodeEcc): QrCode;
|
|
9
|
+
static encodeSegments(segs: Readonly<Array<QrSegment>>, ecl: QrCodeEcc, minVersion?: int, maxVersion?: int, mask?: int, boostEcl?: boolean): QrCode;
|
|
10
|
+
readonly version: int;
|
|
11
|
+
readonly errorCorrectionLevel: QrCodeEcc;
|
|
12
|
+
readonly size: int;
|
|
13
|
+
readonly mask: int;
|
|
14
|
+
private readonly modules;
|
|
15
|
+
private readonly isFunction;
|
|
16
|
+
constructor(version: int, errorCorrectionLevel: QrCodeEcc, dataCodewords: Readonly<Array<byte>>, msk: int);
|
|
17
|
+
getModule(x: int, y: int): boolean;
|
|
18
|
+
private drawFunctionPatterns;
|
|
19
|
+
private drawFormatBits;
|
|
20
|
+
private drawVersion;
|
|
21
|
+
private drawFinderPattern;
|
|
22
|
+
private drawAlignmentPattern;
|
|
23
|
+
private setFunctionModule;
|
|
24
|
+
private addEccAndInterleave;
|
|
25
|
+
private drawCodewords;
|
|
26
|
+
private applyMask;
|
|
27
|
+
private getPenaltyScore;
|
|
28
|
+
private getAlignmentPatternPositions;
|
|
29
|
+
private static getNumRawDataModules;
|
|
30
|
+
private static getNumDataCodewords;
|
|
31
|
+
private static reedSolomonComputeDivisor;
|
|
32
|
+
private static reedSolomonComputeRemainder;
|
|
33
|
+
private static reedSolomonMultiply;
|
|
34
|
+
private finderPenaltyCountPatterns;
|
|
35
|
+
private finderPenaltyTerminateAndCount;
|
|
36
|
+
private finderPenaltyAddHistory;
|
|
37
|
+
static readonly MIN_VERSION: int;
|
|
38
|
+
static readonly MAX_VERSION: int;
|
|
39
|
+
private static readonly PENALTY_N1;
|
|
40
|
+
private static readonly PENALTY_N2;
|
|
41
|
+
private static readonly PENALTY_N3;
|
|
42
|
+
private static readonly PENALTY_N4;
|
|
43
|
+
private static readonly ECC_CODEWORDS_PER_BLOCK;
|
|
44
|
+
private static readonly NUM_ERROR_CORRECTION_BLOCKS;
|
|
45
|
+
}
|
|
46
|
+
declare class QrSegment {
|
|
47
|
+
static Mode: typeof QrSegmentMode;
|
|
48
|
+
static makeBytes(data: Readonly<Array<byte>>): QrSegment;
|
|
49
|
+
static makeNumeric(digits: string): QrSegment;
|
|
50
|
+
static makeAlphanumeric(text: string): QrSegment;
|
|
51
|
+
static makeSegments(text: string): Array<QrSegment>;
|
|
52
|
+
static makeEci(assignVal: int): QrSegment;
|
|
53
|
+
static isNumeric(text: string): boolean;
|
|
54
|
+
static isAlphanumeric(text: string): boolean;
|
|
55
|
+
readonly mode: QrSegmentMode;
|
|
56
|
+
readonly numChars: int;
|
|
57
|
+
private readonly bitData;
|
|
58
|
+
constructor(mode: QrSegmentMode, numChars: int, bitData: Array<bit>);
|
|
59
|
+
getData(): Array<bit>;
|
|
60
|
+
static getTotalBits(segs: Readonly<Array<QrSegment>>, version: int): number;
|
|
61
|
+
private static toUtf8ByteArray;
|
|
62
|
+
private static readonly NUMERIC_REGEX;
|
|
63
|
+
private static readonly ALPHANUMERIC_REGEX;
|
|
64
|
+
private static readonly ALPHANUMERIC_CHARSET;
|
|
65
|
+
}
|
|
66
|
+
declare class QrCodeEcc {
|
|
67
|
+
static readonly LOW: QrCodeEcc;
|
|
68
|
+
static readonly MEDIUM: QrCodeEcc;
|
|
69
|
+
static readonly QUARTILE: QrCodeEcc;
|
|
70
|
+
static readonly HIGH: QrCodeEcc;
|
|
71
|
+
readonly ordinal: int;
|
|
72
|
+
readonly formatBits: int;
|
|
73
|
+
private constructor();
|
|
74
|
+
}
|
|
75
|
+
declare class QrSegmentMode {
|
|
76
|
+
static readonly NUMERIC: QrSegmentMode;
|
|
77
|
+
static readonly ALPHANUMERIC: QrSegmentMode;
|
|
78
|
+
static readonly BYTE: QrSegmentMode;
|
|
79
|
+
static readonly KANJI: QrSegmentMode;
|
|
80
|
+
static readonly ECI: QrSegmentMode;
|
|
81
|
+
readonly modeBits: int;
|
|
82
|
+
private readonly numBitsCharCount;
|
|
83
|
+
private constructor();
|
|
84
|
+
numCharCountBits(ver: int): int;
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { QrCode, QrSegment };
|