t3code-cli 0.12.0 → 0.14.0
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 +392 -630
- 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/rolldown-runtime.js +1 -1
- 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 +36722 -13117
- package/dist/t3tools.d.ts +2 -0
- package/dist/t3tools.js +2 -2
- package/package.json +46 -27
- package/src/application/thread-wait.ts +4 -0
- package/src/auth/error.ts +2 -8
- package/src/auth/index.ts +2 -0
- package/src/auth/pairing.ts +8 -5
- package/src/auth/remote-error.ts +17 -0
- package/src/auth/service.ts +2 -1
- package/src/auth/transport.ts +49 -114
- package/src/auth/type.ts +6 -0
- package/src/cli/auth.ts +7 -1
- package/src/connection/error.ts +4 -1
- package/src/connection/layer.ts +5 -2
- package/src/connection/prepared.ts +83 -0
- package/src/contracts/index.ts +8 -0
- package/src/orchestration/layer.ts +38 -1
- 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 +11 -16
- package/src/rpc/index.ts +3 -2
- package/src/rpc/layer.ts +18 -51
- package/src/rpc/operation.ts +21 -6
- package/src/rpc/service.ts +2 -1
- package/src/rpc/session.ts +168 -0
- package/src/rpc/ws-group.ts +18 -26
- package/src/runtime/index.ts +1 -0
- package/src/runtime/layer.ts +11 -3
- 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 -101
- 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 -111
- package/dist/src/application/threads.d.ts +0 -685
- package/dist/src/auth/error.d.ts +0 -51
- 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/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 -8
- package/dist/src/connection/index.d.ts +0 -4
- package/dist/src/connection/layer.d.ts +0 -3
- 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 -184
- package/dist/src/domain/model-config.d.ts +0 -325
- package/dist/src/domain/thread-activities.d.ts +0 -14
- package/dist/src/domain/thread-lifecycle.d.ts +0 -125
- 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 -1634
- package/dist/src/orchestration/service.d.ts +0 -28
- package/dist/src/rpc/error.d.ts +0 -18
- package/dist/src/rpc/index.d.ts +0 -5
- package/dist/src/rpc/layer.d.ts +0 -6271
- package/dist/src/rpc/operation.d.ts +0 -6280
- package/dist/src/rpc/service.d.ts +0 -15
- package/dist/src/rpc/ws-group.d.ts +0 -2725
- 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,20 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/composerInlineTokens.d.ts
|
|
2
|
+
type ComposerInlineToken = {
|
|
3
|
+
readonly type: "mention";
|
|
4
|
+
readonly value: string;
|
|
5
|
+
readonly source: string;
|
|
6
|
+
readonly start: number;
|
|
7
|
+
readonly end: number;
|
|
8
|
+
} | {
|
|
9
|
+
readonly type: "skill";
|
|
10
|
+
readonly value: string;
|
|
11
|
+
readonly source: string;
|
|
12
|
+
readonly start: number;
|
|
13
|
+
readonly end: number;
|
|
14
|
+
};
|
|
15
|
+
interface CollectComposerInlineTokensOptions {
|
|
16
|
+
readonly preserveTrailingFrom?: ReadonlyArray<ComposerInlineToken>;
|
|
17
|
+
}
|
|
18
|
+
declare function collectComposerInlineTokens(text: string, options?: CollectComposerInlineTokensOptions): ReadonlyArray<ComposerInlineToken>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { CollectComposerInlineTokensOptions, ComposerInlineToken, collectComposerInlineTokens };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/composerInlineTokens.ts
|
|
2
|
+
const SKILL_TOKEN_REGEX = /(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s)/g;
|
|
3
|
+
const MENTION_TOKEN_REGEX = /(^|\s)@(?:"((?:\\.|[^"\\])*)"|([^\s@"]+))(?=\s)/g;
|
|
4
|
+
const FILE_LINK_TOKEN_REGEX = /(^|\s)\[((?:\\.|[^\]\\])*)\]\(([^)\s]+)\)(?=\s)/g;
|
|
5
|
+
const URI_SCHEME_REGEX = /^[A-Za-z][A-Za-z0-9+.-]*:/;
|
|
6
|
+
const WINDOWS_DRIVE_PATH_REGEX = /^[A-Za-z]:[\\/]/;
|
|
7
|
+
const SCOPED_PACKAGE_REFERENCE_REGEX = /^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(?:\/[^\s@"]+)*$/;
|
|
8
|
+
function collectMentionTokens(text) {
|
|
9
|
+
const matches = [];
|
|
10
|
+
for (const match of text.matchAll(FILE_LINK_TOKEN_REGEX)) {
|
|
11
|
+
const fullMatch = match[0];
|
|
12
|
+
const prefix = match[1] ?? "";
|
|
13
|
+
const label = (match[2] ?? "").replace(/\\(.)/g, "$1");
|
|
14
|
+
const encodedPath = match[3] ?? "";
|
|
15
|
+
let path = encodedPath;
|
|
16
|
+
try {
|
|
17
|
+
path = decodeURIComponent(encodedPath);
|
|
18
|
+
} catch {}
|
|
19
|
+
const separatorIndex = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
|
|
20
|
+
const basename = separatorIndex >= 0 ? path.slice(separatorIndex + 1) : path;
|
|
21
|
+
const hasExternalScheme = URI_SCHEME_REGEX.test(path) && !WINDOWS_DRIVE_PATH_REGEX.test(path);
|
|
22
|
+
if (!path || hasExternalScheme || label !== basename) continue;
|
|
23
|
+
const start = (match.index ?? 0) + prefix.length;
|
|
24
|
+
const end = start + fullMatch.length - prefix.length;
|
|
25
|
+
matches.push({
|
|
26
|
+
type: "mention",
|
|
27
|
+
value: path,
|
|
28
|
+
source: text.slice(start, end),
|
|
29
|
+
start,
|
|
30
|
+
end
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
for (const match of text.matchAll(MENTION_TOKEN_REGEX)) {
|
|
34
|
+
const fullMatch = match[0];
|
|
35
|
+
const prefix = match[1] ?? "";
|
|
36
|
+
const quotedPath = match[2];
|
|
37
|
+
const path = quotedPath !== void 0 ? quotedPath.replace(/\\(.)/g, "$1") : match[3] ?? "";
|
|
38
|
+
if (!path || quotedPath === void 0 && SCOPED_PACKAGE_REFERENCE_REGEX.test(path)) continue;
|
|
39
|
+
const start = (match.index ?? 0) + prefix.length;
|
|
40
|
+
const end = start + fullMatch.length - prefix.length;
|
|
41
|
+
matches.push({
|
|
42
|
+
type: "mention",
|
|
43
|
+
value: path,
|
|
44
|
+
source: text.slice(start, end),
|
|
45
|
+
start,
|
|
46
|
+
end
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return matches;
|
|
50
|
+
}
|
|
51
|
+
function collectComposerInlineTokens(text, options = {}) {
|
|
52
|
+
const matches = collectMentionTokens(text);
|
|
53
|
+
for (const match of text.matchAll(SKILL_TOKEN_REGEX)) {
|
|
54
|
+
const fullMatch = match[0];
|
|
55
|
+
const prefix = match[1] ?? "";
|
|
56
|
+
const value = match[2] ?? "";
|
|
57
|
+
if (!value) continue;
|
|
58
|
+
const start = (match.index ?? 0) + prefix.length;
|
|
59
|
+
const end = start + fullMatch.length - prefix.length;
|
|
60
|
+
matches.push({
|
|
61
|
+
type: "skill",
|
|
62
|
+
value,
|
|
63
|
+
source: text.slice(start, end),
|
|
64
|
+
start,
|
|
65
|
+
end
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
for (const token of options.preserveTrailingFrom ?? []) if (token.end === text.length && text.slice(token.start, token.end) === token.source && !matches.some((match) => match.type === token.type && match.start === token.start && match.end === token.end)) matches.push(token);
|
|
69
|
+
return [...matches].sort((left, right) => left.start - right.start);
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { collectComposerInlineTokens };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/composerTrigger.d.ts
|
|
2
|
+
type ComposerTriggerKind = "path" | "slash-command" | "slash-model" | "skill";
|
|
3
|
+
type ComposerSlashCommand = "model" | "plan" | "default";
|
|
4
|
+
interface ComposerTrigger {
|
|
5
|
+
kind: ComposerTriggerKind;
|
|
6
|
+
query: string;
|
|
7
|
+
rangeStart: number;
|
|
8
|
+
rangeEnd: number;
|
|
9
|
+
}
|
|
10
|
+
declare function serializeComposerMentionPath(path: string): string;
|
|
11
|
+
declare function serializeComposerFileLink(path: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Detect an active trigger (@path, $skill, /command) at the cursor position.
|
|
14
|
+
*
|
|
15
|
+
* Accepts an optional `isWhitespaceChar` override so callers with inline
|
|
16
|
+
* placeholder characters (e.g. terminal context chips on web) can treat
|
|
17
|
+
* those as token boundaries.
|
|
18
|
+
*/
|
|
19
|
+
declare function detectComposerTrigger(text: string, cursorInput: number, isWhitespaceChar?: (char: string) => boolean): ComposerTrigger | null;
|
|
20
|
+
declare function parseStandaloneComposerSlashCommand(text: string): Exclude<ComposerSlashCommand, "model"> | null;
|
|
21
|
+
declare function replaceTextRange(text: string, rangeStart: number, rangeEnd: number, replacement: string): {
|
|
22
|
+
text: string;
|
|
23
|
+
cursor: number;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { ComposerSlashCommand, ComposerTrigger, ComposerTriggerKind, detectComposerTrigger, parseStandaloneComposerSlashCommand, replaceTextRange, serializeComposerFileLink, serializeComposerMentionPath };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/composerTrigger.ts
|
|
2
|
+
const SIMPLE_MENTION_PATH_REGEX = /^[^\s@"\\]+$/;
|
|
3
|
+
function serializeComposerMentionPath(path) {
|
|
4
|
+
if (SIMPLE_MENTION_PATH_REGEX.test(path)) return path;
|
|
5
|
+
return `"${path.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}"`;
|
|
6
|
+
}
|
|
7
|
+
function composerFileLinkBasename(path) {
|
|
8
|
+
const separatorIndex = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
|
|
9
|
+
return separatorIndex >= 0 ? path.slice(separatorIndex + 1) : path;
|
|
10
|
+
}
|
|
11
|
+
function escapeMarkdownLinkLabel(label) {
|
|
12
|
+
return label.replaceAll("\\", "\\\\").replaceAll("[", "\\[").replaceAll("]", "\\]");
|
|
13
|
+
}
|
|
14
|
+
function encodeMarkdownLinkDestination(path) {
|
|
15
|
+
return encodeURI(path).replaceAll("(", "%28").replaceAll(")", "%29").replaceAll("#", "%23").replaceAll("?", "%3F").replaceAll("\\", "%5C");
|
|
16
|
+
}
|
|
17
|
+
function serializeComposerFileLink(path) {
|
|
18
|
+
return `[${escapeMarkdownLinkLabel(composerFileLinkBasename(path))}](${encodeMarkdownLinkDestination(path)})`;
|
|
19
|
+
}
|
|
20
|
+
function clampCursor(text, cursor) {
|
|
21
|
+
if (!Number.isFinite(cursor)) return text.length;
|
|
22
|
+
return Math.max(0, Math.min(text.length, Math.floor(cursor)));
|
|
23
|
+
}
|
|
24
|
+
function isWhitespace(char) {
|
|
25
|
+
return char === " " || char === "\n" || char === " " || char === "\r";
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Detect an active trigger (@path, $skill, /command) at the cursor position.
|
|
29
|
+
*
|
|
30
|
+
* Accepts an optional `isWhitespaceChar` override so callers with inline
|
|
31
|
+
* placeholder characters (e.g. terminal context chips on web) can treat
|
|
32
|
+
* those as token boundaries.
|
|
33
|
+
*/
|
|
34
|
+
function detectComposerTrigger(text, cursorInput, isWhitespaceChar) {
|
|
35
|
+
const cursor = clampCursor(text, cursorInput);
|
|
36
|
+
const lineStart = text.lastIndexOf("\n", Math.max(0, cursor - 1)) + 1;
|
|
37
|
+
const linePrefix = text.slice(lineStart, cursor);
|
|
38
|
+
if (linePrefix.startsWith("/")) {
|
|
39
|
+
const commandMatch = /^\/(\S*)$/.exec(linePrefix);
|
|
40
|
+
if (commandMatch) {
|
|
41
|
+
const commandQuery = commandMatch[1] ?? "";
|
|
42
|
+
if (commandQuery.toLowerCase() === "model") return {
|
|
43
|
+
kind: "slash-model",
|
|
44
|
+
query: "",
|
|
45
|
+
rangeStart: lineStart,
|
|
46
|
+
rangeEnd: cursor
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
kind: "slash-command",
|
|
50
|
+
query: commandQuery,
|
|
51
|
+
rangeStart: lineStart,
|
|
52
|
+
rangeEnd: cursor
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const modelMatch = /^\/model(?:\s+(.*))?$/.exec(linePrefix);
|
|
56
|
+
if (modelMatch) return {
|
|
57
|
+
kind: "slash-model",
|
|
58
|
+
query: (modelMatch[1] ?? "").trim(),
|
|
59
|
+
rangeStart: lineStart,
|
|
60
|
+
rangeEnd: cursor
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const wsCheck = isWhitespaceChar ?? isWhitespace;
|
|
64
|
+
let tokenIdx = cursor - 1;
|
|
65
|
+
while (tokenIdx >= 0 && !wsCheck(text[tokenIdx] ?? "")) tokenIdx -= 1;
|
|
66
|
+
const tokenStart = tokenIdx + 1;
|
|
67
|
+
const token = text.slice(tokenStart, cursor);
|
|
68
|
+
if (token.startsWith("$")) return {
|
|
69
|
+
kind: "skill",
|
|
70
|
+
query: token.slice(1),
|
|
71
|
+
rangeStart: tokenStart,
|
|
72
|
+
rangeEnd: cursor
|
|
73
|
+
};
|
|
74
|
+
if (!token.startsWith("@")) return null;
|
|
75
|
+
return {
|
|
76
|
+
kind: "path",
|
|
77
|
+
query: token.slice(1),
|
|
78
|
+
rangeStart: tokenStart,
|
|
79
|
+
rangeEnd: cursor
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function parseStandaloneComposerSlashCommand(text) {
|
|
83
|
+
const match = /^\/(plan|default)\s*$/i.exec(text.trim());
|
|
84
|
+
if (!match) return null;
|
|
85
|
+
if (match[1]?.toLowerCase() === "plan") return "plan";
|
|
86
|
+
return "default";
|
|
87
|
+
}
|
|
88
|
+
function replaceTextRange(text, rangeStart, rangeEnd, replacement) {
|
|
89
|
+
const safeStart = Math.max(0, Math.min(text.length, rangeStart));
|
|
90
|
+
const safeEnd = Math.max(safeStart, Math.min(text.length, rangeEnd));
|
|
91
|
+
return {
|
|
92
|
+
text: `${text.slice(0, safeStart)}${replacement}${text.slice(safeEnd)}`,
|
|
93
|
+
cursor: safeStart + replacement.length
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { detectComposerTrigger, parseStandaloneComposerSlashCommand, replaceTextRange, serializeComposerFileLink, serializeComposerMentionPath };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/connectAuth.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The CLI prints URLs against this origin and the web bundle uses it to
|
|
4
|
+
* decide whether it is the hosted deployment — the two must agree, so the
|
|
5
|
+
* default lives here.
|
|
6
|
+
*/
|
|
7
|
+
declare const DEFAULT_HOSTED_APP_URL = "https://app.t3.codes";
|
|
8
|
+
/**
|
|
9
|
+
* Requested at authorize time by the hosted page and honored by the CLI's
|
|
10
|
+
* token exchange; keep both sides on this single definition.
|
|
11
|
+
*/
|
|
12
|
+
declare const CONNECT_OAUTH_SCOPES: readonly ["openid", "profile", "email"];
|
|
13
|
+
interface ConnectAuthorizeRequest {
|
|
14
|
+
readonly state: string;
|
|
15
|
+
readonly challenge: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The URL a headless CLI prints for the user to open on a machine with a
|
|
19
|
+
* browser. `state` and `code_challenge` ride the fragment so they never reach
|
|
20
|
+
* the hosted app's server or CDN logs; neither is a secret.
|
|
21
|
+
*/
|
|
22
|
+
declare function buildConnectAuthorizeRequestUrl(input: {
|
|
23
|
+
readonly hostedAppUrl: string;
|
|
24
|
+
readonly state: string;
|
|
25
|
+
readonly challenge: string;
|
|
26
|
+
}): string;
|
|
27
|
+
declare function readConnectAuthorizeRequest(url: URL): ConnectAuthorizeRequest | null;
|
|
28
|
+
declare function connectCallbackUrl(hostedAppUrl: string): string;
|
|
29
|
+
declare function buildConnectClerkAuthorizeUrl(input: {
|
|
30
|
+
readonly authorizationEndpoint: string;
|
|
31
|
+
readonly clientId: string;
|
|
32
|
+
readonly redirectUri: string;
|
|
33
|
+
readonly scopes: ReadonlyArray<string>;
|
|
34
|
+
readonly state: string;
|
|
35
|
+
readonly challenge: string;
|
|
36
|
+
}): string;
|
|
37
|
+
interface ConnectAuthCode {
|
|
38
|
+
readonly code: string;
|
|
39
|
+
readonly state: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The single blob the hosted callback page displays and the CLI accepts.
|
|
43
|
+
* Bundling `state` with the authorization code lets the CLI keep the loopback
|
|
44
|
+
* flow's CSRF check without any backend: it verifies the returned state
|
|
45
|
+
* matches the one it generated. Clerk authorization codes and the CLI's
|
|
46
|
+
* base64url states never contain ".".
|
|
47
|
+
*/
|
|
48
|
+
declare function encodeConnectAuthCode(input: ConnectAuthCode): string;
|
|
49
|
+
/**
|
|
50
|
+
* Validates an out-of-band authorization code against the state of the request this process
|
|
51
|
+
* generated. Returns the parsed code or a user-facing error message; both
|
|
52
|
+
* the prompt's live validation and the authoritative post-prompt check go
|
|
53
|
+
* through here so they cannot drift.
|
|
54
|
+
*/
|
|
55
|
+
declare function checkConnectAuthCode(blob: string, expectedState: string): ConnectAuthCode | string;
|
|
56
|
+
declare function parseConnectAuthCode(blob: string): ConnectAuthCode | null;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { CONNECT_OAUTH_SCOPES, ConnectAuthCode, ConnectAuthorizeRequest, DEFAULT_HOSTED_APP_URL, buildConnectAuthorizeRequestUrl, buildConnectClerkAuthorizeUrl, checkConnectAuthCode, connectCallbackUrl, encodeConnectAuthCode, parseConnectAuthCode, readConnectAuthorizeRequest };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Sa as readHashParams } from "../shared.js";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/connectAuth.ts
|
|
3
|
+
const CONNECT_AUTH_STATE_PARAM = "state";
|
|
4
|
+
const CONNECT_AUTH_CHALLENGE_PARAM = "challenge";
|
|
5
|
+
const CONNECT_AUTH_CODE_SEPARATOR = ".";
|
|
6
|
+
const CONNECT_AUTHORIZE_PATH = "/connect";
|
|
7
|
+
const CONNECT_CALLBACK_PATH = "/connect/callback";
|
|
8
|
+
/**
|
|
9
|
+
* The CLI prints URLs against this origin and the web bundle uses it to
|
|
10
|
+
* decide whether it is the hosted deployment — the two must agree, so the
|
|
11
|
+
* default lives here.
|
|
12
|
+
*/
|
|
13
|
+
const DEFAULT_HOSTED_APP_URL = "https://app.t3.codes";
|
|
14
|
+
/**
|
|
15
|
+
* Requested at authorize time by the hosted page and honored by the CLI's
|
|
16
|
+
* token exchange; keep both sides on this single definition.
|
|
17
|
+
*/
|
|
18
|
+
const CONNECT_OAUTH_SCOPES = [
|
|
19
|
+
"openid",
|
|
20
|
+
"profile",
|
|
21
|
+
"email"
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* The URL a headless CLI prints for the user to open on a machine with a
|
|
25
|
+
* browser. `state` and `code_challenge` ride the fragment so they never reach
|
|
26
|
+
* the hosted app's server or CDN logs; neither is a secret.
|
|
27
|
+
*/
|
|
28
|
+
function buildConnectAuthorizeRequestUrl(input) {
|
|
29
|
+
const url = new URL(CONNECT_AUTHORIZE_PATH, input.hostedAppUrl);
|
|
30
|
+
url.hash = new URLSearchParams([[CONNECT_AUTH_STATE_PARAM, input.state], [CONNECT_AUTH_CHALLENGE_PARAM, input.challenge]]).toString();
|
|
31
|
+
return url.toString();
|
|
32
|
+
}
|
|
33
|
+
function readConnectAuthorizeRequest(url) {
|
|
34
|
+
const params = readHashParams(url);
|
|
35
|
+
const state = params.get(CONNECT_AUTH_STATE_PARAM)?.trim() ?? "";
|
|
36
|
+
const challenge = params.get(CONNECT_AUTH_CHALLENGE_PARAM)?.trim() ?? "";
|
|
37
|
+
if (!state || !challenge) return null;
|
|
38
|
+
return {
|
|
39
|
+
state,
|
|
40
|
+
challenge
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function connectCallbackUrl(hostedAppUrl) {
|
|
44
|
+
return new URL(CONNECT_CALLBACK_PATH, hostedAppUrl).toString();
|
|
45
|
+
}
|
|
46
|
+
function buildConnectClerkAuthorizeUrl(input) {
|
|
47
|
+
const url = new URL(input.authorizationEndpoint);
|
|
48
|
+
url.searchParams.set("client_id", input.clientId);
|
|
49
|
+
url.searchParams.set("redirect_uri", input.redirectUri);
|
|
50
|
+
url.searchParams.set("response_type", "code");
|
|
51
|
+
url.searchParams.set("scope", input.scopes.join(" "));
|
|
52
|
+
url.searchParams.set("state", input.state);
|
|
53
|
+
url.searchParams.set("code_challenge", input.challenge);
|
|
54
|
+
url.searchParams.set("code_challenge_method", "S256");
|
|
55
|
+
return url.toString();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The single blob the hosted callback page displays and the CLI accepts.
|
|
59
|
+
* Bundling `state` with the authorization code lets the CLI keep the loopback
|
|
60
|
+
* flow's CSRF check without any backend: it verifies the returned state
|
|
61
|
+
* matches the one it generated. Clerk authorization codes and the CLI's
|
|
62
|
+
* base64url states never contain ".".
|
|
63
|
+
*/
|
|
64
|
+
function encodeConnectAuthCode(input) {
|
|
65
|
+
return `${input.code}${CONNECT_AUTH_CODE_SEPARATOR}${input.state}`;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Validates an out-of-band authorization code against the state of the request this process
|
|
69
|
+
* generated. Returns the parsed code or a user-facing error message; both
|
|
70
|
+
* the prompt's live validation and the authoritative post-prompt check go
|
|
71
|
+
* through here so they cannot drift.
|
|
72
|
+
*/
|
|
73
|
+
function checkConnectAuthCode(blob, expectedState) {
|
|
74
|
+
const parsed = parseConnectAuthCode(blob);
|
|
75
|
+
if (parsed === null) return "That does not look like a T3 Connect code. Copy the full code.";
|
|
76
|
+
if (parsed.state !== expectedState) return "That code belongs to a different connect request. Open the URL above and try again.";
|
|
77
|
+
return parsed;
|
|
78
|
+
}
|
|
79
|
+
function parseConnectAuthCode(blob) {
|
|
80
|
+
const trimmed = blob.trim();
|
|
81
|
+
const separatorIndex = trimmed.lastIndexOf(CONNECT_AUTH_CODE_SEPARATOR);
|
|
82
|
+
if (separatorIndex <= 0 || separatorIndex === trimmed.length - 1) return null;
|
|
83
|
+
return {
|
|
84
|
+
code: trimmed.slice(0, separatorIndex),
|
|
85
|
+
state: trimmed.slice(separatorIndex + 1)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { CONNECT_OAUTH_SCOPES, DEFAULT_HOSTED_APP_URL, buildConnectAuthorizeRequestUrl, buildConnectClerkAuthorizeUrl, checkConnectAuthCode, connectCallbackUrl, encodeConnectAuthCode, parseConnectAuthCode, readConnectAuthorizeRequest };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Path from "effect/Path";
|
|
3
|
+
import * as FileSystem from "effect/FileSystem";
|
|
4
|
+
//#region upstream-t3code/packages/shared/src/devHome.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The path of the linked git worktree containing `cwd`, or undefined when
|
|
7
|
+
* `cwd` is not inside one. Git marks a linked worktree by making `.git` a file
|
|
8
|
+
* whose `gitdir:` points into the repository's `.git/worktrees`.
|
|
9
|
+
*
|
|
10
|
+
* Walks up to the repository root, so running from a subdirectory resolves the
|
|
11
|
+
* same worktree as running from the top.
|
|
12
|
+
*/
|
|
13
|
+
declare const resolveGitWorktreePath: (cwd: string) => Effect.Effect<string | undefined, never, FileSystem.FileSystem | Path.Path>;
|
|
14
|
+
/**
|
|
15
|
+
* The worktree-local data directory for `cwd`, or undefined outside a linked
|
|
16
|
+
* worktree. Deliberately does not require the directory to exist yet: falling
|
|
17
|
+
* back because it is missing would send callers at the shared home.
|
|
18
|
+
*/
|
|
19
|
+
declare const resolveWorktreeT3Home: (cwd: string) => Effect.Effect<string | undefined, never, FileSystem.FileSystem | Path.Path>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { resolveGitWorktreePath, resolveWorktreeT3Home };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Bk as isSome, OE as FileSystem, TE as Path, _O as orElseSucceed, aO as gen, hO as option } from "../shared.js";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/devHome.ts
|
|
3
|
+
/**
|
|
4
|
+
* Where development state lives, and how to keep it away from the shared
|
|
5
|
+
* `~/.t3` that a user's installed T3 Code runs against.
|
|
6
|
+
*
|
|
7
|
+
* A linked git worktree gets its own (gitignored) `.t3`: feature work in a
|
|
8
|
+
* throwaway branch must not share a database with the real app, and an ambient
|
|
9
|
+
* `T3CODE_HOME` counts as an explicit base dir — flipping the state directory
|
|
10
|
+
* from `<base>/dev` to `<base>/userdata`, the live production database.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* A `.git` file points at the real git directory. A linked worktree's lives at
|
|
14
|
+
* `<common-dir>/worktrees/<name>`; a submodule's at
|
|
15
|
+
* `<super-git-dir>/modules/<name>`. Both are files, so the pointer — not the
|
|
16
|
+
* file-vs-directory distinction alone — is what identifies a worktree.
|
|
17
|
+
*
|
|
18
|
+
* The common dir is not necessarily named `.git`: a worktree of a bare repo
|
|
19
|
+
* points at `<repo>.git/worktrees/<name>`, and `$GIT_COMMON_DIR` can be
|
|
20
|
+
* anything. So match on the `worktrees/<name>` tail, which git always uses,
|
|
21
|
+
* rather than on the name of the directory containing it.
|
|
22
|
+
*/
|
|
23
|
+
const pointsAtLinkedWorktree = (gitFileContents, path) => {
|
|
24
|
+
const gitdir = gitFileContents.split(/\r?\n/).map((line) => line.trim()).find((line) => line.startsWith("gitdir:"))?.slice(7).trim();
|
|
25
|
+
if (gitdir === void 0 || gitdir.length === 0) return false;
|
|
26
|
+
const segments = path.normalize(gitdir.replaceAll("\\", "/")).split(/[/\\]/).filter((segment) => segment.length > 0);
|
|
27
|
+
return segments.length >= 3 && segments.at(-2) === "worktrees";
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The path of the linked git worktree containing `cwd`, or undefined when
|
|
31
|
+
* `cwd` is not inside one. Git marks a linked worktree by making `.git` a file
|
|
32
|
+
* whose `gitdir:` points into the repository's `.git/worktrees`.
|
|
33
|
+
*
|
|
34
|
+
* Walks up to the repository root, so running from a subdirectory resolves the
|
|
35
|
+
* same worktree as running from the top.
|
|
36
|
+
*/
|
|
37
|
+
const resolveGitWorktreePath = (cwd) => gen(function* () {
|
|
38
|
+
const fileSystem = yield* FileSystem;
|
|
39
|
+
const path = yield* Path;
|
|
40
|
+
let directory = path.resolve(cwd);
|
|
41
|
+
for (;;) {
|
|
42
|
+
const gitPath = path.join(directory, ".git");
|
|
43
|
+
const info = yield* fileSystem.stat(gitPath).pipe(option);
|
|
44
|
+
if (isSome(info)) {
|
|
45
|
+
if (info.value.type !== "File") return;
|
|
46
|
+
const contents = yield* fileSystem.readFileString(gitPath).pipe(orElseSucceed(() => ""));
|
|
47
|
+
return pointsAtLinkedWorktree(contents, path) ? directory : void 0;
|
|
48
|
+
}
|
|
49
|
+
const parent = path.dirname(directory);
|
|
50
|
+
if (parent === directory) return;
|
|
51
|
+
directory = parent;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* The worktree-local data directory for `cwd`, or undefined outside a linked
|
|
56
|
+
* worktree. Deliberately does not require the directory to exist yet: falling
|
|
57
|
+
* back because it is missing would send callers at the shared home.
|
|
58
|
+
*/
|
|
59
|
+
const resolveWorktreeT3Home = (cwd) => gen(function* () {
|
|
60
|
+
const worktreePath = yield* resolveGitWorktreePath(cwd);
|
|
61
|
+
if (worktreePath === void 0) return;
|
|
62
|
+
return (yield* Path).join(worktreePath, ".t3");
|
|
63
|
+
});
|
|
64
|
+
//#endregion
|
|
65
|
+
export { resolveGitWorktreePath, resolveWorktreeT3Home };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/devProxy.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Backend paths the web dev server proxies in single-origin browser dev.
|
|
4
|
+
*
|
|
5
|
+
* Two consumers must agree on this list: the Vite proxy map
|
|
6
|
+
* (apps/web/vite.config.ts) that forwards these to the backend, and the
|
|
7
|
+
* server's dev catch-all (apps/server/src/http.ts) that 404s them instead of
|
|
8
|
+
* redirecting back to Vite. Drift is silent and nasty in both directions — a
|
|
9
|
+
* prefix only Vite knows gets answered with index.html; a prefix only the
|
|
10
|
+
* server knows redirect-loops through the proxy.
|
|
11
|
+
*/
|
|
12
|
+
declare const DEV_PROXIED_PATH_PREFIXES: readonly ["/api", "/oauth", "/.well-known", "/ws"];
|
|
13
|
+
declare function isDevProxiedPath(pathname: string): boolean;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { DEV_PROXIED_PATH_PREFIXES, isDevProxiedPath };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/devProxy.ts
|
|
2
|
+
/**
|
|
3
|
+
* Backend paths the web dev server proxies in single-origin browser dev.
|
|
4
|
+
*
|
|
5
|
+
* Two consumers must agree on this list: the Vite proxy map
|
|
6
|
+
* (apps/web/vite.config.ts) that forwards these to the backend, and the
|
|
7
|
+
* server's dev catch-all (apps/server/src/http.ts) that 404s them instead of
|
|
8
|
+
* redirecting back to Vite. Drift is silent and nasty in both directions — a
|
|
9
|
+
* prefix only Vite knows gets answered with index.html; a prefix only the
|
|
10
|
+
* server knows redirect-loops through the proxy.
|
|
11
|
+
*/
|
|
12
|
+
const DEV_PROXIED_PATH_PREFIXES = [
|
|
13
|
+
"/api",
|
|
14
|
+
"/oauth",
|
|
15
|
+
"/.well-known",
|
|
16
|
+
"/ws"
|
|
17
|
+
];
|
|
18
|
+
function isDevProxiedPath(pathname) {
|
|
19
|
+
return DEV_PROXIED_PATH_PREFIXES.some((prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`));
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { DEV_PROXIED_PATH_PREFIXES, isDevProxiedPath };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { n as normalizeDpopHtu, t as DpopPublicJwk$1 } from "../shared.js";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
//#region upstream-t3code/packages/shared/src/dpop.d.ts
|
|
4
|
+
declare const DpopPublicJwk: Schema.Struct<{
|
|
5
|
+
readonly kty: Schema.Literal<"EC">;
|
|
6
|
+
readonly crv: Schema.Literal<"P-256">;
|
|
7
|
+
readonly x: Schema.String;
|
|
8
|
+
readonly y: Schema.String;
|
|
9
|
+
}>;
|
|
10
|
+
type DpopPublicJwk = DpopPublicJwk$1;
|
|
11
|
+
type DpopVerificationResult = {
|
|
12
|
+
readonly ok: true;
|
|
13
|
+
readonly thumbprint: string;
|
|
14
|
+
readonly jti: string;
|
|
15
|
+
readonly iat: number;
|
|
16
|
+
} | {
|
|
17
|
+
readonly ok: false;
|
|
18
|
+
readonly reason: string;
|
|
19
|
+
};
|
|
20
|
+
declare function computeDpopJwkThumbprint(jwk: DpopPublicJwk$1): string;
|
|
21
|
+
declare function computeDpopAccessTokenHash(accessToken: string): string;
|
|
22
|
+
declare function verifyDpopProof(input: {
|
|
23
|
+
readonly proof: string | null | undefined;
|
|
24
|
+
readonly method: string;
|
|
25
|
+
readonly url: string;
|
|
26
|
+
readonly nowEpochSeconds: number;
|
|
27
|
+
readonly expectedThumbprint?: string;
|
|
28
|
+
readonly expectedAccessToken?: string;
|
|
29
|
+
readonly maxAgeSeconds?: number;
|
|
30
|
+
}): DpopVerificationResult;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { DpopPublicJwk, DpopVerificationResult, computeDpopAccessTokenHash, computeDpopJwkThumbprint, normalizeDpopHtu, verifyDpopProof };
|