@seekskyworld/open-browser 0.2.0 → 0.3.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/CONTRIBUTING.md +2 -0
- package/Docs/desktop-packages.md +45 -0
- package/Docs/open-browser-api.d.ts +13 -9
- package/Docs//350/267/250/345/271/263/345/217/260/350/257/225/347/224/250/344/270/216/345/217/221/350/241/214.md +6 -6
- package/README.md +11 -9
- package/README.zh-CN.md +6 -4
- package/access-registry.mjs +8 -3
- package/action-execution.mjs +30 -5
- package/api-contract.mjs +8 -7
- package/browser-extension/_locales/en/messages.json +8 -0
- package/browser-extension/_locales/zh_CN/messages.json +8 -0
- package/browser-extension/i18n.js +84 -0
- package/browser-extension/manifest.json +5 -4
- package/browser-extension/messages.js +266 -0
- package/browser-extension/newtab.css +4 -0
- package/browser-extension/newtab.html +9 -9
- package/browser-extension/newtab.js +38 -35
- package/browser-extension/page-locale.js +23 -0
- package/browser-extension/phase-labels.js +33 -6
- package/browser-extension/popup.css +2 -2
- package/browser-extension/popup.html +25 -25
- package/browser-extension/popup.js +102 -59
- package/browser-extension/tab-action.js +31 -25
- package/browser-extension/worker.js +31 -7
- package/browser-extension/workspace-title.js +2 -2
- package/build-profile.mjs +10 -2
- package/capability-matrix.mjs +1 -1
- package/chromium-host.mjs +26 -19
- package/chromium-shell.mjs +7 -5
- package/cli.mjs +51 -48
- package/contract-validation.mjs +1 -1
- package/control.mjs +9 -8
- package/desktop/Info.plist +4 -2
- package/desktop/Launcher.m +10 -2
- package/desktop/OBControlBar.m +12 -8
- package/desktop/OBLocalization.h +20 -0
- package/desktop/OBPageView.m +2 -1
- package/desktop/WorkspacePanel.m +85 -83
- package/desktop/archive-release.py +5 -1
- package/desktop/build-macos.mjs +17 -8
- package/desktop/build-managed-input.mjs +2 -1
- package/desktop/build-portable.mjs +5 -3
- package/desktop/build-profile.mjs +2 -1
- package/desktop/build.mjs +2 -1
- package/desktop/create-shortcut.ps1 +7 -1
- package/desktop/en.lproj/Localizable.strings +106 -0
- package/desktop/install-menu-entry.mjs +2 -0
- package/desktop/notarize-macos.mjs +70 -29
- package/desktop/package-macos.mjs +4 -3
- package/desktop/sign.mjs +22 -6
- package/desktop/start-profile.mjs +2 -1
- package/desktop/start.mjs +3 -1
- package/desktop/verify-macos-release.mjs +27 -18
- package/desktop/verify-version.mjs +22 -2
- package/desktop/zh-Hans.lproj/Localizable.strings +106 -0
- package/engine-service.mjs +86 -27
- package/hosted/cli.mjs +2 -1
- package/hosted/init.mjs +2 -1
- package/i18n.mjs +41 -0
- package/managed-input.mjs +22 -5
- package/mcp-http.mjs +12 -11
- package/mcp-server.mjs +27 -10
- package/mcp.mjs +1 -0
- package/messages.zh-CN.mjs +175 -0
- package/package.json +9 -5
- package/page-activity.mjs +10 -7
- package/page-observation.mjs +4 -1
- package/paths.mjs +2 -5
- package/receipt-store.mjs +17 -7
- package/runtime.mjs +5 -4
- package/sdk.mjs +57 -46
- package/service.mjs +38 -21
- package/skill-links.mjs +72 -18
- package/skills/open-browser/SKILL.md +10 -97
- package/skills/open-browser/SKILL.zh-CN.md +22 -0
- package/skills/open-browser/references/macos.en.md +3 -0
- package/skills/open-browser/references/macos.md +5 -0
- package/skills/open-browser/references/operations.en.md +54 -0
- package/skills/open-browser/{SKILL.windows.md → references/operations.md} +8 -59
- package/skills/open-browser/references/recovery.en.md +36 -0
- package/skills/open-browser/references/recovery.md +38 -0
- package/skills/open-browser/references/windows.en.md +3 -0
- package/skills/open-browser/references/windows.md +5 -0
- package/skills/open-browser/scripts/bootstrap.mjs +80 -90
- package/skills/open-browser/scripts/guide.mjs +20 -0
- package/skills/open-browser/scripts/open-browser +5 -1
- package/studio/demo-site.mjs +5 -4
- package/studio/index.html +37 -33
- package/studio/index.mjs +10 -3
- package/studio/native-demo.mjs +8 -7
- package/studio/studio.css +3 -0
- package/studio/studio.js +99 -69
- package/system-i18n.mjs +19 -0
- package/tab-adoption.mjs +9 -3
- package/tab-recovery.mjs +100 -0
- package/visual-page.mjs +17 -7
- package/workspace-lifecycle.mjs +18 -2
- package/workspace-state.mjs +57 -16
- package/skills/open-browser/SKILL.macos.md +0 -112
package/desktop/WorkspacePanel.m
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#import "OBLocalization.h"
|
|
1
2
|
#import "WorkspacePanel.h"
|
|
2
3
|
#import "OBPageView.h"
|
|
3
4
|
|
|
@@ -29,43 +30,44 @@ static NSStackView *Stack(NSArray<NSView *> *items, BOOL vertical, CGFloat gap)
|
|
|
29
30
|
|
|
30
31
|
static NSString *Operation(NSDictionary *op) {
|
|
31
32
|
if (!op) return @"";
|
|
32
|
-
NSDictionary *kinds = @{@"openPage"
|
|
33
|
-
@"click"
|
|
34
|
-
NSString *kind = kinds[String(op[@"kind"])] ?: @"
|
|
33
|
+
NSDictionary *kinds = @{@"openPage":OBLocalizedString(@"Open page"), @"observe":OBLocalizedString(@"Observe page"), @"act":OBLocalizedString(@"Page action"),
|
|
34
|
+
@"click":OBLocalizedString(@"Click"), @"fill":OBLocalizedString(@"Fill"), @"fillCredential":OBLocalizedString(@"Fill credential")};
|
|
35
|
+
NSString *kind = kinds[String(op[@"kind"])] ?: OBLocalizedString(@"Action");
|
|
35
36
|
NSString *step = kinds[String(op[@"stepKind"])];
|
|
36
|
-
NSDictionary *phases = @{@"actionability": @"
|
|
37
|
-
@"waiting": @"
|
|
37
|
+
NSDictionary *phases = @{@"actionability": OBLocalizedString(@"Checking target"), @"dispatching": OBLocalizedString(@"Dispatching"),
|
|
38
|
+
@"waiting": OBLocalizedString(@"Waiting for page"), @"verifying": OBLocalizedString(@"Checking result"), @"running": OBLocalizedString(@"Running")};
|
|
38
39
|
if (step && [op[@"state"] isEqual:@"running"]) {
|
|
39
40
|
NSString *stage = phases[String(op[@"phase"])] ?: phases[@"running"];
|
|
40
|
-
return [NSString stringWithFormat
|
|
41
|
+
return [NSString stringWithFormat:OBLocalizedString(@"%@ · %@ · Steps: %@/%@"), step, stage,
|
|
41
42
|
op[@"completedSteps"] ?: @0, op[@"totalSteps"] ?: @0];
|
|
42
43
|
}
|
|
43
|
-
NSDictionary *states = @{@"queued"
|
|
44
|
-
@"failed"
|
|
45
|
-
NSString *state = [op[@"error"] isEqual:@"credential_required"] ? @"
|
|
44
|
+
NSDictionary *states = @{@"queued":OBLocalizedString(@"In queue"), @"running":OBLocalizedString(@"Running"), @"completed":OBLocalizedString(@"Completed"),
|
|
45
|
+
@"failed":OBLocalizedString(@"Failed"), @"outcome_unknown":OBLocalizedString(@"Result needs verification"), @"cancelled":OBLocalizedString(@"Cancelled")};
|
|
46
|
+
NSString *state = [op[@"error"] isEqual:@"credential_required"] ? OBLocalizedString(@"Missing credential") : states[String(op[@"state"])];
|
|
46
47
|
return state ? [NSString stringWithFormat:@"%@ · %@", kind, state] : kind;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
static NSInteger Group(NSDictionary *workspace) {
|
|
50
51
|
NSDictionary *activity = workspace[@"activity"];
|
|
51
52
|
if (![workspace[@"mode"] isEqual:@"agent"]) return 2;
|
|
52
|
-
if ([activity[@"needsCredential"] boolValue] || [@[@"failed", @"outcome_unknown", @"needs_credential"] containsObject:String(activity[@"phase"])]) return 0;
|
|
53
|
+
if ([activity[@"needsCredential"] boolValue] || [activity[@"needsVisualPermission"] boolValue] || [@[@"failed", @"outcome_unknown", @"needs_credential", @"needs_visual_permission"] containsObject:String(activity[@"phase"])]) return 0;
|
|
53
54
|
if (Map(activity[@"current"]) || [activity[@"queued"] integerValue] || [@[@"queued", @"running"] containsObject:String(activity[@"phase"])]) return 1;
|
|
54
55
|
return 3;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
static NSString *Status(NSDictionary *workspace) {
|
|
58
|
-
if ([workspace[@"mode"] isEqual:@"human"]) return @"
|
|
59
|
-
if ([workspace[@"mode"] isEqual:@"transferring"]) return @"
|
|
59
|
+
if ([workspace[@"mode"] isEqual:@"human"]) return OBLocalizedString(@"User in control · Agent paused");
|
|
60
|
+
if ([workspace[@"mode"] isEqual:@"transferring"]) return OBLocalizedString(@"Transferring control");
|
|
60
61
|
NSDictionary *activity = workspace[@"activity"];
|
|
61
|
-
if ([activity[@"needsHumanVerification"] boolValue]) return @"
|
|
62
|
-
if ([activity[@"needsCredential"] boolValue]) return @"
|
|
62
|
+
if ([activity[@"needsHumanVerification"] boolValue]) return OBLocalizedString(@"Human verification required");
|
|
63
|
+
if ([activity[@"needsCredential"] boolValue]) return OBLocalizedString(@"Waiting for a credential");
|
|
64
|
+
if ([activity[@"needsVisualPermission"] boolValue]) return OBLocalizedString(@"Screenshot permission required");
|
|
63
65
|
NSString *current = Operation(Map(activity[@"current"]));
|
|
64
66
|
if (current.length) return current;
|
|
65
|
-
NSDictionary *phase = @{@"running"
|
|
66
|
-
@"waiting"
|
|
67
|
-
@"outcome_unknown"
|
|
68
|
-
return phase[String(activity[@"phase"])] ?: @"
|
|
67
|
+
NSDictionary *phase = @{@"running":OBLocalizedString(@"Running"), @"actionability":OBLocalizedString(@"Checking target"), @"dispatching":OBLocalizedString(@"Dispatching"),
|
|
68
|
+
@"waiting":OBLocalizedString(@"Waiting for page"), @"verifying":OBLocalizedString(@"Checking result"), @"queued":OBLocalizedString(@"In queue"), @"completed":OBLocalizedString(@"Completed"), @"failed":OBLocalizedString(@"Action failed"),
|
|
69
|
+
@"outcome_unknown":OBLocalizedString(@"Result needs verification"), @"cancelled":OBLocalizedString(@"Cancelled"), @"needs_credential":OBLocalizedString(@"Waiting for a credential"), @"needs_human_verification":OBLocalizedString(@"Human verification required"), @"needs_visual_permission":OBLocalizedString(@"Screenshot permission required")};
|
|
70
|
+
return phase[String(activity[@"phase"])] ?: OBLocalizedString(@"Waiting for instructions");
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
@@ -162,31 +164,31 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
162
164
|
self.notice.font = [NSFont systemFontOfSize:12];
|
|
163
165
|
self.notice.maximumNumberOfLines = 2;
|
|
164
166
|
self.notice.hidden = YES;
|
|
165
|
-
self.create = [self icon:@"plus" label
|
|
166
|
-
self.back = [self icon:@"chevron.left" label
|
|
167
|
-
self.forward = [self icon:@"chevron.right" label
|
|
168
|
-
self.reload = [self icon:@"arrow.clockwise" label
|
|
169
|
-
self.home = [self icon:@"house" label
|
|
170
|
-
self.splitButton = [self icon:@"rectangle.split.2x1" label
|
|
171
|
-
self.tabButton = [self icon:@"plus" label
|
|
172
|
-
self.control = [self button
|
|
167
|
+
self.create = [self icon:@"plus" label:OBLocalizedString(@"New workspace") action:@selector(createWorkspace:)];
|
|
168
|
+
self.back = [self icon:@"chevron.left" label:OBLocalizedString(@"Back") action:@selector(goBack:)];
|
|
169
|
+
self.forward = [self icon:@"chevron.right" label:OBLocalizedString(@"Forward") action:@selector(goForward:)];
|
|
170
|
+
self.reload = [self icon:@"arrow.clockwise" label:OBLocalizedString(@"Refresh") action:@selector(reloadPage:)];
|
|
171
|
+
self.home = [self icon:@"house" label:OBLocalizedString(@"Home") action:@selector(home:)];
|
|
172
|
+
self.splitButton = [self icon:@"rectangle.split.2x1" label:OBLocalizedString(@"Split view") action:@selector(toggleSplit:)];
|
|
173
|
+
self.tabButton = [self icon:@"plus" label:OBLocalizedString(@"New tab") action:@selector(newTab:)];
|
|
174
|
+
self.control = [self button:OBLocalizedString(@"Take") action:@selector(changeControl:)];
|
|
173
175
|
self.more = [[NSPopUpButton alloc] initWithFrame:NSZeroRect pullsDown:YES];
|
|
174
176
|
self.more.bordered = NO;
|
|
175
177
|
self.more.controlSize = NSControlSizeSmall;
|
|
176
|
-
self.more.toolTip = @"
|
|
177
|
-
[self.more setAccessibilityLabel
|
|
178
|
+
self.more.toolTip = OBLocalizedString(@"More actions");
|
|
179
|
+
[self.more setAccessibilityLabel:OBLocalizedString(@"More actions")];
|
|
178
180
|
self.more.menu.autoenablesItems = NO;
|
|
179
181
|
[self.more addItemWithTitle:@""];
|
|
180
|
-
self.more.itemArray.firstObject.image = [NSImage imageWithSystemSymbolName:@"ellipsis.circle" accessibilityDescription
|
|
182
|
+
self.more.itemArray.firstObject.image = [NSImage imageWithSystemSymbolName:@"ellipsis.circle" accessibilityDescription:OBLocalizedString(@"More actions")];
|
|
181
183
|
self.more.imagePosition = NSImageOnly;
|
|
182
|
-
self.credential = [self menuItem
|
|
183
|
-
self.preview = [self menuItem
|
|
184
|
-
self.feedback = [self menuItem
|
|
184
|
+
self.credential = [self menuItem:OBLocalizedString(@"Bind credential…") action:@selector(credentials:)];
|
|
185
|
+
self.preview = [self menuItem:OBLocalizedString(@"View page text…") action:@selector(previewPage:)];
|
|
186
|
+
self.feedback = [self menuItem:OBLocalizedString(@"Send feedback…") action:@selector(feedback:)];
|
|
185
187
|
[self.more.menu addItem:NSMenuItem.separatorItem];
|
|
186
|
-
self.closePageButton = [self menuItem
|
|
187
|
-
self.close = [self menuItem
|
|
188
|
+
self.closePageButton = [self menuItem:OBLocalizedString(@"Close tab") action:@selector(closePage:)];
|
|
189
|
+
self.close = [self menuItem:OBLocalizedString(@"Close workspace…") action:@selector(closeWorkspace:)];
|
|
188
190
|
self.address = [[NSTextField alloc] initWithFrame:NSZeroRect];
|
|
189
|
-
self.address.placeholderString = @"
|
|
191
|
+
self.address.placeholderString = OBLocalizedString(@"Enter a URL");
|
|
190
192
|
self.address.bezelStyle = NSTextFieldRoundedBezel;
|
|
191
193
|
self.address.font = [NSFont systemFontOfSize:13];
|
|
192
194
|
self.address.usesSingleLineMode = YES;
|
|
@@ -194,7 +196,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
194
196
|
self.address.target = self;
|
|
195
197
|
self.address.action = @selector(submitAddress:);
|
|
196
198
|
[(NSTextFieldCell *)self.address.cell setSendsActionOnEndEditing:NO];
|
|
197
|
-
[self.address setAccessibilityLabel
|
|
199
|
+
[self.address setAccessibilityLabel:OBLocalizedString(@"Address bar")];
|
|
198
200
|
self.window.initialFirstResponder = self.address;
|
|
199
201
|
self.table = [[NSTableView alloc] initWithFrame:NSZeroRect];
|
|
200
202
|
NSTableColumn *column = [[NSTableColumn alloc] initWithIdentifier:@"workspace"];
|
|
@@ -208,7 +210,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
208
210
|
self.table.columnAutoresizingStyle = NSTableViewLastColumnOnlyAutoresizingStyle;
|
|
209
211
|
self.table.style = NSTableViewStyleSourceList;
|
|
210
212
|
self.table.backgroundColor = NSColor.clearColor;
|
|
211
|
-
[self.table setAccessibilityLabel
|
|
213
|
+
[self.table setAccessibilityLabel:OBLocalizedString(@"Workspaces and pages")];
|
|
212
214
|
NSScrollView *scroll = [[NSScrollView alloc] init];
|
|
213
215
|
scroll.documentView = self.table;
|
|
214
216
|
scroll.hasVerticalScroller = YES;
|
|
@@ -217,7 +219,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
217
219
|
|
|
218
220
|
NSVisualEffectView *sidebar = [[NSVisualEffectView alloc] initWithFrame:NSMakeRect(0, 0, 190, size.height)];
|
|
219
221
|
sidebar.material = NSVisualEffectMaterialSidebar;
|
|
220
|
-
NSTextField *library = Label(@"
|
|
222
|
+
NSTextField *library = Label(OBLocalizedString(@"Workspace"), 15, NSFontWeightSemibold, NSColor.labelColor);
|
|
221
223
|
NSView *sideHeader = [NSView new];
|
|
222
224
|
[sideHeader addSubview:library];
|
|
223
225
|
[sideHeader addSubview:self.create];
|
|
@@ -270,8 +272,8 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
270
272
|
[self.pageSplit addArrangedSubview:self.secondaryPageView];
|
|
271
273
|
self.secondaryPageView.hidden = YES;
|
|
272
274
|
[viewport addSubview:self.pageSplit];
|
|
273
|
-
self.emptyTitle = Label(@"
|
|
274
|
-
self.emptyAction = [self button
|
|
275
|
+
self.emptyTitle = Label(OBLocalizedString(@"Open workspace"), 24, NSFontWeightSemibold, NSColor.labelColor);
|
|
276
|
+
self.emptyAction = [self button:OBLocalizedString(@"New workspace") action:@selector(emptyAction:)];
|
|
275
277
|
NSImageView *icon = [NSImageView imageViewWithImage:NSApp.applicationIconImage];
|
|
276
278
|
[icon.widthAnchor constraintEqualToConstant:40].active = YES;
|
|
277
279
|
[icon.heightAnchor constraintEqualToConstant:40].active = YES;
|
|
@@ -387,7 +389,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
387
389
|
BOOL wasConnected = self.connected;
|
|
388
390
|
self.connected = !error && [result isKindOfClass:NSArray.class];
|
|
389
391
|
if (!self.connected) {
|
|
390
|
-
[self message:error ?: @"
|
|
392
|
+
[self message:error ?: OBLocalizedString(@"Connecting to the local service…")];
|
|
391
393
|
[self render];
|
|
392
394
|
return;
|
|
393
395
|
}
|
|
@@ -418,7 +420,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
418
420
|
if (![self page] && ![self draft]) {
|
|
419
421
|
self.pageID = [selectedWorkspace[@"pages"] lastObject][@"pageId"] ?: [self.drafts[self.workspaceID ?: @""] lastObject][@"pageId"];
|
|
420
422
|
}
|
|
421
|
-
NSArray *titles = @[@"
|
|
423
|
+
NSArray *titles = @[OBLocalizedString(@"Needs attention"), OBLocalizedString(@"Agent running"), OBLocalizedString(@"Take over"), OBLocalizedString(@"Idle")];
|
|
422
424
|
NSMutableArray *rows = [NSMutableArray array];
|
|
423
425
|
for (NSInteger i = 0; i < (NSInteger)titles.count; i++) {
|
|
424
426
|
NSMutableArray *members = [NSMutableArray array];
|
|
@@ -463,7 +465,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
463
465
|
BOOL page = item[@"pageId"] != nil;
|
|
464
466
|
NSString *title = String(item[@"title"]), *origin = String(item[@"origin"]);
|
|
465
467
|
NSString *workspaceName = String(item[@"name"]);
|
|
466
|
-
if (!workspaceName.length) workspaceName = @"
|
|
468
|
+
if (!workspaceName.length) workspaceName = OBLocalizedString(@"Untitled task (please name it)");
|
|
467
469
|
NSString *name = group ? [NSString stringWithFormat:@"%@ %@", item[@"group"], item[@"count"]]
|
|
468
470
|
: page ? (title.length ? title : origin) : workspaceName;
|
|
469
471
|
NSTextField *primary = Label(name, group ? 11 : 13, group || !page ? NSFontWeightSemibold : NSFontWeightRegular, group ? NSColor.secondaryLabelColor : NSColor.labelColor);
|
|
@@ -477,7 +479,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
477
479
|
toggle.image = [NSImage imageWithSystemSymbolName:collapsed ? @"chevron.right" : @"chevron.down" accessibilityDescription:nil];
|
|
478
480
|
toggle.symbolConfiguration = [NSImageSymbolConfiguration configurationWithPointSize:9 weight:NSFontWeightSemibold];
|
|
479
481
|
toggle.identifier = item[@"workspaceId"];
|
|
480
|
-
toggle.toolTip = collapsed ? @"
|
|
482
|
+
toggle.toolTip = collapsed ? OBLocalizedString(@"Expand workspace") : OBLocalizedString(@"Collapse workspace");
|
|
481
483
|
[toggle setAccessibilityLabel:toggle.toolTip];
|
|
482
484
|
toggle.translatesAutoresizingMaskIntoConstraints = NO;
|
|
483
485
|
[cell addSubview:toggle];
|
|
@@ -550,17 +552,17 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
550
552
|
self.home.enabled = ready;
|
|
551
553
|
self.tabButton.enabled = ready;
|
|
552
554
|
self.splitButton.enabled = ready && page && ([self splitCandidate] || self.splitPage);
|
|
553
|
-
self.splitButton.toolTip = self.splitPage ? @"
|
|
555
|
+
self.splitButton.toolTip = self.splitPage ? OBLocalizedString(@"Close split view") : OBLocalizedString(@"Split the current workspace view");
|
|
554
556
|
self.more.enabled = ready;
|
|
555
557
|
self.create.enabled = ready;
|
|
556
558
|
self.control.enabled = ready && (human || (agent && page));
|
|
557
|
-
self.control.title = human ? @"
|
|
558
|
-
self.control.toolTip = human ? @"
|
|
559
|
+
self.control.title = human ? OBLocalizedString(@"Return to agent") : OBLocalizedString(@"Take");
|
|
560
|
+
self.control.toolTip = human ? OBLocalizedString(@"Return control of this workspace to the agent") : OBLocalizedString(@"Take control of the current page");
|
|
559
561
|
self.control.hidden = !w || (!page && !human);
|
|
560
|
-
self.status.stringValue = w ? Status(w) : self.connected ? @"" : @"
|
|
561
|
-
if ([activity[@"queued"] integerValue]) self.status.stringValue = [self.status.stringValue stringByAppendingFormat
|
|
562
|
+
self.status.stringValue = w ? Status(w) : self.connected ? @"" : OBLocalizedString(@"Connecting to the local service…");
|
|
563
|
+
if ([activity[@"queued"] integerValue]) self.status.stringValue = [self.status.stringValue stringByAppendingFormat:OBLocalizedString(@" · Queued: %@"), activity[@"queued"]];
|
|
562
564
|
self.status.toolTip = Operation(Map(activity[@"recent"]));
|
|
563
|
-
self.credential.title = [activity[@"needsCredential"] boolValue] ? @"
|
|
565
|
+
self.credential.title = [activity[@"needsCredential"] boolValue] ? OBLocalizedString(@"Supply credentials…") : OBLocalizedString(@"Bind credential…");
|
|
564
566
|
self.credential.enabled = agent && page;
|
|
565
567
|
self.preview.enabled = agent && page;
|
|
566
568
|
self.feedback.enabled = self.connected;
|
|
@@ -577,8 +579,8 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
577
579
|
NSDictionary *secondHandle = second ? @{@"workspaceId":self.workspaceID, @"pageId":second[@"pageId"]} : nil;
|
|
578
580
|
self.secondaryPageView.hidden = secondHandle == nil || handle == nil;
|
|
579
581
|
self.pageSplit.hidden = handle == nil;
|
|
580
|
-
self.emptyTitle.stringValue = !self.connected ? @"
|
|
581
|
-
self.emptyAction.title = @"
|
|
582
|
+
self.emptyTitle.stringValue = !self.connected ? OBLocalizedString(@"Connecting to the local service…") : OBLocalizedString(@"New Tab");
|
|
583
|
+
self.emptyAction.title = OBLocalizedString(@"Enter a URL");
|
|
582
584
|
self.emptyAction.enabled = ready;
|
|
583
585
|
if (!self.window.visible || self.window.miniaturized) handle = nil;
|
|
584
586
|
NSArray *identity = handle ? @[handle, String(w[@"mode"]), String(w[@"controlGeneration"])] : @[];
|
|
@@ -608,12 +610,12 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
608
610
|
[self invoke:method params:params reply:^(id result, NSString *error) {
|
|
609
611
|
self.busy = NO;
|
|
610
612
|
if (error.length) {
|
|
611
|
-
NSDictionary *messages = @{@"invalid_url"
|
|
612
|
-
@"origin_denied"
|
|
613
|
-
@"navigation_failed"
|
|
614
|
-
@"workspace_under_user_control"
|
|
615
|
-
@"stale_control"
|
|
616
|
-
@"stale_credential_request"
|
|
613
|
+
NSDictionary *messages = @{@"invalid_url":OBLocalizedString(@"Enter a complete HTTP or HTTPS URL."),
|
|
614
|
+
@"origin_denied":OBLocalizedString(@"This site is outside the workspace's approved origins."),
|
|
615
|
+
@"navigation_failed":OBLocalizedString(@"Could not open the page. Check the URL or your connection."),
|
|
616
|
+
@"workspace_under_user_control":OBLocalizedString(@"The user controls this workspace."),
|
|
617
|
+
@"stale_control":OBLocalizedString(@"Control has changed. Try again."),
|
|
618
|
+
@"stale_credential_request":OBLocalizedString(@"The credential request changed. Review it again.")};
|
|
617
619
|
[self message:messages[error] ?: error];
|
|
618
620
|
}
|
|
619
621
|
else {
|
|
@@ -630,7 +632,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
630
632
|
sheet.messageText = title;
|
|
631
633
|
sheet.informativeText = message ?: @"";
|
|
632
634
|
[sheet addButtonWithTitle:action];
|
|
633
|
-
[sheet addButtonWithTitle
|
|
635
|
+
[sheet addButtonWithTitle:OBLocalizedString(@"Cancel")];
|
|
634
636
|
return sheet;
|
|
635
637
|
}
|
|
636
638
|
|
|
@@ -649,9 +651,9 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
649
651
|
}
|
|
650
652
|
|
|
651
653
|
- (void)createWorkspace:(id)sender {
|
|
652
|
-
NSAlert *sheet = [self sheet
|
|
653
|
-
NSTextField *name = [self field
|
|
654
|
-
NSTextField *url = [self field
|
|
654
|
+
NSAlert *sheet = [self sheet:OBLocalizedString(@"New workspace") message:@"" action:OBLocalizedString(@"Create")];
|
|
655
|
+
NSTextField *name = [self field:OBLocalizedString(@"Workspace name") secure:NO];
|
|
656
|
+
NSTextField *url = [self field:OBLocalizedString(@"First URL (optional)") secure:NO];
|
|
655
657
|
[self attach:@[name, url] sheet:sheet];
|
|
656
658
|
name.nextKeyView = url;
|
|
657
659
|
sheet.window.initialFirstResponder = name;
|
|
@@ -659,7 +661,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
659
661
|
if (response != NSAlertFirstButtonReturn) return;
|
|
660
662
|
NSString *title = [name.stringValue stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
|
|
661
663
|
NSString *address = [url.stringValue stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
|
|
662
|
-
if (!title.length) { [self message
|
|
664
|
+
if (!title.length) { [self message:OBLocalizedString(@"Enter a workspace name.")]; return; }
|
|
663
665
|
[self perform:@"createWorkspace" params:@{@"name":title} success:^(id result) {
|
|
664
666
|
NSString *createdID = result[@"workspaceId"];
|
|
665
667
|
self.pendingSelection = @{@"workspaceId":createdID};
|
|
@@ -686,7 +688,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
686
688
|
if (self.workspaceID) {
|
|
687
689
|
if (!self.drafts[self.workspaceID]) self.drafts[self.workspaceID] = [NSMutableArray array];
|
|
688
690
|
self.pageID = NSUUID.UUID.UUIDString;
|
|
689
|
-
[self.drafts[self.workspaceID] addObject:@{@"workspaceId":self.workspaceID, @"pageId":self.pageID, @"title"
|
|
691
|
+
[self.drafts[self.workspaceID] addObject:@{@"workspaceId":self.workspaceID, @"pageId":self.pageID, @"title":OBLocalizedString(@"New Tab")}];
|
|
690
692
|
[self.collapsed removeObject:self.workspaceID];
|
|
691
693
|
[self displayWorkspaces:self.workspaces];
|
|
692
694
|
}
|
|
@@ -706,7 +708,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
706
708
|
}
|
|
707
709
|
NSDictionary *candidate = [self splitCandidate];
|
|
708
710
|
if (!candidate) {
|
|
709
|
-
[self message
|
|
711
|
+
[self message:OBLocalizedString(@"This workspace needs at least two pages for split view.")];
|
|
710
712
|
return;
|
|
711
713
|
}
|
|
712
714
|
self.splitPage = candidate;
|
|
@@ -774,7 +776,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
774
776
|
}
|
|
775
777
|
NSURLComponents *components = [NSURLComponents componentsWithString:address];
|
|
776
778
|
if (![@[@"http", @"https"] containsObject:components.scheme.lowercaseString] || !components.host.length || components.user || components.password) {
|
|
777
|
-
[self message
|
|
779
|
+
[self message:OBLocalizedString(@"Enter a valid HTTP or HTTPS URL.")]; return;
|
|
778
780
|
}
|
|
779
781
|
if ([self handle]) { [self navigate:@"go" url:address]; return; }
|
|
780
782
|
if (self.workspaceID) { [self openAddress:address workspace:self.workspaceID]; return; }
|
|
@@ -804,25 +806,25 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
804
806
|
- (void)feedback:(id)sender {
|
|
805
807
|
NSDictionary *workspace = [self active];
|
|
806
808
|
NSDictionary *activity = workspace[@"activity"];
|
|
807
|
-
NSString *report = [NSString stringWithFormat
|
|
809
|
+
NSString *report = [NSString stringWithFormat:OBLocalizedString(@"Open Browser\nWorkspace status: %@\nAgent: %@\nPage title: %@\n\nDescribe how to reproduce the issue. This report omits URLs, page content, credentials and cookies."),
|
|
808
810
|
Status(workspace), String(workspace[@"agentName"]), String([self page][@"title"])];
|
|
809
811
|
NSAlert *alert = [NSAlert new];
|
|
810
|
-
alert.messageText = @"
|
|
811
|
-
alert.informativeText = [NSString stringWithFormat
|
|
812
|
-
[alert addButtonWithTitle
|
|
813
|
-
[alert addButtonWithTitle
|
|
812
|
+
alert.messageText = OBLocalizedString(@"Send feedback");
|
|
813
|
+
alert.informativeText = [NSString stringWithFormat:OBLocalizedString(@"%@\nCurrent action: %@"), report, Operation(Map(activity[@"recent"]))];
|
|
814
|
+
[alert addButtonWithTitle:OBLocalizedString(@"Copy redacted feedback")];
|
|
815
|
+
[alert addButtonWithTitle:OBLocalizedString(@"Close")];
|
|
814
816
|
if ([alert runModal] == NSAlertFirstButtonReturn) {
|
|
815
817
|
NSPasteboard *pasteboard = NSPasteboard.generalPasteboard;
|
|
816
818
|
[pasteboard clearContents];
|
|
817
819
|
[pasteboard setString:report forType:NSPasteboardTypeString];
|
|
818
|
-
[self message
|
|
820
|
+
[self message:OBLocalizedString(@"Redacted feedback copied. Paste it into an issue or a private message.")];
|
|
819
821
|
}
|
|
820
822
|
}
|
|
821
823
|
|
|
822
824
|
- (void)closeWorkspace:(id)sender {
|
|
823
825
|
NSString *workspace = self.workspaceID;
|
|
824
826
|
if (!workspace) return;
|
|
825
|
-
NSAlert *sheet = [self sheet
|
|
827
|
+
NSAlert *sheet = [self sheet:OBLocalizedString(@"Close workspace?") message:[self active][@"name"] action:OBLocalizedString(@"Close workspace")];
|
|
826
828
|
sheet.buttons.firstObject.hasDestructiveAction = YES;
|
|
827
829
|
[sheet beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse response) {
|
|
828
830
|
if (response == NSAlertFirstButtonReturn) [self perform:@"closeWorkspace" params:@{@"workspaceId":workspace} success:nil];
|
|
@@ -834,9 +836,9 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
834
836
|
[self perform:@"previewPage" params:page success:^(id result) {
|
|
835
837
|
if (![page isEqual:[self handle]] || ![[self active][@"mode"] isEqual:@"agent"]) return;
|
|
836
838
|
NSAlert *sheet = [[NSAlert alloc] init];
|
|
837
|
-
sheet.messageText = @"
|
|
839
|
+
sheet.messageText = OBLocalizedString(@"Page text");
|
|
838
840
|
sheet.informativeText = String([self page][@"origin"]);
|
|
839
|
-
[sheet addButtonWithTitle
|
|
841
|
+
[sheet addButtonWithTitle:OBLocalizedString(@"Done")];
|
|
840
842
|
NSScrollView *scroll = [[NSScrollView alloc] initWithFrame:NSMakeRect(0, 0, 320, 200)];
|
|
841
843
|
scroll.hasVerticalScroller = YES;
|
|
842
844
|
scroll.borderType = NSBezelBorder;
|
|
@@ -845,7 +847,7 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
845
847
|
text.richText = NO;
|
|
846
848
|
text.autoresizingMask = NSViewWidthSizable;
|
|
847
849
|
text.textContainerInset = NSMakeSize(6, 6);
|
|
848
|
-
text.string = String(result[@"text"]).length ? result[@"text"] : @"
|
|
850
|
+
text.string = String(result[@"text"]).length ? result[@"text"] : OBLocalizedString(@"No text to preview.");
|
|
849
851
|
scroll.documentView = text;
|
|
850
852
|
sheet.accessoryView = scroll;
|
|
851
853
|
self.previewSheet = sheet;
|
|
@@ -865,16 +867,16 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
865
867
|
NSString *target = request ? request[@"pageId"] : page[@"pageId"];
|
|
866
868
|
NSDictionary *targetPage = Find(result[@"pages"], @"pageId", target);
|
|
867
869
|
NSString *origin = request ? String(request[@"origin"]) : String(targetPage[@"origin"]);
|
|
868
|
-
if (!targetPage || ![targetPage[@"origin"] isEqual:origin]) { [self message
|
|
870
|
+
if (!targetPage || ![targetPage[@"origin"] isEqual:origin]) { [self message:OBLocalizedString(@"The page changed. Reopen the credential panel.")]; return; }
|
|
869
871
|
[self editCredential:request page:targetPage generation:result[@"controlGeneration"] origin:origin];
|
|
870
872
|
}];
|
|
871
873
|
}
|
|
872
874
|
|
|
873
875
|
- (void)editCredential:(NSDictionary *)request page:(NSDictionary *)page generation:(NSString *)generation origin:(NSString *)origin {
|
|
874
876
|
NSDictionary *handle = @{@"workspaceId":page[@"workspaceId"], @"pageId":page[@"pageId"]};
|
|
875
|
-
NSAlert *sheet = [self sheet:request ? @"
|
|
876
|
-
NSTextField *ref = [self field
|
|
877
|
-
NSSecureTextField *secret = (NSSecureTextField *)[self field
|
|
877
|
+
NSAlert *sheet = [self sheet:request ? OBLocalizedString(@"Supply credentials") : OBLocalizedString(@"Bind credential") message:origin action:OBLocalizedString(@"Bind")];
|
|
878
|
+
NSTextField *ref = [self field:OBLocalizedString(@"Credential name") secure:NO];
|
|
879
|
+
NSSecureTextField *secret = (NSSecureTextField *)[self field:OBLocalizedString(@"Credential value") secure:YES];
|
|
878
880
|
NSMutableArray *fields = [NSMutableArray array];
|
|
879
881
|
if (request) {
|
|
880
882
|
ref.stringValue = String(request[@"credentialRef"]);
|
|
@@ -895,19 +897,19 @@ static NSDictionary *Find(NSArray *items, NSString *key, NSString *value) {
|
|
|
895
897
|
secret.stringValue = @"";
|
|
896
898
|
if (response != NSAlertFirstButtonReturn) return;
|
|
897
899
|
NSString *key = [ref.stringValue stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
|
|
898
|
-
if (!value.length || !key.length) { [self message
|
|
900
|
+
if (!value.length || !key.length) { [self message:OBLocalizedString(@"Enter a credential name and value.")]; return; }
|
|
899
901
|
[self perform:@"getWorkspace" params:@{@"workspaceId":handle[@"workspaceId"]} success:^(id fresh) {
|
|
900
902
|
NSDictionary *currentRequest = Map(fresh[@"activity"][@"credentialRequest"]);
|
|
901
903
|
NSDictionary *currentPage = Find(fresh[@"pages"], @"pageId", handle[@"pageId"]);
|
|
902
904
|
if (![fresh[@"mode"] isEqual:@"agent"] || ![generation isEqual:fresh[@"controlGeneration"]] ||
|
|
903
905
|
![currentPage[@"origin"] isEqual:origin] || (request && ![request isEqual:currentRequest])) {
|
|
904
|
-
[self message
|
|
906
|
+
[self message:OBLocalizedString(@"The page, control or credential request changed. Review it again.")];
|
|
905
907
|
return;
|
|
906
908
|
}
|
|
907
909
|
NSMutableDictionary *binding = [NSMutableDictionary dictionaryWithDictionary:request ?: @{}];
|
|
908
910
|
[binding addEntriesFromDictionary:@{@"workspaceId":handle[@"workspaceId"], @"origin":origin, @"credentialRef":key, @"value":value}];
|
|
909
911
|
[self perform:(request ? @"resolveCredential" : @"setCredential") params:binding success:^(id __unused bound) {
|
|
910
|
-
[self message:request ? @"
|
|
912
|
+
[self message:request ? OBLocalizedString(@"Credential bound. The agent can retry.") : OBLocalizedString(@"Credential bound.")];
|
|
911
913
|
}];
|
|
912
914
|
}];
|
|
913
915
|
}];
|
|
@@ -69,8 +69,12 @@ def packaged_paths(source, mac):
|
|
|
69
69
|
common = {name: 'open-browser.app/Contents/Resources/' + location for name, location in common.items()}
|
|
70
70
|
common['desktop/icons/open-browser.icns'] = 'open-browser.app/Contents/Resources/open-browser.icns'
|
|
71
71
|
common['desktop/Info.plist'] = 'open-browser.app/Contents/Info.plist'
|
|
72
|
+
for lang in ('en', 'zh-Hans'):
|
|
73
|
+
resource = lang + '.lproj/Localizable.strings'
|
|
74
|
+
common['desktop/' + resource] = 'open-browser.app/Contents/Resources/' + resource
|
|
72
75
|
else:
|
|
73
|
-
common['Docs
|
|
76
|
+
common['Docs/desktop-packages.md'] = 'README.md'
|
|
77
|
+
common['Docs/跨平台试用与发行.md'] = 'README.zh-CN.md'
|
|
74
78
|
common['desktop/smoke-portable.mjs'] = 'verify.mjs'
|
|
75
79
|
return common
|
|
76
80
|
|
package/desktop/build-macos.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t } from "../i18n.mjs";
|
|
1
2
|
import { execFileSync } from 'node:child_process';
|
|
2
3
|
import { createHash } from 'node:crypto';
|
|
3
4
|
import { copyFile, mkdir, mkdtemp, readFile, readdir, rename, rm, writeFile } from 'node:fs/promises';
|
|
@@ -11,14 +12,15 @@ import { isDevelopmentBuild } from '../build-profile.mjs';
|
|
|
11
12
|
const root = fileURLToPath(new URL('../', import.meta.url));
|
|
12
13
|
const archOption = process.argv.findIndex(value => value === '--arch');
|
|
13
14
|
const requestedArch = archOption >= 0 ? process.argv[archOption + 1] : process.env.OPEN_BROWSER_TARGET_ARCH || process.arch;
|
|
15
|
+
const compilerArch = requestedArch === 'x64' ? 'x86_64' : requestedArch;
|
|
14
16
|
const sums = {
|
|
15
17
|
arm64: 'e7131995759b61a0170b646010d2ad35a5d37b4cb0d471f3e8317eac6f742f3d',
|
|
16
18
|
x64: 'c53383238206b9ae4db23c5d8a63645e2e753bec8ab51a49cc81939aa64e9422',
|
|
17
19
|
};
|
|
18
|
-
if (process.platform !== 'darwin' || !sums[requestedArch]) throw new Error(
|
|
19
|
-
if (archOption >= 0 && !requestedArch) throw new Error(
|
|
20
|
+
if (process.platform !== 'darwin' || !sums[requestedArch]) throw new Error(t("macOS builds require arm64 or x64."));
|
|
21
|
+
if (archOption >= 0 && !requestedArch) throw new Error(t("--arch requires arm64 or x64."));
|
|
20
22
|
if (requestedArch !== process.arch)
|
|
21
|
-
throw new Error(
|
|
23
|
+
throw new Error(t("This Node process is {0}. Build {1} on matching macOS hardware, with x64 Node under Rosetta, or on an x64 CI runner.", process.arch, requestedArch));
|
|
22
24
|
process.env.OPEN_BROWSER_TARGET_ARCH = requestedArch;
|
|
23
25
|
const identity = signingIdentity();
|
|
24
26
|
await engineExecutable();
|
|
@@ -33,7 +35,7 @@ if ((await checksum(archive).catch(() => '')) !== sums[requestedArch]) {
|
|
|
33
35
|
const temp = archive + '.' + process.pid;
|
|
34
36
|
execFileSync('curl', ['--fail', '--location', '--retry', '2', '--output', temp,
|
|
35
37
|
'https://nodejs.org/dist/v22.23.5/' + filename], { stdio: 'inherit' });
|
|
36
|
-
if (await checksum(temp) !== sums[requestedArch]) throw new Error('Node archive integrity check failed');
|
|
38
|
+
if (await checksum(temp) !== sums[requestedArch]) throw new Error(t('Node archive integrity check failed'));
|
|
37
39
|
await rename(temp, archive);
|
|
38
40
|
}
|
|
39
41
|
|
|
@@ -58,18 +60,25 @@ try {
|
|
|
58
60
|
execFileSync('plutil', ['-replace', 'CFBundleName', '-string', 'open-browser Dev', outerInfo]);
|
|
59
61
|
execFileSync('plutil', ['-replace', 'CFBundleDisplayName', '-string', 'open-browser Dev', outerInfo]);
|
|
60
62
|
}
|
|
61
|
-
execFileSync('xcrun', ['clang', '-arch',
|
|
63
|
+
execFileSync('xcrun', ['clang', '-arch', compilerArch, '-fobjc-arc', '-O2', '-framework', 'AppKit', '-framework', 'CoreGraphics',
|
|
62
64
|
path.join(root, 'desktop/Launcher.m'), path.join(root, 'desktop/OBControlBar.m'),
|
|
63
65
|
'-o', path.join(contents, 'MacOS/open-browser')], { stdio: 'inherit' });
|
|
64
66
|
await copyFile(path.join(root, 'desktop/icons/open-browser.icns'), path.join(resources, 'open-browser.icns'));
|
|
67
|
+
for (const lang of ['en', 'zh-Hans']) {
|
|
68
|
+
const folder = lang + '.lproj';
|
|
69
|
+
await mkdir(path.join(resources, folder));
|
|
70
|
+
await copyFile(path.join(root, 'desktop', folder, 'Localizable.strings'), path.join(resources, folder, 'Localizable.strings'));
|
|
71
|
+
}
|
|
65
72
|
await copyApplication(app);
|
|
66
73
|
await writeFile(path.join(app, '.open-browser-build-profile'), (isDevelopmentBuild ? 'dev' : 'stable') + '\n');
|
|
67
74
|
const engine = path.join(app, '.open-browser', 'engine');
|
|
68
75
|
await mkdir(engine, { recursive: true });
|
|
69
76
|
const sourceEngine = path.join(root, '.open-browser', 'engine');
|
|
70
77
|
const executable = path.relative(sourceEngine, await engineExecutable());
|
|
71
|
-
const
|
|
72
|
-
|
|
78
|
+
const platformDirectory = path.dirname(path.resolve(sourceEngine, executable, '../../..'));
|
|
79
|
+
const packagedDirectory = path.join(engine,path.relative(sourceEngine,platformDirectory));
|
|
80
|
+
await mkdir(path.dirname(packagedDirectory),{recursive:true});
|
|
81
|
+
copyTree(platformDirectory,packagedDirectory);
|
|
73
82
|
// Brand the packaged browser, which owns the visible window and Dock entry.
|
|
74
83
|
const originalBinary = path.join(engine, executable);
|
|
75
84
|
const originalBundle = path.resolve(path.dirname(originalBinary), '../..');
|
|
@@ -99,7 +108,7 @@ const outputName = isDevelopmentBuild ? 'open-browser-dev.app' : requestedArch =
|
|
|
99
108
|
if (prior.profileVersion !== 2) continue;
|
|
100
109
|
const previousBrowser = path.resolve(priorEngine, prior.executable, '../../..');
|
|
101
110
|
if (!previousBrowser.startsWith(priorEngine + path.sep) || !['open-browser.app', 'open-browser-x64.app', 'open-browser-dev.app'].includes(path.basename(previousBrowser)))
|
|
102
|
-
throw new Error(
|
|
111
|
+
throw new Error(t("Invalid previous Chromium path."));
|
|
103
112
|
verifyUpgrade(previousBrowser, browserBundle);
|
|
104
113
|
}
|
|
105
114
|
const old = path.join(staging, 'previous.app');
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t } from '../i18n.mjs';
|
|
1
2
|
// Build the Dev engine in an already synced Chromium checkout on its native OS.
|
|
2
3
|
import { execFileSync } from 'node:child_process';
|
|
3
4
|
import { existsSync, realpathSync } from 'node:fs';
|
|
@@ -7,7 +8,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
7
8
|
const revision = '98a2592026af8d673b9fa83b626ac68bdf4ae78a';
|
|
8
9
|
const patch = fileURLToPath(new URL('./patches/chromium-managed-input.patch', import.meta.url));
|
|
9
10
|
const arg = process.argv[2];
|
|
10
|
-
if (!arg || process.argv.length !== 3) throw Error('Usage: node desktop/build-managed-input.mjs <chromium-src>');
|
|
11
|
+
if (!arg || process.argv.length !== 3) throw Error(t('Usage: node desktop/build-managed-input.mjs <chromium-src>'));
|
|
11
12
|
const src = realpathSync(arg);
|
|
12
13
|
const run = (file, args, options = {}) => execFileSync(file, args, {cwd:src, stdio:'inherit', ...options});
|
|
13
14
|
const head = run('git', ['rev-parse', 'HEAD'], {stdio:'pipe', encoding:'utf8'}).trim();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t } from '../i18n.mjs';
|
|
1
2
|
import { execFileSync } from 'node:child_process';
|
|
2
3
|
import { createHash, randomUUID } from 'node:crypto';
|
|
3
4
|
import { createReadStream } from 'node:fs';
|
|
@@ -15,11 +16,11 @@ const platforms = {
|
|
|
15
16
|
};
|
|
16
17
|
const platform = process.argv[2] || process.platform + '-' + process.arch;
|
|
17
18
|
const spec = platforms[platform];
|
|
18
|
-
if (!spec) throw new Error('Use node desktop/build-portable.mjs linux-x64 or win32-x64');
|
|
19
|
+
if (!spec) throw new Error(t('Use node desktop/build-portable.mjs linux-x64 or win32-x64'));
|
|
19
20
|
const chromeVersion = '159.0.8154.6';
|
|
20
21
|
const nodeVersion = '22.23.5';
|
|
21
22
|
const info = JSON.parse(await readFile(path.join(root, 'node_modules/playwright-core/browsers.json'), 'utf8')).browsers.find(b => b.name === 'chromium');
|
|
22
|
-
if (info.browserVersion !== chromeVersion) throw new Error('Refresh the pinned Chrome archive version and SHA-256.');
|
|
23
|
+
if (info.browserVersion !== chromeVersion) throw new Error(t('Refresh the pinned Chrome archive version and SHA-256.'));
|
|
23
24
|
const playwright = JSON.parse(await readFile(path.join(root, 'node_modules/playwright-core/package.json'), 'utf8'));
|
|
24
25
|
const cache = path.join(root, '.open-browser', 'build-cache', 'portable');
|
|
25
26
|
const output = path.join(root, 'dist');
|
|
@@ -83,7 +84,8 @@ try {
|
|
|
83
84
|
await writeFile(launcher, '#!/bin/sh\nset -eu\nbase=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)\nexec "$base/node/bin/node" "$base/app/service.mjs" --chromium "$@"\n');
|
|
84
85
|
await chmod(launcher, 0o755);
|
|
85
86
|
}
|
|
86
|
-
await copyFile(path.join(root, 'Docs
|
|
87
|
+
await copyFile(path.join(root, 'Docs/desktop-packages.md'), path.join(bundle, 'README.md'));
|
|
88
|
+
await copyFile(path.join(root, 'Docs/跨平台试用与发行.md'), path.join(bundle, 'README.zh-CN.md'));
|
|
87
89
|
await copyFile(path.join(root, 'desktop/smoke-portable.mjs'), path.join(bundle, 'verify.mjs'));
|
|
88
90
|
const name = folder + (windows ? '.zip' : '.tar.gz'), archive = path.join(staging, name);
|
|
89
91
|
if (windows) pythonArchive('pack', bundle, archive);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { systemMessage as t } from '../system-i18n.mjs';
|
|
2
3
|
const [profile, ...args] = process.argv.slice(2);
|
|
3
|
-
if (!['dev', 'stable'].includes(profile)) throw new Error('usage: build-profile.mjs <dev|stable> [build arguments]');
|
|
4
|
+
if (!['dev', 'stable'].includes(profile)) throw new Error(t('usage: build-profile.mjs <dev|stable> [build arguments]'));
|
|
4
5
|
process.env.OPEN_BROWSER_BUILD_PROFILE = profile;
|
|
5
6
|
process.argv = [process.argv[0], process.argv[1], ...args];
|
|
6
7
|
await import('./build.mjs');
|
package/desktop/build.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { systemMessage as t } from '../system-i18n.mjs';
|
|
1
2
|
const profileIndex = process.argv.findIndex(value => value === '--profile');
|
|
2
3
|
if (profileIndex >= 0) {
|
|
3
4
|
const profile = process.argv[profileIndex + 1];
|
|
4
|
-
if (!['dev', 'stable'].includes(profile)) throw new Error('--profile must be dev or stable');
|
|
5
|
+
if (!['dev', 'stable'].includes(profile)) throw new Error(t('--profile must be dev or stable'));
|
|
5
6
|
process.env.OPEN_BROWSER_BUILD_PROFILE = profile;
|
|
6
7
|
}
|
|
7
8
|
const archIndex = process.argv.findIndex(value => value === '--arch');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
$ErrorActionPreference = 'Stop'
|
|
1
|
+
$ErrorActionPreference = 'Stop'
|
|
2
2
|
$desktop = [Environment]::GetFolderPath('DesktopDirectory')
|
|
3
3
|
$link = (New-Object -ComObject WScript.Shell).CreateShortcut((Join-Path $desktop 'open-browser.lnk'))
|
|
4
4
|
$link.TargetPath = Join-Path $PSScriptRoot 'node\node.exe'
|
|
@@ -6,4 +6,10 @@ $link.Arguments = '"' + (Join-Path $PSScriptRoot 'app\service.mjs') + '" --chrom
|
|
|
6
6
|
$link.WorkingDirectory = $PSScriptRoot
|
|
7
7
|
$link.IconLocation = (Join-Path $PSScriptRoot 'open-browser.ico') + ',0'
|
|
8
8
|
$link.WindowStyle = 7
|
|
9
|
+
$language = if ($env:OPEN_BROWSER_LOCALE) { $env:OPEN_BROWSER_LOCALE } else { (Get-UICulture).Name }
|
|
10
|
+
$link.Description = if ($language -match '^zh($|[-_.@])') {
|
|
11
|
+
'与 Agent 一起浏览网页,随时在标签页接管任务'
|
|
12
|
+
} else {
|
|
13
|
+
'Browse with agents and take over a task in its tab'
|
|
14
|
+
}
|
|
9
15
|
$link.Save()
|