@myrialabs/clopen 0.4.41 → 0.4.43
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/backend/chat/stream-manager.ts +8 -0
- package/backend/database/crypto/secret-columns.ts +5 -1
- package/backend/database/index.ts +18 -0
- package/backend/database/migrations/082_create_git_identities.test.ts +186 -0
- package/backend/database/migrations/082_create_git_identities.ts +122 -0
- package/backend/database/migrations/index.ts +7 -0
- package/backend/database/queries/git-identity-queries.ts +290 -0
- package/backend/database/queries/index.ts +2 -0
- package/backend/db-client/env/detect.ts +2 -1
- package/backend/engine/adapters/claude/environment.ts +11 -1
- package/backend/engine/adapters/claude/models.ts +147 -18
- package/backend/engine/adapters/claude/stream.ts +1 -1
- package/backend/engine/adapters/codex/models.ts +13 -9
- package/backend/engine/adapters/codex/stream.ts +35 -3
- package/backend/engine/adapters/opencode/server.ts +26 -2
- package/backend/engine/adapters/opencode/stream.ts +4 -1
- package/backend/engine/adapters/qwen/stream.ts +3 -1
- package/backend/engine/types.ts +10 -0
- package/backend/env-files/discovery.ts +2 -1
- package/backend/files/file-reading.ts +4 -3
- package/backend/files/path-browsing.ts +2 -1
- package/backend/git/git-executor.ts +28 -2
- package/backend/git/git-service.ts +61 -41
- package/backend/git/identity/cli.test.ts +58 -0
- package/backend/git/identity/cli.ts +201 -0
- package/backend/git/identity/credential-helper.test.ts +242 -0
- package/backend/git/identity/env.test.ts +214 -0
- package/backend/git/identity/env.ts +193 -0
- package/backend/git/identity/import-local.test.ts +199 -0
- package/backend/git/identity/import-local.ts +141 -0
- package/backend/git/identity/index.ts +78 -0
- package/backend/git/identity/keys.ts +183 -0
- package/backend/git/identity/resolve.ts +140 -0
- package/backend/git/identity/scope-config.test.ts +145 -0
- package/backend/git/identity/scope-config.ts +175 -0
- package/backend/git/identity/service.ts +297 -0
- package/backend/index.ts +16 -0
- package/backend/preview/browser/browser-console-manager.ts +214 -34
- package/backend/preview/browser/browser-pool.ts +526 -123
- package/backend/preview/browser/browser-preview-service.ts +192 -8
- package/backend/preview/browser/browser-tab-lifecycle.test.ts +240 -0
- package/backend/preview/browser/browser-tab-lifecycle.ts +495 -0
- package/backend/preview/browser/browser-tab-manager.ts +291 -65
- package/backend/preview/browser/capture-profile.ts +15 -1
- package/backend/preview/browser/types.ts +26 -1
- package/backend/snapshot/turn-changes.ts +3 -2
- package/backend/ssh/sftp.ts +2 -1
- package/backend/terminal/ptykit.ts +24 -0
- package/backend/worktrees/merge.ts +2 -1
- package/backend/ws/git/branch.ts +17 -6
- package/backend/ws/git/commit.ts +6 -5
- package/backend/ws/git/conflict.ts +3 -2
- package/backend/ws/git/identity-context.ts +91 -0
- package/backend/ws/git/identity.ts +200 -0
- package/backend/ws/git/index.ts +3 -1
- package/backend/ws/git/remote.ts +57 -11
- package/backend/ws/preview/browser/data.ts +60 -0
- package/backend/ws/preview/browser/interact.ts +6 -0
- package/backend/ws/preview/browser/tab-info.ts +9 -1
- package/backend/ws/preview/browser/tab.ts +64 -8
- package/backend/ws/preview/index.ts +21 -0
- package/bin/clopen.ts +9 -0
- package/dist/assets/{index-CeNKKSDR.js → index-B6u8cait.js} +1 -1
- package/dist/assets/{index-DW89566K.js → index-BeUKiRiY.js} +1 -1
- package/dist/assets/{main-Cy5DXWPT.js → main-CMRXlv2f.js} +604 -596
- package/dist/assets/main-DzCY0n-j.css +1 -0
- package/dist/index.html +2 -2
- package/package.json +2 -2
- package/shared/types/git-identity.ts +112 -0
- package/shared/utils/compare.test.ts +46 -0
- package/shared/utils/compare.ts +21 -0
- package/dist/assets/main-DJKj_4By.css +0 -1
package/dist/index.html
CHANGED
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
}
|
|
64
64
|
})();
|
|
65
65
|
</script>
|
|
66
|
-
<script type="module" crossorigin src="/assets/main-
|
|
67
|
-
<link rel="stylesheet" crossorigin href="/assets/main-
|
|
66
|
+
<script type="module" crossorigin src="/assets/main-CMRXlv2f.js"></script>
|
|
67
|
+
<link rel="stylesheet" crossorigin href="/assets/main-DzCY0n-j.css">
|
|
68
68
|
</head>
|
|
69
69
|
<body
|
|
70
70
|
class="min-h-dvh bg-white text-slate-900 dark:bg-slate-950 dark:text-slate-100 transition-colors duration-200"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myrialabs/clopen",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.43",
|
|
4
4
|
"description": "All-in-one web workspace for AI coding agents — Claude Code, OpenCode, Codex, Copilot, Qwen Code, Pi, Cline, and Cursor — with chat, terminal, git, browser preview, database client, checkpoints, and real-time collaboration",
|
|
5
5
|
"author": "Myria Labs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"@iconify-json/material-icon-theme": "1.2.55",
|
|
120
120
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
121
121
|
"@monaco-editor/loader": "1.7.0",
|
|
122
|
-
"@myrialabs/ptykit": "0.0.
|
|
122
|
+
"@myrialabs/ptykit": "0.0.7",
|
|
123
123
|
"@myrialabs/tunnelkit": "0.0.15",
|
|
124
124
|
"@myrialabs/zipkit": "0.0.11",
|
|
125
125
|
"@sinclair/typebox": "0.34.48",
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git identities — shared vocabulary between the server and the UI.
|
|
3
|
+
*
|
|
4
|
+
* An identity answers two questions a git command asks: who authored this, and
|
|
5
|
+
* what proves I may push it. The first half (`name`, `email`) is attribution;
|
|
6
|
+
* the second (`authMethod` and whichever credential it names) is access. They
|
|
7
|
+
* live together because a user thinks of them as one account — "my work
|
|
8
|
+
* GitHub" — even though git keeps them in completely different places.
|
|
9
|
+
*
|
|
10
|
+
* NOTHING SECRET CROSSES THIS LINE. The private key, its passphrase, and the
|
|
11
|
+
* HTTPS token are sealed on the row and never serialised to a client; the DTO
|
|
12
|
+
* carries only whether each is set. The public key is the exception, and is
|
|
13
|
+
* public by definition — the UI needs it so the user can paste it into GitHub.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** How an identity proves itself to a remote. */
|
|
17
|
+
export type GitIdentityAuthMethod =
|
|
18
|
+
/** Attribution only — pushing falls back to whatever the machine provides. */
|
|
19
|
+
| 'none'
|
|
20
|
+
/** An SSH private key, stored here and written to disk for `ssh -i`. */
|
|
21
|
+
| 'ssh-key'
|
|
22
|
+
/** A token typed into Clopen, served over the git credential protocol. */
|
|
23
|
+
| 'https-token'
|
|
24
|
+
/** A token borrowed from an already-connected integration account. */
|
|
25
|
+
| 'https-account';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Where an identity came from.
|
|
29
|
+
*
|
|
30
|
+
* `local-machine` is the one mirrored from `git config --global`. It is editable
|
|
31
|
+
* but not deletable — the machine's config is what it reflects, so removing the
|
|
32
|
+
* row would only make it come back.
|
|
33
|
+
*/
|
|
34
|
+
export type GitIdentitySource = 'manual' | 'local-machine';
|
|
35
|
+
|
|
36
|
+
/** An identity as the client sees it — credentials reduced to presence flags. */
|
|
37
|
+
export interface GitIdentityDTO {
|
|
38
|
+
id: string;
|
|
39
|
+
/** What the user calls this account: "Work", "Personal". */
|
|
40
|
+
label: string;
|
|
41
|
+
/** `user.name`. */
|
|
42
|
+
name: string;
|
|
43
|
+
/** `user.email`. */
|
|
44
|
+
email: string;
|
|
45
|
+
authMethod: GitIdentityAuthMethod;
|
|
46
|
+
/**
|
|
47
|
+
* Hostnames this identity's credential is valid for, lowercased
|
|
48
|
+
* (`["github.com"]`). Empty means the identity makes no host claim: it can
|
|
49
|
+
* still author commits, but is never chosen to authenticate a remote.
|
|
50
|
+
*/
|
|
51
|
+
hosts: string[];
|
|
52
|
+
/** Public half of the SSH key, for copying into the host's settings. */
|
|
53
|
+
sshPublicKey: string | null;
|
|
54
|
+
/** True when a private key is stored. The key itself never leaves the server. */
|
|
55
|
+
hasSshKey: boolean;
|
|
56
|
+
/** True when that key needs a passphrase to use. */
|
|
57
|
+
hasSshPassphrase: boolean;
|
|
58
|
+
/** True when an HTTPS token is stored. */
|
|
59
|
+
hasHttpsToken: boolean;
|
|
60
|
+
/** Username sent alongside the HTTPS token. */
|
|
61
|
+
httpsUsername: string | null;
|
|
62
|
+
/** The borrowed integration account, when `authMethod` is `https-account`. */
|
|
63
|
+
integrationAccountId: string | null;
|
|
64
|
+
/** Used when a project names no identity of its own. */
|
|
65
|
+
isDefault: boolean;
|
|
66
|
+
source: GitIdentitySource;
|
|
67
|
+
/** False for the mirrored machine identity — see {@link GitIdentitySource}. */
|
|
68
|
+
canDelete: boolean;
|
|
69
|
+
createdAt: string;
|
|
70
|
+
updatedAt: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Fields a create/update accepts. Secrets are write-only and omitted to keep. */
|
|
74
|
+
export interface GitIdentityInput {
|
|
75
|
+
label: string;
|
|
76
|
+
name: string;
|
|
77
|
+
email: string;
|
|
78
|
+
authMethod: GitIdentityAuthMethod;
|
|
79
|
+
hosts: string[];
|
|
80
|
+
/** PEM private key. `null` clears it; omitted leaves the stored one alone. */
|
|
81
|
+
sshPrivateKey?: string | null;
|
|
82
|
+
sshPublicKey?: string | null;
|
|
83
|
+
sshPassphrase?: string | null;
|
|
84
|
+
httpsUsername?: string | null;
|
|
85
|
+
httpsToken?: string | null;
|
|
86
|
+
integrationAccountId?: string | null;
|
|
87
|
+
isDefault?: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Which identity a git command actually ran as, and why.
|
|
92
|
+
*
|
|
93
|
+
* `source` is what the UI shows so a user can tell an inherited identity from a
|
|
94
|
+
* chosen one before they commit, rather than after they push.
|
|
95
|
+
*/
|
|
96
|
+
export interface ResolvedGitIdentity {
|
|
97
|
+
identity: GitIdentityDTO | null;
|
|
98
|
+
source: 'project' | 'user-default' | 'none';
|
|
99
|
+
/**
|
|
100
|
+
* The identity supplying credentials for a given remote host, when the
|
|
101
|
+
* project's own identity does not claim that host. Null when the project
|
|
102
|
+
* identity covers it, or when nothing does.
|
|
103
|
+
*/
|
|
104
|
+
credentialIdentity: GitIdentityDTO | null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** An SSH keypair generated on the server. The private half is stored, not returned. */
|
|
108
|
+
export interface GeneratedSshKey {
|
|
109
|
+
publicKey: string;
|
|
110
|
+
/** Fingerprint for display, so the user can match it against the host. */
|
|
111
|
+
fingerprint: string;
|
|
112
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import { naturalCompare } from './compare';
|
|
3
|
+
|
|
4
|
+
const sort = (names: string[]) => [...names].sort(naturalCompare);
|
|
5
|
+
|
|
6
|
+
describe('naturalCompare', () => {
|
|
7
|
+
test('orders digit runs by value, not lexicographically', () => {
|
|
8
|
+
expect(sort(['issue-109.ts', 'issue-36.ts'])).toEqual(['issue-36.ts', 'issue-109.ts']);
|
|
9
|
+
expect(sort(['file10.ts', 'file2.ts'])).toEqual(['file2.ts', 'file10.ts']);
|
|
10
|
+
expect(sort(['a10b', 'a9b'])).toEqual(['a9b', 'a10b']);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('still sorts plain names alphabetically', () => {
|
|
14
|
+
expect(sort(['src', 'assets', 'docs'])).toEqual(['assets', 'docs', 'src']);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('groups case and diacritic variants, then orders them deterministically', () => {
|
|
18
|
+
expect(naturalCompare('README.md', 'readme.md')).toBeLessThan(0);
|
|
19
|
+
expect(naturalCompare('cafe.md', 'café.md')).toBeLessThan(0);
|
|
20
|
+
expect(naturalCompare('apple.md', 'äpple.md')).toBeLessThan(0);
|
|
21
|
+
expect(naturalCompare('a', 'a')).toBe(0);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('gives the same order regardless of input order (no readdir fallback)', () => {
|
|
25
|
+
expect(sort(['readme.md', 'README.md'])).toEqual(sort(['README.md', 'readme.md']));
|
|
26
|
+
expect(sort(['café.md', 'cafe.md', 'Cafe.md'])).toEqual(sort(['Cafe.md', 'café.md', 'cafe.md']));
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('is independent of the ambient locale', () => {
|
|
30
|
+
// `cs` sorts "ch" after "h" and `sv` sorts "ä" last — a browser in
|
|
31
|
+
// either locale must not re-order what the backend already sorted.
|
|
32
|
+
expect(naturalCompare('changelog.md', 'horse.md')).toBeLessThan(0);
|
|
33
|
+
expect(naturalCompare('apple.md', 'äpple.md')).toBeLessThan(0);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('is antisymmetric and reflexive', () => {
|
|
37
|
+
const names = ['issue-10.ts', 'issue-2.ts', 'README.md', 'readme.md', 'cafe.md', 'äpple.md', 'a', 'A', ''];
|
|
38
|
+
for (const left of names) {
|
|
39
|
+
expect(naturalCompare(left, left)).toBe(0);
|
|
40
|
+
for (const right of names) {
|
|
41
|
+
// Equal and opposite signs — both zero only when the strings match.
|
|
42
|
+
expect(Math.sign(naturalCompare(left, right)) + Math.sign(naturalCompare(right, left))).toBe(0);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Natural-order comparator for human-facing file, path, and name lists.
|
|
3
|
+
*
|
|
4
|
+
* The collator is pinned to `en` so every runtime and platform agrees on one
|
|
5
|
+
* order: the Bun backend and the browser frontend both sort the same lists, and
|
|
6
|
+
* their ambient locales differ (a Czech or Swedish browser, a container with no
|
|
7
|
+
* LANG). `localeCompare(x, undefined, …)` follows the ambient locale instead,
|
|
8
|
+
* so it can re-order a list the other side already sorted.
|
|
9
|
+
*
|
|
10
|
+
* `sensitivity: 'base'` keeps case and diacritics out of the ordering, which
|
|
11
|
+
* makes names like `README.md` and `readme.md` compare equal — the code-unit
|
|
12
|
+
* tie-break then decides that pair deterministically, because leaving it to
|
|
13
|
+
* sort stability would fall back to readdir order, which differs per filesystem.
|
|
14
|
+
*/
|
|
15
|
+
const naturalCollator = new Intl.Collator('en', { numeric: true, sensitivity: 'base' });
|
|
16
|
+
|
|
17
|
+
export function naturalCompare(a: string, b: string): number {
|
|
18
|
+
const result = naturalCollator.compare(a, b);
|
|
19
|
+
if (result !== 0) return result;
|
|
20
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
21
|
+
}
|