@myrialabs/clopen 0.4.37 → 0.4.38
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 +2 -2
- package/backend/auth/permissions.ts +14 -0
- package/backend/bootstrap.ts +16 -0
- package/backend/database/crypto/envelope.test.ts +93 -0
- package/backend/database/crypto/envelope.ts +127 -0
- package/backend/database/crypto/index.ts +22 -0
- package/backend/database/crypto/master-key.ts +129 -0
- package/backend/database/crypto/secret-columns.ts +147 -0
- package/backend/database/migrations/071_create_notes_tables.ts +90 -0
- package/backend/database/migrations/072_encrypt_stored_secrets.ts +107 -0
- package/backend/database/migrations/073_create_integration_tables.ts +119 -0
- package/backend/database/migrations/074_create_work_tables.ts +94 -0
- package/backend/database/migrations/index.ts +28 -0
- package/backend/database/queries/db-client-connection-queries.ts +23 -12
- package/backend/database/queries/engine-queries.ts +23 -10
- package/backend/database/queries/index.ts +6 -1
- package/backend/database/queries/integration-queries.ts +297 -0
- package/backend/database/queries/mcp-server-queries.ts +38 -11
- package/backend/database/queries/note-queries.test.ts +190 -0
- package/backend/database/queries/note-queries.ts +269 -0
- package/backend/database/queries/profile-queries.ts +1 -1
- package/backend/database/queries/ssh-connection-queries.ts +19 -8
- package/backend/database/queries/work-queries.ts +210 -0
- package/backend/engine/docs/artifacts.md +22 -9
- package/backend/files/os-clipboard.test.ts +209 -0
- package/backend/files/os-clipboard.ts +567 -0
- package/backend/http/integration-hooks.ts +42 -0
- package/backend/http/notes-images.test.ts +228 -0
- package/backend/http/notes-images.ts +196 -0
- package/backend/index.ts +9 -0
- package/backend/integrations/accounts.ts +229 -0
- package/backend/integrations/health.ts +146 -0
- package/backend/integrations/index.ts +36 -0
- package/backend/integrations/projections/index.ts +120 -0
- package/backend/integrations/projections/mcp-projector.test.ts +204 -0
- package/backend/integrations/projections/mcp-projector.ts +159 -0
- package/backend/integrations/projections/types.ts +51 -0
- package/backend/integrations/registry/define.ts +38 -0
- package/backend/integrations/registry/index.ts +56 -0
- package/backend/integrations/registry/providers/context7.ts +44 -0
- package/backend/integrations/registry/providers/firecrawl.ts +41 -0
- package/backend/integrations/registry/providers/github.ts +78 -0
- package/backend/integrations/registry/types.ts +96 -0
- package/backend/integrations/webhooks/gateway.ts +160 -0
- package/backend/integrations/webhooks/verify.ts +65 -0
- package/backend/mcp/README.md +25 -3
- package/backend/mcp/external/config.ts +35 -1
- package/backend/mcp/index.ts +1 -1
- package/backend/mcp/internal/config.ts +1 -1
- package/backend/notes/access.test.ts +82 -0
- package/backend/notes/access.ts +27 -0
- package/backend/notes/storage.test.ts +77 -0
- package/backend/notes/storage.ts +114 -0
- package/backend/permissions/service.ts +2 -2
- package/backend/profiles/service.ts +1 -1
- package/backend/projects/project-cleanup.ts +6 -0
- package/backend/work/bindings.ts +124 -0
- package/backend/work/index.ts +42 -0
- package/backend/work/prompts.ts +150 -0
- package/backend/work/providers/github/actions-logs.ts +180 -0
- package/backend/work/providers/github/adapter.test.ts +88 -0
- package/backend/work/providers/github/adapter.ts +1255 -0
- package/backend/work/providers/github/client.ts +280 -0
- package/backend/work/providers/github/list-range.test.ts +158 -0
- package/backend/work/providers/github/token-kind.test.ts +42 -0
- package/backend/work/pull-requests.ts +242 -0
- package/backend/work/registry.ts +27 -0
- package/backend/work/service.ts +436 -0
- package/backend/work/start-work.test.ts +71 -0
- package/backend/work/start-work.ts +232 -0
- package/backend/work/types.ts +180 -0
- package/backend/ws/files/clipboard.ts +78 -0
- package/backend/ws/files/index.ts +5 -0
- package/backend/ws/git/diff-budget.ts +70 -11
- package/backend/ws/index.ts +11 -1
- package/backend/ws/integrations/crud.ts +219 -0
- package/backend/ws/integrations/index.ts +22 -0
- package/backend/ws/mcp/crud.ts +25 -1
- package/backend/ws/notes/index.ts +278 -0
- package/backend/ws/profiles/crud.ts +1 -1
- package/backend/ws/work/actions.ts +206 -0
- package/backend/ws/work/context.ts +51 -0
- package/backend/ws/work/crud.ts +347 -0
- package/backend/ws/work/index.ts +17 -0
- package/backend/ws/work/pull-requests.ts +177 -0
- package/backend/ws/work/schemas.ts +226 -0
- package/dist/assets/{index-sJmS_CCm.js → index-CyH7fSbR.js} +1 -1
- package/dist/assets/{index-Bik9TCBi.js → index-DSHIANSy.js} +1 -1
- package/dist/assets/main-D2IOjftb.css +1 -0
- package/dist/assets/main-DM-tHKbW.js +1152 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/shared/constants/engine-tools.ts +1 -1
- package/shared/constants/tool-icons.ts +33 -0
- package/shared/types/database/schema.ts +41 -0
- package/shared/types/integrations.ts +140 -0
- package/shared/types/stores/settings.ts +8 -0
- package/shared/types/work.ts +426 -0
- package/shared/utils/logger.ts +3 -0
- package/dist/assets/main-DLqolBI2.css +0 -1
- package/dist/assets/main-Df1I3hnw.js +0 -1096
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
buildGnomeCopiedFilesPayload,
|
|
5
|
+
buildMacClipboardReadScriptLines,
|
|
6
|
+
buildMacClipboardWriteScriptLines,
|
|
7
|
+
buildOsClipboardPsScript,
|
|
8
|
+
buildOsClipboardReadPsScript,
|
|
9
|
+
copyPathsToOsClipboard,
|
|
10
|
+
decodeOsClipboardPayload,
|
|
11
|
+
encodeOsClipboardPayload,
|
|
12
|
+
OS_CLIPBOARD_ENV_VAR,
|
|
13
|
+
parseFileDropLines,
|
|
14
|
+
parseGnomeCopiedFiles,
|
|
15
|
+
parseTextUriList,
|
|
16
|
+
pathToFileUri
|
|
17
|
+
} from './os-clipboard';
|
|
18
|
+
|
|
19
|
+
describe('os-clipboard payload encoding', () => {
|
|
20
|
+
test('round-trips paths with spaces, unicode, quotes and ampersands', () => {
|
|
21
|
+
const paths = [
|
|
22
|
+
'C:\\Users\\Test\\Report 2026\\Attendance Log.docx',
|
|
23
|
+
'C:\\Users\\Test\\Weekly Journal (1).docx',
|
|
24
|
+
'C:\\Users\\Test\\a&b\'c"d;e|.txt'
|
|
25
|
+
];
|
|
26
|
+
expect(decodeOsClipboardPayload(encodeOsClipboardPayload(paths))).toEqual(paths);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('round-trips folder paths', () => {
|
|
30
|
+
const paths = ['C:\\Users\\Test\\Report 2026'];
|
|
31
|
+
expect(decodeOsClipboardPayload(encodeOsClipboardPayload(paths))).toEqual(paths);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('os-clipboard PowerShell script', () => {
|
|
36
|
+
test('publishes a FileDropList with explicit COPY effect', () => {
|
|
37
|
+
const script = buildOsClipboardPsScript();
|
|
38
|
+
expect(script).toContain('System.Windows.Forms');
|
|
39
|
+
expect(script).toContain('SetFileDropList');
|
|
40
|
+
expect(script).toContain('Preferred DropEffect');
|
|
41
|
+
expect(script).toContain('SetDataObject');
|
|
42
|
+
// DROPEFFECT_COPY (1) — never MOVE, so COPY sources are never deleted.
|
|
43
|
+
expect(script).toContain('GetBytes(1)');
|
|
44
|
+
expect(script).not.toContain('GetBytes(2)');
|
|
45
|
+
expect(script).toContain(OS_CLIPBOARD_ENV_VAR);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('publishes DROPEFFECT_MOVE for cut so Explorer moves the sources', () => {
|
|
49
|
+
const script = buildOsClipboardPsScript('move');
|
|
50
|
+
expect(script).toContain('SetFileDropList');
|
|
51
|
+
expect(script).toContain('Preferred DropEffect');
|
|
52
|
+
// DROPEFFECT_MOVE (2) — only CUT publishes this; Explorer itself
|
|
53
|
+
// performs the move, Clopen never deletes the sources.
|
|
54
|
+
expect(script).toContain('GetBytes(2)');
|
|
55
|
+
expect(script).not.toContain('GetBytes(1)');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('never interpolates paths (injection-safe transport via env var)', () => {
|
|
59
|
+
const script = buildOsClipboardPsScript();
|
|
60
|
+
expect(script).not.toContain('Attendance');
|
|
61
|
+
expect(script).not.toContain('C:\\');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('copyPathsToOsClipboard validation', () => {
|
|
66
|
+
test('rejects an unknown effect', async () => {
|
|
67
|
+
await expect(
|
|
68
|
+
// @ts-expect-error runtime guard must reject invalid effects
|
|
69
|
+
copyPathsToOsClipboard(['C:\\tmp\\a.txt'], 'delete')
|
|
70
|
+
).rejects.toThrow(/Unknown clipboard effect/);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('rejects an empty path list', async () => {
|
|
74
|
+
await expect(copyPathsToOsClipboard([])).rejects.toThrow(
|
|
75
|
+
/At least one path|not supported on this platform/
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('rejects non-existent paths on Windows', async () => {
|
|
80
|
+
if (process.platform !== 'win32') return;
|
|
81
|
+
await expect(
|
|
82
|
+
copyPathsToOsClipboard(['C:\\definitely\\not\\here\\missing.docx'])
|
|
83
|
+
).rejects.toThrow(/does not exist/);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe('os-clipboard read helpers', () => {
|
|
88
|
+
test('parseFileDropLines splits CRLF/LF output and drops blanks', () => {
|
|
89
|
+
expect(
|
|
90
|
+
parseFileDropLines('C:\\A\\f.txt\r\nD:\\B Folder\\\r\n\r\n \nC:\\C.docx\n')
|
|
91
|
+
).toEqual(['C:\\A\\f.txt', 'D:\\B Folder\\', 'C:\\C.docx']);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('parseFileDropLines returns [] for empty clipboard output', () => {
|
|
95
|
+
expect(parseFileDropLines('')).toEqual([]);
|
|
96
|
+
expect(parseFileDropLines('\r\n \r\n')).toEqual([]);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('parseTextUriList decodes file URIs and skips comments', () => {
|
|
100
|
+
expect(
|
|
101
|
+
parseTextUriList(
|
|
102
|
+
'# comment\nfile:///home/user/Report%202026\nfile://host/tmp/a&b.txt\n'
|
|
103
|
+
)
|
|
104
|
+
).toEqual(['/home/user/Report 2026', '/tmp/a&b.txt']);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('read PowerShell script prints the FileDropList line by line', () => {
|
|
108
|
+
const script = buildOsClipboardReadPsScript();
|
|
109
|
+
expect(script).toContain('GetFileDropList');
|
|
110
|
+
expect(script).toContain('Write-Output');
|
|
111
|
+
expect(script).not.toContain('SetDataObject');
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe('mac clipboard write script', () => {
|
|
116
|
+
const lines = buildMacClipboardWriteScriptLines();
|
|
117
|
+
const script = lines.join('\n');
|
|
118
|
+
|
|
119
|
+
test('publishes onto the general pasteboard as a file-name list', () => {
|
|
120
|
+
expect(script).toContain('NSPasteboard');
|
|
121
|
+
expect(script).toContain('NSFilenamesPboardType');
|
|
122
|
+
expect(script).toContain("pb's clearContents()");
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test('writes the list eagerly instead of through writeObjects:', () => {
|
|
126
|
+
// writeObjects: hands the pasteboard server one lazily-provided item
|
|
127
|
+
// per URL. osascript exits before they are all pulled, so the entries
|
|
128
|
+
// that actually land are a race — the same four paths arrived as 1, 3
|
|
129
|
+
// or 4 items across identical runs, which is how a multi-select copy
|
|
130
|
+
// turned into a single pasted file.
|
|
131
|
+
expect(script).toContain('setPropertyList:paths');
|
|
132
|
+
expect(script).toContain('declareTypes:');
|
|
133
|
+
expect(script).not.toContain('writeObjects');
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test('confirms the write landed before the process exits', () => {
|
|
137
|
+
// An eager write is still not guaranteed to be visible to other
|
|
138
|
+
// processes the instant the writer dies; reading it back is what makes
|
|
139
|
+
// the result deterministic.
|
|
140
|
+
expect(script).toContain('propertyListForType:');
|
|
141
|
+
expect(script).toContain('repeat 50 times');
|
|
142
|
+
expect(script).toContain('exit repeat');
|
|
143
|
+
expect(lines).toContain('use scripting additions');
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test('collects the paths in a plain AppleScript list', () => {
|
|
147
|
+
expect(script).toContain('set paths to {}');
|
|
148
|
+
expect(script).toContain('set end of paths to');
|
|
149
|
+
expect(script).not.toContain('NSMutableArray');
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test('takes paths from argv so nothing is interpolated into the script', () => {
|
|
153
|
+
expect(lines).toContain('on run argv');
|
|
154
|
+
expect(script).toContain('repeat with p in argv');
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
describe('mac clipboard read script', () => {
|
|
159
|
+
const lines = buildMacClipboardReadScriptLines();
|
|
160
|
+
const script = lines.join('\n');
|
|
161
|
+
|
|
162
|
+
test('targets pasteboard file URLs', () => {
|
|
163
|
+
expect(script).toContain('NSPasteboard');
|
|
164
|
+
expect(script).toContain('readObjectsForClasses');
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
test('opens the if as a block instead of a one-line if/then/repeat', () => {
|
|
168
|
+
// `if ... then repeat ...` on one line is an AppleScript syntax error,
|
|
169
|
+
// which made every Finder read fail with "not available on this Mac".
|
|
170
|
+
expect(lines).toContain('if urls is not missing value then');
|
|
171
|
+
expect(lines).toContain('end if');
|
|
172
|
+
expect(script).not.toMatch(/then repeat/);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test('filters file URLs with isFileURL, not a reading-options dictionary', () => {
|
|
176
|
+
// The ASObjC bridge cannot resolve NSURLReadingFileURLsOnly and aborts
|
|
177
|
+
// with "Can't continue", so the filter has to be an explicit test.
|
|
178
|
+
expect(script).toContain('isFileURL');
|
|
179
|
+
expect(script).toContain('options:(missing value)');
|
|
180
|
+
expect(script).not.toContain('NSURLReadingFileURLsOnly');
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
describe('linux clipboard payloads', () => {
|
|
185
|
+
test('pathToFileUri percent-encodes each segment and keeps separators', () => {
|
|
186
|
+
expect(pathToFileUri('/home/user/Report 2026/a&b;c.txt')).toBe(
|
|
187
|
+
'file:///home/user/Report%202026/a%26b%3Bc.txt'
|
|
188
|
+
);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
test('gnome-copied-files leads with the action line', () => {
|
|
192
|
+
expect(buildGnomeCopiedFilesPayload(['/tmp/a.txt'])).toBe('copy\nfile:///tmp/a.txt');
|
|
193
|
+
expect(buildGnomeCopiedFilesPayload(['/tmp/a.txt'], 'move')).toBe('cut\nfile:///tmp/a.txt');
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
test('round-trips through parseGnomeCopiedFiles for both actions', () => {
|
|
197
|
+
const paths = ['/home/user/Report 2026', '/home/user/a&b.txt'];
|
|
198
|
+
for (const effect of ['copy', 'move'] as const) {
|
|
199
|
+
expect(parseGnomeCopiedFiles(buildGnomeCopiedFilesPayload(paths, effect))).toEqual(paths);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
test('parseGnomeCopiedFiles tolerates a payload with no action line', () => {
|
|
204
|
+
expect(parseGnomeCopiedFiles('file:///tmp/a.txt\nfile:///tmp/b.txt')).toEqual([
|
|
205
|
+
'/tmp/a.txt',
|
|
206
|
+
'/tmp/b.txt'
|
|
207
|
+
]);
|
|
208
|
+
});
|
|
209
|
+
});
|