nstbrowser-ai-agent 0.0.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.
Files changed (119) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +1321 -0
  3. package/bin/nstbrowser-ai-agent-darwin-arm64 +0 -0
  4. package/bin/nstbrowser-ai-agent-darwin-x64 +0 -0
  5. package/bin/nstbrowser-ai-agent-linux-arm64 +0 -0
  6. package/bin/nstbrowser-ai-agent-linux-x64 +0 -0
  7. package/bin/nstbrowser-ai-agent-win32-x64.exe +0 -0
  8. package/bin/nstbrowser-ai-agent.js +109 -0
  9. package/dist/action-policy.d.ts +14 -0
  10. package/dist/action-policy.d.ts.map +1 -0
  11. package/dist/action-policy.js +253 -0
  12. package/dist/action-policy.js.map +1 -0
  13. package/dist/actions.d.ts +18 -0
  14. package/dist/actions.d.ts.map +1 -0
  15. package/dist/actions.js +2037 -0
  16. package/dist/actions.js.map +1 -0
  17. package/dist/auth-cli.d.ts +2 -0
  18. package/dist/auth-cli.d.ts.map +1 -0
  19. package/dist/auth-cli.js +97 -0
  20. package/dist/auth-cli.js.map +1 -0
  21. package/dist/auth-vault.d.ts +36 -0
  22. package/dist/auth-vault.d.ts.map +1 -0
  23. package/dist/auth-vault.js +125 -0
  24. package/dist/auth-vault.js.map +1 -0
  25. package/dist/browser.d.ts +573 -0
  26. package/dist/browser.d.ts.map +1 -0
  27. package/dist/browser.js +2036 -0
  28. package/dist/browser.js.map +1 -0
  29. package/dist/confirmation.d.ts +8 -0
  30. package/dist/confirmation.d.ts.map +1 -0
  31. package/dist/confirmation.js +30 -0
  32. package/dist/confirmation.js.map +1 -0
  33. package/dist/daemon.d.ts +65 -0
  34. package/dist/daemon.d.ts.map +1 -0
  35. package/dist/daemon.js +589 -0
  36. package/dist/daemon.js.map +1 -0
  37. package/dist/diff.d.ts +18 -0
  38. package/dist/diff.d.ts.map +1 -0
  39. package/dist/diff.js +271 -0
  40. package/dist/diff.js.map +1 -0
  41. package/dist/domain-filter.d.ts +28 -0
  42. package/dist/domain-filter.d.ts.map +1 -0
  43. package/dist/domain-filter.js +149 -0
  44. package/dist/domain-filter.js.map +1 -0
  45. package/dist/encryption.d.ts +73 -0
  46. package/dist/encryption.d.ts.map +1 -0
  47. package/dist/encryption.js +171 -0
  48. package/dist/encryption.js.map +1 -0
  49. package/dist/ios-actions.d.ts +11 -0
  50. package/dist/ios-actions.d.ts.map +1 -0
  51. package/dist/ios-actions.js +228 -0
  52. package/dist/ios-actions.js.map +1 -0
  53. package/dist/ios-manager.d.ts +266 -0
  54. package/dist/ios-manager.d.ts.map +1 -0
  55. package/dist/ios-manager.js +1073 -0
  56. package/dist/ios-manager.js.map +1 -0
  57. package/dist/nstbrowser-actions.d.ts +10 -0
  58. package/dist/nstbrowser-actions.d.ts.map +1 -0
  59. package/dist/nstbrowser-actions.js +277 -0
  60. package/dist/nstbrowser-actions.js.map +1 -0
  61. package/dist/nstbrowser-client.d.ts +197 -0
  62. package/dist/nstbrowser-client.d.ts.map +1 -0
  63. package/dist/nstbrowser-client.js +454 -0
  64. package/dist/nstbrowser-client.js.map +1 -0
  65. package/dist/nstbrowser-errors.d.ts +28 -0
  66. package/dist/nstbrowser-errors.d.ts.map +1 -0
  67. package/dist/nstbrowser-errors.js +59 -0
  68. package/dist/nstbrowser-errors.js.map +1 -0
  69. package/dist/nstbrowser-profile-resolver.d.ts +89 -0
  70. package/dist/nstbrowser-profile-resolver.d.ts.map +1 -0
  71. package/dist/nstbrowser-profile-resolver.js +227 -0
  72. package/dist/nstbrowser-profile-resolver.js.map +1 -0
  73. package/dist/nstbrowser-types.d.ts +151 -0
  74. package/dist/nstbrowser-types.d.ts.map +1 -0
  75. package/dist/nstbrowser-types.js +5 -0
  76. package/dist/nstbrowser-types.js.map +1 -0
  77. package/dist/nstbrowser-utils.d.ts +71 -0
  78. package/dist/nstbrowser-utils.d.ts.map +1 -0
  79. package/dist/nstbrowser-utils.js +174 -0
  80. package/dist/nstbrowser-utils.js.map +1 -0
  81. package/dist/protocol.d.ts +26 -0
  82. package/dist/protocol.d.ts.map +1 -0
  83. package/dist/protocol.js +1245 -0
  84. package/dist/protocol.js.map +1 -0
  85. package/dist/snapshot.d.ts +67 -0
  86. package/dist/snapshot.d.ts.map +1 -0
  87. package/dist/snapshot.js +514 -0
  88. package/dist/snapshot.js.map +1 -0
  89. package/dist/state-utils.d.ts +77 -0
  90. package/dist/state-utils.d.ts.map +1 -0
  91. package/dist/state-utils.js +178 -0
  92. package/dist/state-utils.js.map +1 -0
  93. package/dist/stream-server.d.ts +117 -0
  94. package/dist/stream-server.d.ts.map +1 -0
  95. package/dist/stream-server.js +309 -0
  96. package/dist/stream-server.js.map +1 -0
  97. package/dist/types.d.ts +1121 -0
  98. package/dist/types.d.ts.map +1 -0
  99. package/dist/types.js +2 -0
  100. package/dist/types.js.map +1 -0
  101. package/package.json +83 -0
  102. package/scripts/analyze-api-coverage.js +205 -0
  103. package/scripts/analyze-cli-coverage.js +239 -0
  104. package/scripts/build-all-platforms.sh +68 -0
  105. package/scripts/check-version-sync.js +39 -0
  106. package/scripts/copy-native.js +36 -0
  107. package/scripts/download-nstbrowser-docs.js +152 -0
  108. package/scripts/generate-skills.sh +218 -0
  109. package/scripts/postinstall.js +231 -0
  110. package/scripts/sync-version.js +69 -0
  111. package/skills/nstbrowser-ai-agent/SKILL.md +759 -0
  112. package/skills/nstbrowser-ai-agent/references/batch-operations.md +414 -0
  113. package/skills/nstbrowser-ai-agent/references/nst-api-reference.md +960 -0
  114. package/skills/nstbrowser-ai-agent/references/profile-management.md +672 -0
  115. package/skills/nstbrowser-ai-agent/references/proxy-configuration.md +460 -0
  116. package/skills/nstbrowser-ai-agent/references/troubleshooting.md +773 -0
  117. package/skills/nstbrowser-ai-agent/templates/automated-workflow.sh +248 -0
  118. package/skills/nstbrowser-ai-agent/templates/batch-proxy-update.sh +257 -0
  119. package/skills/nstbrowser-ai-agent/templates/profile-setup.sh +248 -0
@@ -0,0 +1,248 @@
1
+ #!/bin/bash
2
+
3
+ # Automated Workflow Template
4
+ #
5
+ # This script demonstrates a complete automated workflow using nstbrowser-ai-agent
6
+ # with NST profiles, including profile selection, browser launch, navigation,
7
+ # interaction, and state persistence.
8
+ #
9
+ # Usage:
10
+ # ./automated-workflow.sh [profile-name]
11
+ #
12
+ # Arguments:
13
+ # profile-name Optional profile name (defaults to NST_PROFILE env var)
14
+ #
15
+ # Environment Variables:
16
+ # NST_API_KEY NST API key (required)
17
+ # NST_HOST NST host (default: 127.0.0.1)
18
+ # NST_PORT NST port (default: 8848)
19
+ # NST_PROFILE Default profile name
20
+ #
21
+ # Example:
22
+ # # Use default profile from environment
23
+ # export NST_PROFILE="my-profile"
24
+ # ./automated-workflow.sh
25
+ #
26
+ # # Use specific profile
27
+ # ./automated-workflow.sh "production-profile"
28
+ #
29
+ # # Complete example with environment setup
30
+ # export NST_API_KEY="your-api-key"
31
+ # export NST_HOST="127.0.0.1"
32
+ # export NST_PORT="8848"
33
+ # export NST_PROFILE="automation-profile"
34
+ # ./automated-workflow.sh
35
+
36
+ set -e # Exit on error
37
+
38
+ # Colors for output
39
+ RED='\033[0;31m'
40
+ GREEN='\033[0;32m'
41
+ YELLOW='\033[1;33m'
42
+ BLUE='\033[0;34m'
43
+ NC='\033[0m' # No Color
44
+
45
+ # Check if NO_COLOR is set
46
+ if [ -n "$NO_COLOR" ]; then
47
+ RED=''
48
+ GREEN=''
49
+ YELLOW=''
50
+ BLUE=''
51
+ NC=''
52
+ fi
53
+
54
+ # Helper functions
55
+ error() {
56
+ echo -e "${RED}✗ Error: $1${NC}" >&2
57
+ exit 1
58
+ }
59
+
60
+ success() {
61
+ echo -e "${GREEN}✓ $1${NC}"
62
+ }
63
+
64
+ info() {
65
+ echo -e "${YELLOW}→ $1${NC}"
66
+ }
67
+
68
+ step() {
69
+ echo -e "${BLUE}[$1] $2${NC}"
70
+ }
71
+
72
+ # Check if nstbrowser-ai-agent is installed
73
+ if ! command -v nstbrowser-ai-agent &> /dev/null; then
74
+ error "nstbrowser-ai-agent is not installed. Run: npm install -g nstbrowser-ai-agent"
75
+ fi
76
+
77
+ # Configuration
78
+ PROFILE_NAME="${1:-$NST_PROFILE}"
79
+ TARGET_URL="https://example.com"
80
+ SCREENSHOT_PATH="./workflow-screenshot.png"
81
+ SNAPSHOT_PATH="./workflow-snapshot.json"
82
+
83
+ # Validate environment
84
+ step "1/10" "Validating environment..."
85
+
86
+ if [ -z "$NST_API_KEY" ]; then
87
+ error "NST_API_KEY environment variable is required"
88
+ fi
89
+
90
+ if [ -z "$PROFILE_NAME" ]; then
91
+ error "Profile name is required (provide as argument or set NST_PROFILE)"
92
+ fi
93
+
94
+ success "Environment validated"
95
+
96
+ # Check NST API connectivity
97
+ step "2/10" "Checking NST API connectivity..."
98
+
99
+ if ! nstbrowser-ai-agent profile list &> /dev/null; then
100
+ error "Failed to connect to NST API. Check NST_API_KEY, NST_HOST, and NST_PORT."
101
+ fi
102
+
103
+ success "NST API is accessible"
104
+
105
+ # List available profiles
106
+ step "3/10" "Listing available profiles..."
107
+
108
+ PROFILE_COUNT=$(nstbrowser-ai-agent profile list --json | jq '. | length')
109
+ info "Found $PROFILE_COUNT profiles"
110
+
111
+ # Verify profile exists
112
+ step "4/10" "Verifying profile: $PROFILE_NAME..."
113
+
114
+ if ! nstbrowser-ai-agent profile show "$PROFILE_NAME" &> /dev/null; then
115
+ error "Profile not found: $PROFILE_NAME"
116
+ fi
117
+
118
+ PROFILE_ID=$(nstbrowser-ai-agent profile list --json | jq -r ".[] | select(.name == \"$PROFILE_NAME\") | .profileId")
119
+ success "Profile verified (ID: $PROFILE_ID)"
120
+
121
+ # Display profile details
122
+ info "Profile details:"
123
+ nstbrowser-ai-agent profile show "$PROFILE_NAME"
124
+
125
+ # Check if browser is already running
126
+ step "5/10" "Checking browser status..."
127
+
128
+ BROWSER_RUNNING=$(nstbrowser-ai-agent browser list | grep -c "$PROFILE_NAME" || true)
129
+
130
+ if [ "$BROWSER_RUNNING" -gt 0 ]; then
131
+ info "Browser already running, stopping..."
132
+ nstbrowser-ai-agent browser stop "$PROFILE_NAME"
133
+ sleep 2
134
+ fi
135
+
136
+ success "Browser ready to start"
137
+
138
+ # Start browser with profile
139
+ step "6/10" "Starting browser with profile..."
140
+
141
+ if nstbrowser-ai-agent --profile "$PROFILE_NAME" browser start; then
142
+ success "Browser started successfully"
143
+ else
144
+ error "Failed to start browser"
145
+ fi
146
+
147
+ # Wait for browser to be ready
148
+ sleep 3
149
+
150
+ # Get debugger URL
151
+ DEBUGGER_URL=$(nstbrowser-ai-agent browser debugger "$PROFILE_NAME" --json | jq -r '.debuggerUrl')
152
+ info "Debugger URL: $DEBUGGER_URL"
153
+
154
+ # Navigate to target URL
155
+ step "7/10" "Navigating to $TARGET_URL..."
156
+
157
+ if nstbrowser-ai-agent --profile "$PROFILE_NAME" open "$TARGET_URL"; then
158
+ success "Navigation successful"
159
+ else
160
+ error "Navigation failed"
161
+ fi
162
+
163
+ # Wait for page to load
164
+ sleep 2
165
+
166
+ # Take snapshot
167
+ step "8/10" "Taking page snapshot..."
168
+
169
+ if nstbrowser-ai-agent --profile "$PROFILE_NAME" snapshot --json > "$SNAPSHOT_PATH"; then
170
+ success "Snapshot saved to $SNAPSHOT_PATH"
171
+
172
+ # Display snapshot info
173
+ PAGE_TITLE=$(jq -r '.title' "$SNAPSHOT_PATH")
174
+ PAGE_URL=$(jq -r '.url' "$SNAPSHOT_PATH")
175
+ REF_COUNT=$(jq '.refs | length' "$SNAPSHOT_PATH")
176
+
177
+ info "Page title: $PAGE_TITLE"
178
+ info "Page URL: $PAGE_URL"
179
+ info "Available refs: $REF_COUNT"
180
+ else
181
+ error "Failed to take snapshot"
182
+ fi
183
+
184
+ # Take screenshot
185
+ step "9/10" "Taking screenshot..."
186
+
187
+ if nstbrowser-ai-agent --profile "$PROFILE_NAME" screenshot --output "$SCREENSHOT_PATH"; then
188
+ success "Screenshot saved to $SCREENSHOT_PATH"
189
+ else
190
+ error "Failed to take screenshot"
191
+ fi
192
+
193
+ # Demonstrate interaction (example: find and display heading)
194
+ info "Demonstrating page interaction..."
195
+
196
+ # Extract heading from snapshot
197
+ HEADING=$(jq -r '.refs[] | select(.tag == "h1") | .text' "$SNAPSHOT_PATH" | head -n 1)
198
+
199
+ if [ -n "$HEADING" ]; then
200
+ success "Found heading: $HEADING"
201
+ else
202
+ info "No h1 heading found on page"
203
+ fi
204
+
205
+ # Demonstrate state persistence
206
+ info "Demonstrating state persistence..."
207
+
208
+ # The profile automatically persists:
209
+ # - Cookies
210
+ # - Local storage
211
+ # - Session storage
212
+ # - Cache
213
+ # - Fingerprint
214
+
215
+ success "State will be preserved for next session"
216
+
217
+ # Stop browser
218
+ step "10/10" "Stopping browser..."
219
+
220
+ if nstbrowser-ai-agent browser stop "$PROFILE_NAME"; then
221
+ success "Browser stopped successfully"
222
+ else
223
+ error "Failed to stop browser"
224
+ fi
225
+
226
+ # Display results summary
227
+ echo ""
228
+ success "Workflow completed successfully!"
229
+ echo ""
230
+ info "Results:"
231
+ echo " Profile: $PROFILE_NAME"
232
+ echo " Profile ID: $PROFILE_ID"
233
+ echo " Target URL: $TARGET_URL"
234
+ echo " Page Title: $PAGE_TITLE"
235
+ echo " Screenshot: $SCREENSHOT_PATH"
236
+ echo " Snapshot: $SNAPSHOT_PATH"
237
+ echo ""
238
+ info "Next steps:"
239
+ echo " 1. View screenshot: open $SCREENSHOT_PATH"
240
+ echo " 2. Inspect snapshot: cat $SNAPSHOT_PATH | jq"
241
+ echo " 3. Restart browser: nstbrowser-ai-agent --profile \"$PROFILE_NAME\" browser start"
242
+ echo " 4. Continue automation: nstbrowser-ai-agent --profile \"$PROFILE_NAME\" open <url>"
243
+ echo ""
244
+ info "State persistence:"
245
+ echo " All cookies, storage, and session data are preserved in the profile."
246
+ echo " Next time you start the browser with this profile, you'll be in the same state."
247
+ echo ""
248
+ success "Workflow template complete!"
@@ -0,0 +1,257 @@
1
+ #!/bin/bash
2
+
3
+ # Batch Proxy Update Template
4
+ #
5
+ # This script updates proxy configuration for multiple NST profiles at once.
6
+ #
7
+ # Usage:
8
+ # ./batch-proxy-update.sh <profile-ids> [options]
9
+ #
10
+ # Arguments:
11
+ # <profile-ids> Space or comma-separated profile IDs or names
12
+ #
13
+ # Options:
14
+ # --proxy-host <host> Proxy server host (required)
15
+ # --proxy-port <port> Proxy server port (required)
16
+ # --proxy-type <type> Proxy type (http|https|socks5, default: http)
17
+ # --proxy-username <user> Proxy username (optional)
18
+ # --proxy-password <pass> Proxy password (optional)
19
+ # --reset Reset proxy instead of updating
20
+ #
21
+ # Examples:
22
+ # # Update proxy for multiple profiles
23
+ # ./batch-proxy-update.sh "id1 id2 id3" \
24
+ # --proxy-host proxy.example.com \
25
+ # --proxy-port 8080
26
+ #
27
+ # # Update proxy with authentication
28
+ # ./batch-proxy-update.sh "profile1,profile2,profile3" \
29
+ # --proxy-host proxy.example.com \
30
+ # --proxy-port 8080 \
31
+ # --proxy-username user \
32
+ # --proxy-password pass
33
+ #
34
+ # # Update proxy type
35
+ # ./batch-proxy-update.sh "id1 id2" \
36
+ # --proxy-host proxy.example.com \
37
+ # --proxy-port 1080 \
38
+ # --proxy-type socks5
39
+ #
40
+ # # Reset proxy for multiple profiles
41
+ # ./batch-proxy-update.sh "id1 id2 id3" --reset
42
+
43
+ set -e # Exit on error
44
+
45
+ # Colors for output
46
+ RED='\033[0;31m'
47
+ GREEN='\033[0;32m'
48
+ YELLOW='\033[1;33m'
49
+ BLUE='\033[0;34m'
50
+ NC='\033[0m' # No Color
51
+
52
+ # Check if NO_COLOR is set
53
+ if [ -n "$NO_COLOR" ]; then
54
+ RED=''
55
+ GREEN=''
56
+ YELLOW=''
57
+ BLUE=''
58
+ NC=''
59
+ fi
60
+
61
+ # Helper functions
62
+ error() {
63
+ echo -e "${RED}✗ Error: $1${NC}" >&2
64
+ exit 1
65
+ }
66
+
67
+ success() {
68
+ echo -e "${GREEN}✓ $1${NC}"
69
+ }
70
+
71
+ info() {
72
+ echo -e "${YELLOW}→ $1${NC}"
73
+ }
74
+
75
+ warn() {
76
+ echo -e "${BLUE}⚠ $1${NC}"
77
+ }
78
+
79
+ # Check if nstbrowser-ai-agent is installed
80
+ if ! command -v nstbrowser-ai-agent &> /dev/null; then
81
+ error "nstbrowser-ai-agent is not installed. Run: npm install -g nstbrowser-ai-agent"
82
+ fi
83
+
84
+ # Parse arguments
85
+ PROFILE_IDS=""
86
+ PROXY_HOST=""
87
+ PROXY_PORT=""
88
+ PROXY_TYPE="http"
89
+ PROXY_USERNAME=""
90
+ PROXY_PASSWORD=""
91
+ RESET_MODE=false
92
+
93
+ if [ $# -eq 0 ]; then
94
+ error "Profile IDs are required. Usage: $0 <profile-ids> [options]"
95
+ fi
96
+
97
+ PROFILE_IDS="$1"
98
+ shift
99
+
100
+ while [ $# -gt 0 ]; do
101
+ case "$1" in
102
+ --proxy-host)
103
+ PROXY_HOST="$2"
104
+ shift 2
105
+ ;;
106
+ --proxy-port)
107
+ PROXY_PORT="$2"
108
+ shift 2
109
+ ;;
110
+ --proxy-type)
111
+ PROXY_TYPE="$2"
112
+ shift 2
113
+ ;;
114
+ --proxy-username)
115
+ PROXY_USERNAME="$2"
116
+ shift 2
117
+ ;;
118
+ --proxy-password)
119
+ PROXY_PASSWORD="$2"
120
+ shift 2
121
+ ;;
122
+ --reset)
123
+ RESET_MODE=true
124
+ shift
125
+ ;;
126
+ *)
127
+ error "Unknown option: $1"
128
+ ;;
129
+ esac
130
+ done
131
+
132
+ # Validate inputs
133
+ if [ -z "$PROFILE_IDS" ]; then
134
+ error "Profile IDs cannot be empty"
135
+ fi
136
+
137
+ if [ "$RESET_MODE" = false ]; then
138
+ if [ -z "$PROXY_HOST" ] || [ -z "$PROXY_PORT" ]; then
139
+ error "Proxy host and port are required (or use --reset to reset proxy)"
140
+ fi
141
+ fi
142
+
143
+ # Parse profile IDs (handle both space and comma separation)
144
+ PROFILE_IDS=$(echo "$PROFILE_IDS" | tr ',' ' ')
145
+ IFS=' ' read -ra PROFILE_ARRAY <<< "$PROFILE_IDS"
146
+
147
+ info "Processing ${#PROFILE_ARRAY[@]} profiles..."
148
+
149
+ # Check NST API connectivity
150
+ info "Checking NST API connectivity..."
151
+ if ! nstbrowser-ai-agent profile list &> /dev/null; then
152
+ error "Failed to connect to NST API. Check NST_API_KEY, NST_HOST, and NST_PORT environment variables."
153
+ fi
154
+ success "NST API is accessible"
155
+
156
+ # Resolve profile names to IDs
157
+ RESOLVED_IDS=()
158
+ info "Resolving profile IDs..."
159
+ for profile in "${PROFILE_ARRAY[@]}"; do
160
+ profile=$(echo "$profile" | xargs) # Trim whitespace
161
+
162
+ # Check if it's already an ID (UUID format)
163
+ if [[ "$profile" =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ ]]; then
164
+ RESOLVED_IDS+=("$profile")
165
+ success "Profile ID: $profile"
166
+ else
167
+ # Try to resolve name to ID
168
+ PROFILE_ID=$(nstbrowser-ai-agent profile list --json | jq -r ".[] | select(.name == \"$profile\") | .profileId")
169
+ if [ -n "$PROFILE_ID" ]; then
170
+ RESOLVED_IDS+=("$PROFILE_ID")
171
+ success "Resolved '$profile' to ID: $PROFILE_ID"
172
+ else
173
+ warn "Profile not found: $profile (skipping)"
174
+ fi
175
+ fi
176
+ done
177
+
178
+ if [ ${#RESOLVED_IDS[@]} -eq 0 ]; then
179
+ error "No valid profiles found"
180
+ fi
181
+
182
+ info "Found ${#RESOLVED_IDS[@]} valid profiles"
183
+
184
+ # Perform batch operation
185
+ if [ "$RESET_MODE" = true ]; then
186
+ # Reset proxy
187
+ info "Resetting proxy for ${#RESOLVED_IDS[@]} profiles..."
188
+
189
+ if nstbrowser-ai-agent profile proxy batch-reset "${RESOLVED_IDS[@]}"; then
190
+ success "Batch proxy reset completed"
191
+ else
192
+ error "Batch proxy reset failed"
193
+ fi
194
+ else
195
+ # Update proxy
196
+ info "Updating proxy for ${#RESOLVED_IDS[@]} profiles..."
197
+
198
+ # Build update command
199
+ UPDATE_CMD="nstbrowser-ai-agent profile proxy batch-update ${RESOLVED_IDS[*]}"
200
+ UPDATE_CMD="$UPDATE_CMD --proxy-host $PROXY_HOST"
201
+ UPDATE_CMD="$UPDATE_CMD --proxy-port $PROXY_PORT"
202
+ UPDATE_CMD="$UPDATE_CMD --proxy-type $PROXY_TYPE"
203
+
204
+ if [ -n "$PROXY_USERNAME" ]; then
205
+ UPDATE_CMD="$UPDATE_CMD --proxy-username $PROXY_USERNAME"
206
+ fi
207
+
208
+ if [ -n "$PROXY_PASSWORD" ]; then
209
+ UPDATE_CMD="$UPDATE_CMD --proxy-password $PROXY_PASSWORD"
210
+ fi
211
+
212
+ if eval "$UPDATE_CMD"; then
213
+ success "Batch proxy update completed"
214
+ else
215
+ error "Batch proxy update failed"
216
+ fi
217
+ fi
218
+
219
+ # Verify updates
220
+ info "Verifying updates..."
221
+ SUCCESS_COUNT=0
222
+ FAIL_COUNT=0
223
+
224
+ for profile_id in "${RESOLVED_IDS[@]}"; do
225
+ if nstbrowser-ai-agent profile proxy show "$profile_id" &> /dev/null; then
226
+ SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
227
+ else
228
+ FAIL_COUNT=$((FAIL_COUNT + 1))
229
+ warn "Failed to verify profile: $profile_id"
230
+ fi
231
+ done
232
+
233
+ # Display summary
234
+ echo ""
235
+ info "Summary:"
236
+ echo " Total profiles: ${#RESOLVED_IDS[@]}"
237
+ echo " Successful: $SUCCESS_COUNT"
238
+ echo " Failed: $FAIL_COUNT"
239
+
240
+ if [ "$RESET_MODE" = true ]; then
241
+ success "Proxy reset complete!"
242
+ else
243
+ success "Proxy update complete!"
244
+ echo ""
245
+ echo "Proxy configuration:"
246
+ echo " Host: $PROXY_HOST"
247
+ echo " Port: $PROXY_PORT"
248
+ echo " Type: $PROXY_TYPE"
249
+ if [ -n "$PROXY_USERNAME" ]; then
250
+ echo " Username: $PROXY_USERNAME"
251
+ fi
252
+ fi
253
+
254
+ # Display sample verification command
255
+ echo ""
256
+ echo "Verify proxy configuration with:"
257
+ echo " nstbrowser-ai-agent profile proxy show ${RESOLVED_IDS[0]}"