Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/hop/blob/main/Omega/tests/mutant/hoppanel-deaf.om # hop Hop: a small native macOS launcher. Clipboard history, find, on-device dictation and your coding agent behind one key. Brought by drakestapleton Sign in to star 1 stars 1 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `hop / Omega / tests / mutant / hoppanel-deaf.om` 13093 lines ยท 307360 bytes Raw Blame History 1 target macos 2 om2 3 note hoppanel: the first cut of Hop's launcher panel as one Omega program, with no Swift. A window with a search 4 note field and a list. Before anything is typed the list offers up to six apps by Hop's own rule (fn swsuggest): the 5 note ones you usually open from the app in front or around this hour (habits.json, through fn swlifts), the ones 6 note you use most (recents.json), the ones that are running and the one you were just in, each with the reason. What is opened is remembered in those two files as Hop remembers it (fn urecordapp, fn urecent). 7 note The apps are the names in /Applications and /System/Applications. Typing narrows the 8 note list by Hop's own rules: the matcher (hopfuzz), the test for a web address (weba) and the order of the rows 9 note (swrank) are the functions of Omega/hopcore.om, which Omega/gen-ui.sh puts between the two marker notes, so 10 note the panel and the one box cannot drift apart. Typed text shows the eight best apps, a row that opens the text when 11 note it is a web address, and up to twelve files and folders from Hop's file index (file-index.bin in Hop's folder, 12 note which Hop builds: the panel reads it, lower-cases a copy and searches it by the rule of Hop's file search). 13 note The Ask row sends the typed text to a model and shows the answer as it arrives, in place of the list: the 14 note model is the default one of Hop's settings (config.json) when it is an HTTP one, else the 15 note first such; the request is Hop's (POST base/chat/completions, the model, one user message, stream true) and 16 note the answer's pieces are read from the server's "data:" lines. The session's delegate methods are Omega code 17 note (callback entries 7 and 8), called on the main queue. A model whose key is a saved account is asked with that key. The first row is selected; the down and up arrows move the selection, Enter 18 note opens the selected row. Like Hop it then stays: Enter and Escape hide the panel and give the app before it the 19 note keyboard back, and a global key (Option Space; Hop itself has Command Space), a click on its Dock icon or opening it again brings it 20 note back. It has a small menu (Quit, and Edit with cut, copy, paste, select all) and runs in AppKit's own event 21 note loop. The global key is a Carbon hot key whose handler is callback entry 5. 22 note The field's two delegate methods, the list's two data-source methods and the field's action are Omega code, reached 23 note through the callback entries (libback; omega-mv seed/ng/a64/DESIGN.md s14). 24 note With HOPCHECK set in the environment it checks itself instead: it stays in the background and, after half a 25 note second, puts "sa" into its field through the field's own editor (so AppKit, not the program, tells the 26 note delegate that the text changed), sends that editor arrow down, Enter and Escape as commands, prints 27 note "hoppanel apps N shown H first NAME selected R enter APP" and ends after six seconds. Enter reaches the field's 28 note action with the field as sender, as a real Enter does, but opens nothing. Status then: 1 when apps were found, 29 note the typed text narrowed them, the first one was read back from the list's own data source, the arrow moved the 30 note list's selection, Enter chose the selected app, Escape hid the panel, a hot key could be registered (a spare 31 note one: Control Option Shift Command F19) and its handler showed the panel again; 2 to 9 name a failed step. 32 note The line then ends " key K hid H back B" (K 0 when the key was registered). 33 note With HOPCHECK=type:TEXT it types TEXT instead and sends Enter (no arrow), still opening nothing: status 1 when 34 note Enter chose a row. With HOPCHECK=open:TEXT it does the same and does open the row: the line ends " opened 1" 35 note when the workspace took it, and the status is 1 then. With HOPCHECK=ask:TEXT it types TEXT, sends Enter on the 36 note Ask row (first for a question) and does ask the model: the line ends " answer TEXT" and the status is 1 when an 37 note answer came. With HOPCHECK=idle it types nothing and sends Enter on the first offer; HOPFRONT=ID then stands for 38 note the app in front. With HOPRECORD set as well, a check that opens nothing still remembers what Enter chose, 39 note and puts a chosen copied thing on a board of its own (the line then ends " pasted " and what is on it). 40 note A check reaches no other machine but through HOPSSH and HOPSCP, its stand-ins for ssh and scp (HOPSSH is 41 note also what a check starts in place of ssh for a forwarded port), and HOPLATE sends Enter late, when 42 note they have answered. With HOPCHECK=agent:TEXT a check sends TEXT to the agent of the settings and waits for it to end; with 43 note HOPAGENTS it first says each agent's command as it would be run. 44 note HOPASK2 is a second question a check asks in the same conversation once the first is answered; with 45 note HOPASKNEW it starts a new chat first. 46 note HOPSCREEN (clipboard or accounts) starts a check in that screen, and HOPCLIPDO (pin or delete) does that to 47 note the selected copied thing before Enter. With HOPCLIPREC a check first records what is on its own board into the history, as the program that stays 48 note does for the real clipboard. HOPCLIPKEY is the clipboard key for a check, in base64, or "tool:" and the name of a Keychain item of the 49 note security tool to read it from (the repository's checks use an item of their own, made and deleted there). HOPROW is the row Enter is sent on. 50 note Without HOPCHECK it runs until it is quit. 51 text s_appkit "/System/Library/Frameworks/AppKit.framework/AppKit" 52 text s_gc "objc_getClass" 53 text s_sr "sel_registerName" 54 text s_ms "objc_msgSend" 55 text s_wr "write" 56 text s_acp "objc_allocateClassPair" 57 text s_cam "class_addMethod" 58 text s_rcp "objc_registerClassPair" 59 text s_strlen "strlen" 60 text s_memcpy "memcpy" 61 text s_getenv "getenv" 62 text c_pool "NSAutoreleasePool" 63 text c_app "NSApplication" 64 text c_win "NSWindow" 65 text c_str "NSString" 66 text c_field "NSTextField" 67 text c_scroll "NSScrollView" 68 text c_table "NSTableView" 69 text c_col "NSTableColumn" 70 text c_fm "NSFileManager" 71 text c_obj "NSObject" 72 text c_date "NSDate" 73 text c_mine "OmegaHopPanel" 74 text c_url "NSURL" 75 text c_ws "NSWorkspace" 76 text m_alloc "alloc" 77 text m_init "init" 78 text m_shared "sharedApplication" 79 text m_policy "setActivationPolicy:" 80 text m_initwi "initWithContentRect:styleMask:backing:defer:" 81 text m_utf "stringWithUTF8String:" 82 text m_cstr "UTF8String" 83 text m_title "setTitle:" 84 text m_conten "contentView" 85 text m_addsub "addSubview:" 86 text m_initfr "initWithFrame:" 87 text m_label "labelWithString:" 88 text m_setfra "setFrame:" 89 text m_placeh "setPlaceholderString:" 90 text m_setdel "setDelegate:" 91 text m_settar "setTarget:" 92 text m_setact "setAction:" 93 text m_initid "initWithIdentifier:" 94 text m_setwid "setWidth:" 95 text m_addcol "addTableColumn:" 96 text m_header "setHeaderView:" 97 text m_dataso "setDataSource:" 98 text m_docvie "setDocumentView:" 99 text m_scroll "setHasVerticalScroller:" 100 text m_reload "reloadData" 101 text m_strval "stringValue" 102 text m_setstr "setStringValue:" 103 text m_defaul "defaultManager" 104 text m_conte1 "contentsOfDirectoryAtPath:error:" 105 text m_count "count" 106 text m_at "objectAtIndex:" 107 text m_finish "finishLaunching" 108 text m_front "orderFrontRegardless" 109 text m_visibl "isVisible" 110 text m_close "close" 111 text m_since "dateWithTimeIntervalSinceNow:" 112 text m_next "nextEventMatchingMask:untilDate:inMode:dequeue:" 113 text m_send "sendEvent:" 114 text m_change "controlTextDidChange:" 115 text m_rows "numberOfRowsInTableView:" 116 text m_value "tableView:objectValueForTableColumn:row:" 117 text m_go "go:" 118 text m_furl "fileURLWithPath:" 119 text m_shws "sharedWorkspace" 120 text m_open "openURL:" 121 text m_activ "activateIgnoringOtherApps:" 122 text m_key "makeKeyAndOrderFront:" 123 text m_firstr "makeFirstResponder:" 124 text m_down "moveDown:" 125 text m_up "moveUp:" 126 text m_cancel "cancelOperation:" 127 text m_selrow "selectRowIndexes:byExtendingSelection:" 128 text m_ixwith "indexSetWithIndex:" 129 text m_scrrow "scrollRowToVisible:" 130 text m_cmd "control:textView:doCommandBySelector:" 131 text m_selrd "selectedRow" 132 text c_ixset "NSIndexSet" 133 text t_b "B@:@@:" 134 text m_curred "currentEditor" 135 text m_instxt "insertText:" 136 text m_docmd "doCommandBySelector:" 137 text m_newln "insertNewline:" 138 text t_v "v@:@" 139 text t_q "q@:@" 140 text t_o "@@:@@q" 141 text x_title "Hop (Omega)" 142 text x_hint "Type to find an app" 143 text x_dir1 "/Applications" 144 text x_dir2 "/System/Applications" 145 text x_mode "kCFRunLoopDefaultMode" 146 text x_name "name" 147 text x_typed "sa" 148 text x_out1 "hoppanel apps " 149 text x_out2 " shown " 150 text x_out3 " first " 151 text x_out4 " selected " 152 text x_out5 " enter " 153 text x_out6 " opened " 154 text x_https "https://" 155 text x_open "Open " 156 text m_urlstr "URLWithString:" 157 text m_host "host" 158 text s_carbon "/System/Library/Frameworks/Carbon.framework/Carbon" 159 text s_event_target "GetApplicationEventTarget" 160 text s_install_handler "InstallEventHandler" 161 text s_register_key "RegisterEventHotKey" 162 text m_order_out "orderOut:" 163 text m_hide_app "hide:" 164 text m_released "setReleasedWhenClosed:" 165 text m_set_app_delegate "setDelegate:" 166 text m_reopen "applicationShouldHandleReopen:hasVisibleWindows:" 167 text m_run "run" 168 text m_terminate "terminate:" 169 text m_set_menu "setMainMenu:" 170 text m_add_item "addItem:" 171 text m_set_submenu "setSubmenu:" 172 text m_init_title "initWithTitle:" 173 text m_init_item "initWithTitle:action:keyEquivalent:" 174 text m_cut "cut:" 175 text m_copy "copy:" 176 text m_paste "paste:" 177 text m_select_all "selectAll:" 178 text c_menu "NSMenu" 179 text c_menu_item "NSMenuItem" 180 text t_reopen "B@:@B" 181 text t_handler "i^v^v^v" 182 text x_quit "Quit Hop Omega" 183 text x_edit "Edit" 184 text x_cut "Cut" 185 text x_copy "Copy" 186 text x_paste "Paste" 187 text x_select_all "Select All" 188 text x_key_q "q" 189 text x_key_x "x" 190 text x_key_c "c" 191 text x_key_v "v" 192 text x_key_a "a" 193 text x_app "Hop Omega" 194 text x_out7 " key " 195 text x_out8 " hid " 196 text x_out9 " back " 197 text s_malloc "malloc" 198 text s_memmem "memmem" 199 text s_memchr "memchr" 200 text s_memrchr "memrchr" 201 text c_data "NSData" 202 text m_data_file "dataWithContentsOfFile:" 203 text m_retain "retain" 204 text m_bytes "bytes" 205 text m_length "length" 206 text x_env_dir "HOP_CONFIG_DIR" 207 text x_env_home "HOME" 208 text x_support "/Library/Application Support/Hop" 209 text x_index "/file-index.bin" 210 text x_gap " - " 211 text x_dotapp_low ".app" 212 text x_dir1_low "/applications/" 213 text x_dir2_low "/system/applications/" 214 text x_config "/config.json" 215 text c_json "NSJSONSerialization" 216 text c_dict "NSDictionary" 217 text c_array "NSArray" 218 text c_number "NSNumber" 219 text c_mutable_dict "NSMutableDictionary" 220 text c_mutable_string "NSMutableString" 221 text c_request "NSMutableURLRequest" 222 text c_session "NSURLSession" 223 text c_session_config "NSURLSessionConfiguration" 224 text c_queue "NSOperationQueue" 225 text c_text_view "NSTextView" 226 text m_json_object "JSONObjectWithData:options:error:" 227 text m_json_data "dataWithJSONObject:options:error:" 228 text m_object_for_key "objectForKey:" 229 text m_is_kind "isKindOfClass:" 230 text m_equal_string "isEqualToString:" 231 text m_has_suffix "hasSuffix:" 232 text m_substring_to "substringToIndex:" 233 text m_append_string "stringByAppendingString:" 234 text m_append "appendString:" 235 text m_set_string "setString:" 236 text m_string "string" 237 text m_dictionary "dictionary" 238 text m_set_object "setObject:forKey:" 239 text m_array_with "arrayWithObject:" 240 text m_number_bool "numberWithBool:" 241 text m_request_url "requestWithURL:" 242 text m_set_method "setHTTPMethod:" 243 text m_set_header "setValue:forHTTPHeaderField:" 244 text m_set_body "setHTTPBody:" 245 text m_set_timeout "setTimeoutInterval:" 246 text m_ephemeral "ephemeralSessionConfiguration" 247 text m_main_queue "mainQueue" 248 text m_session_with "sessionWithConfiguration:delegate:delegateQueue:" 249 text m_data_task "dataTaskWithRequest:" 250 text m_resume "resume" 251 text m_cancel_task "cancel" 252 text m_data_bytes "dataWithBytes:length:" 253 text m_set_editable "setEditable:" 254 text m_set_hidden "setHidden:" 255 text m_description "localizedDescription" 256 text m_response "response" 257 text m_status_code "statusCode" 258 text m_did_data "URLSession:dataTask:didReceiveData:" 259 text m_did_complete "URLSession:task:didCompleteWithError:" 260 text t_session "v@:@@@" 261 text k_models "models" 262 text k_default "defaultModel" 263 text k_name "name" 264 text k_base "baseURL" 265 text k_model "model" 266 text k_kind "kind" 267 text k_key "keychainKey" 268 text k_messages "messages" 269 text k_stream "stream" 270 text k_role "role" 271 text k_content "content" 272 text k_choices "choices" 273 text k_delta "delta" 274 text k_message "message" 275 text x_openai "openai" 276 text x_user "user" 277 text x_post "POST" 278 text x_json_type "application/json" 279 text x_content_type "Content-Type" 280 text x_slash_text "/" 281 text x_completions "/chat/completions" 282 text x_ask "Ask " 283 text x_colon ": " 284 text x_ask_none "Ask: no model in Hop's settings that can be asked from here" 285 text x_asking "Asking ..." 286 text x_no_answer "[no answer]" 287 text x_http "[HTTP " 288 text x_busy "The model is busy right now. Try again in a moment. " 289 text x_bracket "]" 290 text x_out10 " answer " 291 text s_pow "pow" 292 text s_log2 "log2" 293 text c_calendar "NSCalendar" 294 text c_running_app "NSRunningApplication" 295 text m_current_calendar "currentCalendar" 296 text m_component "component:fromDate:" 297 text m_date_now "date" 298 text m_current_app "currentApplication" 299 text m_frontmost "frontmostApplication" 300 text m_running_apps "runningApplications" 301 text m_policy_of "activationPolicy" 302 text m_bundle_id "bundleIdentifier" 303 text m_bundle_url "bundleURL" 304 text m_path "path" 305 text m_localized_name "localizedName" 306 text m_integer_value "integerValue" 307 text m_double_value "doubleValue" 308 text m_number_integer "numberWithInteger:" 309 text m_reference_now "timeIntervalSinceReferenceDate" 310 text x_habits "/habits.json" 311 text x_recents "/recents.json" 312 text x_mac_key "Mac:" 313 text x_env_front "HOPFRONT" 314 text k_app "app" 315 text k_from "from" 316 text k_hour "hour" 317 text k_count "count" 318 text k_last "last" 319 text x_why4 "You often open this from " 320 text x_here "here" 321 text x_why5 "You were just here" 322 text x_why6 "You often open this around now" 323 text x_why7 "One of your most used" 324 text x_why8 "Running now" 325 text s_chmod "chmod" 326 text c_mutable_array "NSMutableArray" 327 text m_array "array" 328 text m_add_object "addObject:" 329 text m_remove_range "removeObjectsInRange:" 330 text m_remove_key "removeObjectForKey:" 331 text m_all_keys "allKeys" 332 text m_number_double "numberWithDouble:" 333 text m_write_file "writeToFile:atomically:" 334 text k_at_key "at" 335 text k_path "path" 336 text x_env_record "HOPRECORD" 337 text s_memset "memset" 338 text s_trusted "AXIsProcessTrusted" 339 text s_key_event "CGEventCreateKeyboardEvent" 340 text s_event_flags "CGEventSetFlags" 341 text s_event_post "CGEventPost" 342 text s_cf_release "CFRelease" 343 text x_security "/usr/bin/security" 344 text x_find "find-generic-password" 345 text x_dash_s "-s" 346 text x_clip_service "com.aienos.hop.clipboard" 347 text x_dash_a "-a" 348 text x_clip_account "storage-key-v2" 349 text x_dash_w "-w" 350 text x_clipboard_file "/clipboard.bin" 351 text x_clip_images "/clip-images/" 352 text x_env_clipkey "HOPCLIPKEY" 353 text x_env_row "HOPROW" 354 text x_env_vault "HOPVAULT" 355 text x_env_cliprec "HOPCLIPREC" 356 text x_real_ssh "/usr/bin/ssh" 357 text x_nc "/usr/bin/nc" 358 text x_nc_args "-z|-G|2|127.0.0.1" 359 text m_probe_done "probeDone:" 360 text m_all_keys_for "allKeysForObject:" 361 text m_remove_for_key "removeObjectForKey:" 362 text m_note_object "object" 363 text m_is_equal_number "isEqualToNumber:" 364 text s_cf_true "kCFBooleanTrue" 365 text s_cf_false "kCFBooleanFalse" 366 text x_out16 " links " 367 text x_tunnel_args "-N|-o|ControlMaster=no|-o|ControlPath=none|-o|BatchMode=yes|-o|ExitOnForwardFailure=yes|-o|ServerAliveInterval=15|-o|ServerAliveCountMax=3|-o|ConnectTimeout=8|-L" 368 text x_loopback "127.0.0.1:" 369 text k_tunnels "tunnels" 370 text k_local_port "localPort" 371 text k_remote_port "remotePort" 372 text k_ssh_host "sshHost" 373 text k_cortex "cortex" 374 text k_enabled "enabled" 375 text k_url "url" 376 text k_host "host" 377 text m_url_port "port" 378 text m_is_executable "isExecutableFileAtPath:" 379 text m_all_values "allValues" 380 text s_will_terminate "NSApplicationWillTerminateNotification" 381 text m_app_quit "appQuit:" 382 text x_env_menu "HOPMENU" 383 text x_status_symbol "bolt.horizontal.circle" 384 text x_status_open "Open Hop Omega (Option Space)" 385 text x_status_index "Rebuild file index" 386 text x_status_paste "Allow paste into apps ..." 387 text x_status_login "Open at login" 388 text x_status_settings "Settings (edit config file) ..." 389 text x_status_clear "Clear clipboard history" 390 text x_key_comma "," 391 text x_menu_word "menu " 392 text c_status_bar "NSStatusBar" 393 text m_system_status_bar "systemStatusBar" 394 text m_status_item_length "statusItemWithLength:" 395 text m_button "button" 396 text m_set_image "setImage:" 397 text m_symbol_image "imageWithSystemSymbolName:accessibilityDescription:" 398 text m_set_target "setTarget:" 399 text m_set_state "setState:" 400 text m_separator "separatorItem" 401 text m_set_item_menu "setMenu:" 402 text m_item_array "itemArray" 403 text m_item_title "title" 404 text m_menu_open "menuOpen:" 405 text m_menu_index "menuIndex:" 406 text m_menu_paste "menuPaste:" 407 text m_menu_login "menuLogin:" 408 text m_menu_settings "menuSettings:" 409 text m_menu_clear "menuClear:" 410 text s_trusted_options "AXIsProcessTrustedWithOptions" 411 text s_trusted_prompt "kAXTrustedCheckOptionPrompt" 412 text x_sm_path "/System/Library/Frameworks/ServiceManagement.framework/ServiceManagement" 413 text c_sm_service "SMAppService" 414 text m_main_app "mainAppService" 415 text m_status "status" 416 text m_register "registerAndReturnError:" 417 text m_unregister "unregisterAndReturnError:" 418 text x_login_failed "Couldn't change Open at login" 419 text x_textedit "/System/Applications/TextEdit.app" 420 text c_open_config "NSWorkspaceOpenConfiguration" 421 text m_configuration "configuration" 422 text m_open_urls_with "openURLs:withApplicationAtURL:configuration:completionHandler:" 423 text x_empty_settings "{}" 424 text x_env_ssh "HOPSSH" 425 text x_env_scp "HOPSCP" 426 text x_env_late "HOPLATE" 427 text x_ssh_word "ssh" 428 text x_scp_word "scp" 429 text x_ssh_options " -o BatchMode=yes -o ConnectTimeout=8 " 430 text x_scp_options " -q -o BatchMode=yes " 431 text x_remote_a "d=~/.cache/hop/shards; [ -f $d/s00 ] || { echo HOP-NO-INDEX; exit 0; }; t=$(mktemp -d /dev/shm/hop.XXXXXX 2>/dev/null || mktemp -d); for s in $d/s*; do ( " 432 text x_remote_grep "LC_ALL=C grep -F -i -- " 433 text x_remote_shard " %%$s%%" 434 text x_remote_pipe " | " 435 text x_remote_b " | head -300 > %%$t/${s##*/}%% ) & done; wait; cat %%$t%%/*; rm -rf %%$t%%" 436 text x_local_a "( " 437 text x_local_b "; [ $? = 255 ] && echo HOP-UNREACHABLE ) 2>/dev/null | sed 's/^/" 438 text x_local_c ":/' &" 439 text x_wait_word "wait" 440 text x_build_a "cd ~/.cache/hop && find " 441 text x_build_b " -xdev ^^( -path '*/.*' -o " 442 text x_build_c " ^^) -prune -o -type d -printf '%p/^^n' -o -printf '%p^^n' > index.tmp 2>/dev/null && rm -rf shards.new && mkdir shards.new && split -n l/20 -d -a 2 index.tmp shards.new/s && rm -f index.tmp index.txt && rm -rf shards.old && { [ ! -d shards ] || mv shards shards.old; } && mv shards.new shards && rm -rf shards.old; rm -f index.tmp; rmdir ~/.cache/hop/building" 443 text x_name_flag "-name " 444 text x_or_flag " -o " 445 text x_fresh_a "mkdir -p ~/.cache/hop; f=~/.cache/hop/shards/s00" 446 text x_fresh_b "if [ -d ~/.cache/hop/building ] && [ -n %%$(find ~/.cache/hop/building -maxdepth 0 -mmin +180 2>/dev/null)%% ]; then rmdir ~/.cache/hop/building; fi" 447 text x_fresh_c "if [ ! -f $f ] || [ -n %%$(find $f -mmin +30 2>/dev/null)%% ]; then if mkdir ~/.cache/hop/building 2>/dev/null; then nohup nice -n 19 ionice -c3 sh -c " 448 text x_fresh_d " >/dev/null 2>&1 & fi; fi" 449 text x_fresh_e "echo ok" 450 text x_percents "%%" 451 text x_carets "^^" 452 text x_fetch_a "sz=$(" 453 text x_fetch_stat "stat -c %s -- " 454 text x_fetch_b ") && [ %%$sz%% -le `2000000000` ] && mkdir -p " 455 text x_fetch_c " && " 456 text x_fetch_d " && echo HOP-FETCHED" 457 text x_fetched "HOP-FETCHED" 458 text x_no_index "HOP-NO-INDEX" 459 text x_unreachable "HOP-UNREACHABLE" 460 text x_remote_cache "/Library/Caches/Hop/remote/" 461 text x_check_cache "/remote/" 462 text x_on " on " 463 text x_note_unreachable " is unreachable right now" 464 text x_note_building " is building its file list ..." 465 text x_note_bringing "Bringing it over from " 466 text x_note_copied "Copied the path on the clipboard: " 467 text x_note_failed "Could not bring it over; its path is on the clipboard: " 468 text x_out13 " fetched " 469 text x_out14 " machine " 470 text x_out15 " says " 471 text k_roots_m "roots" 472 text k_skip_m "skip" 473 text m_remote_go "remoteGo:" 474 text m_remote_done "remoteDone:" 475 text m_fetch_done "fetchDone:" 476 text m_read_to_end "readToEndOfFileInBackgroundAndNotify" 477 text s_read_to_end_done "NSFileHandleReadToEndOfFileCompletionNotification" 478 text m_cancel_previous "cancelPreviousPerformRequestsWithTarget:selector:object:" 479 text m_dir_of "stringByDeletingLastPathComponent" 480 text x_mskip0 ".git" 481 text x_mskip1 "node_modules" 482 text x_mskip2 "target" 483 text x_mskip3 "__pycache__" 484 text x_mskip4 "venv" 485 text x_mskip5 ".venv" 486 text x_mskip6 "site-packages" 487 text x_mskip7 "build" 488 text x_mskip8 "dist" 489 text x_mskip9 "proc" 490 text x_engine0 "Claude Code" 491 text x_engine0_command "claude|-p|{prompt}|--output-format|stream-json|--verbose" 492 text x_engine1 "Codex" 493 text x_engine1_command "codex|exec|--skip-git-repo-check|{prompt}" 494 text x_engine2 "Grok" 495 text x_engine2_command "grok|-p|{prompt}" 496 text x_engine3 "Gemini" 497 text x_engine3_command "gemini|-p|{prompt}" 498 text x_engine4 "OpenCode" 499 text x_engine4_command "opencode|run|{prompt}" 500 text x_engine5 "Cursor" 501 text x_engine5_command "cursor-agent|-p|--output-format|text|{prompt}" 502 text x_engine6 "Hermes" 503 text x_engine6_command "hermes|-z|{prompt}" 504 text x_old0_command "codex|exec|--skip-git-repo-check|--dangerously-bypass-approvals-and-sandbox|{prompt}" 505 text x_old1_command "grok|--always-approve|-p|{prompt}" 506 text x_old2_command "gemini|-y|-p|{prompt}" 507 text x_old3_command "cursor-agent|-p|-f|--output-format|text|{prompt}" 508 text x_old4_command "hermes|--yolo|-z|{prompt}" 509 text x_path0 ".local/bin" 510 text x_path1 ".claude/local" 511 text x_path2 "/opt/homebrew/bin" 512 text x_path3 "/usr/local/bin" 513 text x_path4 ".bun/bin" 514 text x_path5 ".npm-global/bin" 515 text x_path6 ".cargo/bin" 516 text x_path7 ".opencode/bin" 517 text x_path8 ".volta/bin" 518 text x_path9 ".asdf/shims" 519 text x_path10 ".local/share/mise/shims" 520 text x_path11 "bin" 521 text x_custom_command "Custom command" 522 text x_legacy_mark "HOP-LEGACY-COMMAND" 523 text x_zsh "/bin/zsh" 524 text x_dash_lc "-lc" 525 text x_wrapper "[ -n ~$HOP_EXTRA_PATH~ ] && PATH=~$PATH:$HOP_EXTRA_PATH~; unset HOP_EXTRA_PATH; exec ~$@~" 526 text x_tilde "~" 527 text x_hop_word "hop" 528 text x_sh "sh" 529 text x_dash_c "-c" 530 text x_probe_a "command -v " 531 text x_probe_b " >/dev/null 2>&1 && echo " 532 text x_true_word "true" 533 text x_term "TERM" 534 text x_dumb "dumb" 535 text x_no_color "NO_COLOR" 536 text x_one "1" 537 text x_extra_path "HOP_EXTRA_PATH" 538 text x_colon_only ":" 539 text x_nvm "/.nvm/versions/node" 540 text x_herd "/Library/Application Support/Herd/config/nvm/versions/node" 541 text x_slash_bin "/bin" 542 text x_prompt_mark "{prompt}" 543 text x_claude "claude" 544 text x_append_system "--append-system-prompt" 545 text x_resume "--resume" 546 text x_request "Request: " 547 text x_the_user "the user" 548 text x_brief_a "'s agent." 549 text x_brief_b " All machines = one box; never ask which. Mac = here. " 550 text x_brief_c " (auto-routed). Find files anywhere: hop find ." 551 text x_brief_d " Factory: " 552 text x_brief_e " Never delete agent files. Back up before destructive changes. Reply short, plain words." 553 text x_ssh_a ": ssh " 554 text x_ssh_b " ''" 555 text x_semi_space "; " 556 text x_period "." 557 text x_agent_row "Agent fixes it: " 558 text x_brace "{" 559 text x_bang "! " 560 text x_tool_word "tool" 561 text x_tool_mark "> " 562 text x_agent_error "agent error" 563 text x_agent_none_a "No coding agent was found on this Mac. Install one of these, sign in to it, then open Hop Omega again: " 564 text x_agent_none_b "No coding agent was found on this Mac. Add an agent command to Hop's settings." 565 text x_agent_missing_a " is set as your agent but is not installed on this Mac. Installed here: " 566 text x_agent_missing_b ". Name one of them as agentEngine in Hop's settings. Nothing was run." 567 text x_agent_stopped_a "Agent stopped (exit " 568 text x_agent_stopped_b ")." 569 text x_agent_working "The agent is working ..." 570 text x_agent_busy "The agent is still working on the last request. Nothing new was run." 571 text x_agent_ask "Let the agent work on this Mac?" 572 text x_agent_ask_more "It can read and change files on this Mac, with the command of Hop's settings. Hop Omega asks this once each time it is started, until Hop itself has been told yes." 573 text x_agent_yes "Run the agent" 574 text x_agent_no "Cancel" 575 text x_comma_space ", " 576 text x_paren_a " (" 577 text x_paren_b ")" 578 text x_screen2 "Agent" 579 text x_screen2_about "what the agent said" 580 text x_word_agent "agent" 581 text x_stop_item "Stop the Agent" 582 text x_key_period "." 583 text x_agent_menu "Agent" 584 text c_alert "NSAlert" 585 text m_set_message "setMessageText:" 586 text m_set_informative "setInformativeText:" 587 text m_add_button "addButtonWithTitle:" 588 text m_run_modal "runModal" 589 text c_center "NSNotificationCenter" 590 text m_default_center "defaultCenter" 591 text m_add_observer "addObserver:selector:name:object:" 592 text m_remove_all_observer "removeObserver:name:object:" 593 text s_read_done "NSFileHandleReadCompletionNotification" 594 text s_data_item "NSFileHandleNotificationDataItem" 595 text s_task_ended "NSTaskDidTerminateNotification" 596 text m_read_background "readInBackgroundAndNotify" 597 text m_user_info "userInfo" 598 text m_set_cwd "setCurrentDirectoryPath:" 599 text m_set_environment "setEnvironment:" 600 text m_set_input "setStandardInput:" 601 text m_environment "environment" 602 text m_mutable_copy "mutableCopy" 603 text m_terminate_task "terminate" 604 text m_is_equal_array "isEqualToArray:" 605 text m_range_of_data "rangeOfData:options:range:" 606 text m_subdata "subdataWithRange:" 607 text m_replace_bytes "replaceBytesInRange:withBytes:length:" 608 text m_append_data "appendData:" 609 text m_joined "componentsJoinedByString:" 610 text m_uppercase "uppercaseString" 611 text m_substring_from "substringFromIndex:" 612 text m_contents_of_dir "contentsOfDirectoryAtPath:error:" 613 text m_standard_compare "localizedStandardCompare:" 614 text m_newline_set "newlineCharacterSet" 615 text m_agent_out "agentOut:" 616 text m_agent_err "agentErr:" 617 text m_agent_end "agentEnd:" 618 text m_agent_stop "stopAgent:" 619 text k_engines "agentEngines" 620 text k_engine "agentEngine" 621 text k_agent_command "agentCommand" 622 text k_agent_folder "agentWorkingDirectory" 623 text k_enter_agent "enterSendsToAgent" 624 text k_agent_confirmed "agentConfirmed" 625 text k_keep_flags "keepAgentFlags" 626 text k_command "command" 627 text k_owner "ownerName" 628 text k_machines "machines" 629 text k_ssh "ssh" 630 text k_factory_url "factoryURL" 631 text k_type "type" 632 text k_parts_text "text" 633 text k_tool_use "tool_use" 634 text k_result "result" 635 text k_is_error "is_error" 636 text k_session_id "session_id" 637 text x_env_ask2 "HOPASK2" 638 text x_env_agents "HOPAGENTS" 639 text x_engine_word "engine " 640 text x_env_asknew "HOPASKNEW" 641 text m_array_adding "arrayByAddingObject:" 642 text m_remove_last "removeLastObject" 643 text x_assistant "assistant" 644 text x_you "You: " 645 text x_command3 "New chat" 646 text x_word_new_chat "new chat" 647 text x_word_clear_chat "clear chat" 648 text s_free "free" 649 text s_iopolicy "setiopolicy_np" 650 text s_home_directory "NSHomeDirectory" 651 text s_key_directory "NSURLIsDirectoryKey" 652 text s_key_package "NSURLIsPackageKey" 653 text s_key_link "NSURLIsSymbolicLinkKey" 654 text s_modified "NSFileModificationDate" 655 text c_process_info "NSProcessInfo" 656 text m_process_info "processInfo" 657 text m_arguments "arguments" 658 text c_bundle "NSBundle" 659 text m_main_bundle "mainBundle" 660 text m_executable_path "executablePath" 661 text m_drain "drain" 662 text c_set "NSSet" 663 text m_set_with_array "setWithArray:" 664 text m_enumerator "enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:" 665 text m_next_object "nextObject" 666 text m_get_resource "getResourceValue:forKey:error:" 667 text m_last_component "lastPathComponent" 668 text m_skip_descendants "skipDescendants" 669 text m_is_running "isRunning" 670 text m_attributes_of "attributesOfItemAtPath:error:" 671 text m_since_now "timeIntervalSinceNow" 672 text k_roots "indexRoots" 673 text k_skip_names "indexSkipNames" 674 text x_index_word "index" 675 text x_applications "/Applications" 676 text x_system_applications "/System/Applications" 677 text x_indexed "indexed " 678 text x_items " items" 679 text x_indexing " (indexing files ...)" 680 text x_command2 "Rebuild file index" 681 text x_word_rebuild "rebuild file index" 682 text x_word_reindex "reindex" 683 text x_word_index_files "index files" 684 text x_skipname0 "Library" 685 text x_skipname1 "node_modules" 686 text x_skipname2 ".git" 687 text x_skipname3 "target" 688 text x_skipname4 "build" 689 text x_skipname5 "dist" 690 text x_skipname6 "DerivedData" 691 text x_skipname7 "__pycache__" 692 text x_skipname8 "venv" 693 text x_skipname9 ".venv" 694 text x_skipname10 ".cache" 695 text x_skipname11 "Caches" 696 text x_skipname12 ".Trash" 697 text x_skipname13 "site-packages" 698 text x_skipname14 ".build" 699 text x_skipname15 "Pods" 700 text x_word0 "clipboard" 701 text x_word1 "copied" 702 text x_word2 "clipboard history" 703 text x_word3 "accounts" 704 text x_word4 "keys" 705 text x_word5 "api keys" 706 text x_word6 "passwords" 707 text x_word7 "logins" 708 text x_word8 "settings" 709 text x_word9 "preferences" 710 text x_word10 "config" 711 text x_word11 "hop settings" 712 text x_word12 "quit hop" 713 text x_screen0 "Clipboard" 714 text x_screen0_about "your copied things" 715 text x_screen1 "Accounts" 716 text x_screen1_about "your saved keys and logins" 717 text x_command0 "Settings" 718 text x_command0_about "opens Hop's settings file" 719 text x_command1 "Quit Hop Omega" 720 text x_copied_things " copied things" 721 text x_accounts_word " accounts" 722 text x_pinned "pinned" 723 text x_env_screen "HOPSCREEN" 724 text x_env_clipdo "HOPCLIPDO" 725 text x_clip_menu "Clipboard" 726 text x_pin_item "Pin or Unpin" 727 text x_delete_item "Delete from History" 728 text x_key_p "p" 729 text x_key_d "d" 730 text m_pin_clip "pinClip:" 731 text m_delete_clip "deleteClip:" 732 text x_out12 " screen " 733 text s_random "arc4random_buf" 734 text c_uuid "NSUUID" 735 text m_uuid "UUID" 736 text m_uuid_string "UUIDString" 737 text c_timer "NSTimer" 738 text m_timer "scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:" 739 text m_clip_tick "clipTick:" 740 text m_change_count "changeCount" 741 text m_types "types" 742 text m_contains_object "containsObject:" 743 text c_image "NSImage" 744 text m_init_pasteboard "initWithPasteboard:" 745 text m_tiff "TIFFRepresentation" 746 text c_bitmap "NSBitmapImageRep" 747 text m_rep_with_data "imageRepWithData:" 748 text m_rep_using "representationUsingType:properties:" 749 text m_running_with "runningApplicationsWithBundleIdentifier:" 750 text x_hop_id "com.aienos.hop" 751 text k_id "id" 752 text k_source "sourceApp" 753 text k_limit "clipboardLimit" 754 text m_insert_at "insertObject:atIndex:" 755 text m_remove_at "removeObjectAtIndex:" 756 text m_byte_length "lengthOfBytesUsingEncoding:" 757 text c_mutable_data "NSMutableData" 758 text m_data "data" 759 text m_append_bytes "appendBytes:length:" 760 text c_file_manager "NSFileManager" 761 text m_default_manager "defaultManager" 762 text m_file_exists "fileExistsAtPath:" 763 text m_remove_item "removeItemAtPath:error:" 764 text m_create_dir "createDirectoryAtPath:withIntermediateDirectories:attributes:error:" 765 text x_clip_backup "/clipboard.before-hop-omega.bin" 766 text x_dot_bin ".bin" 767 text x_skip0 "org.nspasteboard.ConcealedType" 768 text x_skip1 "org.nspasteboard.TransientType" 769 text x_skip2 "org.nspasteboard.AutoGeneratedType" 770 text x_skip3 "com.agilebits.onepassword" 771 text x_skip4 "com.typeit4me.clipping" 772 text x_skip5 "de.petermaurer.TransientPasteboardType" 773 text x_env_vault_add "HOPVAULTADD" 774 text s_item_add "SecItemAdd" 775 text s_item_delete "SecItemDelete" 776 text s_interaction "SecKeychainSetUserInteractionAllowed" 777 text s_value_data "kSecValueData" 778 text s_accessible "kSecAttrAccessible" 779 text s_accessible_unlocked "kSecAttrAccessibleWhenUnlockedThisDeviceOnly" 780 text m_data_using "dataUsingEncoding:" 781 text x_semicolon ";" 782 text x_bar "|" 783 text x_vault_service "com.aienos.hop.vault" 784 text s_item_copy "SecItemCopyMatching" 785 text s_class "kSecClass" 786 text s_class_generic "kSecClassGenericPassword" 787 text s_attr_service "kSecAttrService" 788 text s_attr_account "kSecAttrAccount" 789 text s_attr_description "kSecAttrDescription" 790 text s_attr_comment "kSecAttrComment" 791 text s_match_limit "kSecMatchLimit" 792 text s_limit_all "kSecMatchLimitAll" 793 text s_limit_one "kSecMatchLimitOne" 794 text s_return_attributes "kSecReturnAttributes" 795 text s_return_data "kSecReturnData" 796 text s_true "kCFBooleanTrue" 797 text m_sorted "sortedArrayUsingSelector:" 798 text m_compare "compare:" 799 text m_has_prefix "hasPrefix:" 800 text m_declare_types "declareTypes:owner:" 801 text x_type_concealed "org.nspasteboard.ConcealedType" 802 text x_bearer "Bearer " 803 text x_authorization "Authorization" 804 text x_no_key "[The key of this model could not be read from the Keychain]" 805 text x_check_board "com.aienos.hop.omega.check" 806 text c_task "NSTask" 807 text c_pipe "NSPipe" 808 text c_file_handle "NSFileHandle" 809 text c_pasteboard "NSPasteboard" 810 text c_charset "NSCharacterSet" 811 text m_set_launch "setLaunchPath:" 812 text m_set_arguments "setArguments:" 813 text m_pipe "pipe" 814 text m_set_output "setStandardOutput:" 815 text m_set_error "setStandardError:" 816 text m_null_device "fileHandleWithNullDevice" 817 text m_launch "launch" 818 text m_reading "fileHandleForReading" 819 text m_read_end "readDataToEndOfFile" 820 text m_wait "waitUntilExit" 821 text m_termination "terminationStatus" 822 text m_init_data_encoding "initWithData:encoding:" 823 text m_trim "stringByTrimmingCharactersInSet:" 824 text m_whitespace "whitespaceAndNewlineCharacterSet" 825 text m_init_base64 "initWithBase64EncodedString:options:" 826 text m_general_pasteboard "generalPasteboard" 827 text m_board_named "pasteboardWithName:" 828 text m_clear "clearContents" 829 text m_set_string_type "setString:forType:" 830 text m_set_data_type "setData:forType:" 831 text m_string_for_type "stringForType:" 832 text m_data_for_type "dataForType:" 833 text m_lowercase "lowercaseString" 834 text m_contains "containsString:" 835 text m_components "componentsSeparatedByString:" 836 text m_replace "stringByReplacingOccurrencesOfString:withString:" 837 text m_composed_at "rangeOfComposedCharacterSequenceAtIndex:" 838 text m_bool_value "boolValue" 839 text m_release "release" 840 text m_perform_after "performSelector:withObject:afterDelay:" 841 text m_paste_now "pasteNow:" 842 text x_type_string "public.utf8-plain-text" 843 text x_type_png "public.png" 844 text k_text "text" 845 text k_image "imageFile" 846 text k_pinned "pinned" 847 text k_date "date" 848 text x_image "Image" 849 text x_image_low "image" 850 text x_space " " 851 text x_paste_row "Paste: " 852 text x_why1 "You just copied this" 853 text x_why2 "The last thing you copied" 854 text x_why3 "You copied a web address" 855 text x_out11 " pasted " 856 text x_png_word "png " 857 text x_browser0 "com.apple.Safari" 858 text x_browser1 "com.google.Chrome" 859 text x_browser2 "com.brave.Browser" 860 text x_browser3 "org.mozilla.firefox" 861 text x_browser4 "company.thebrowser.Browser" 862 text x_browser5 "com.microsoft.edgemac" 863 text x_browser6 "com.operasoftware.Opera" 864 text x_browser7 "com.vivaldi.Vivaldi" 865 text x_browser8 "app.zen-browser.zen" 866 text x_of " of " 867 text x_apps " apps" 868 text x_slash "/" 869 text x_dotapp ".app" 870 text x_env "HOPCHECK" 871 872 note g_f: library functions. 0 objc_getClass 1 sel_registerName 2 objc_msgSend 3 write 4 objc_allocateClassPair 873 note 5 class_addMethod 6 objc_registerClassPair 7 strlen 8 memcpy 9 getenv 10 malloc 11 memmem 12 memchr 13 memrchr 874 note 14 pow 15 log2 16 chmod 17 memset 18 AXIsProcessTrusted 19 CGEventCreateKeyboardEvent 20 CGEventSetFlags 875 note 21 CGEventPost 22 CFRelease 23 SecItemCopyMatching 24 SecItemAdd 25 SecItemDelete 876 note 26 SecKeychainSetUserInteractionAllowed 27 arc4random_buf 28 free 29 setiopolicy_np 30 NSHomeDirectory 877 global g_f ulong 32 878 note g_o: objects and selectors the callbacks need. 0 field 1 table 2 status line 3 NSString 4 stringWithUTF8String: 879 note 5 UTF8String 6 stringValue 7 reloadData 8 setStringValue: 9 moveDown: 10 moveUp: 11 cancelOperation: 880 note 12 selectRowIndexes:byExtendingSelection: 13 NSIndexSet 14 indexSetWithIndex: 15 scrollRowToVisible: 881 note 16 NSURL 17 URLWithString: 18 host 19 the window 20 orderOut: 21 the application 22 hide: 882 note 23 activateIgnoringOtherApps: 24 makeKeyAndOrderFront: 25 makeFirstResponder: 26 orderFrontRegardless 883 note 27 the object whose methods are the callbacks 28 the list's scroll view 29 the answer's scroll view 884 note 30 the answer's text view 885 global g_o ulong 32 886 note g_n: 0 apps 1 shown 2 bytes of names 3 times the action ran 4 length of the typed text 5 1 to end the program 887 note 6 the selected row 7 1 when Enter may open the row 8 the row Enter chose, plus 1 9 what the workspace answered 888 note 10 the typed text as a web address (0 it is none, 1 written with its scheme, 2 a bare address) 12 where the 889 note typed text starts once blanks are trimmed 13 its length then 14 1 when the program stays (no HOPCHECK) 890 note 15 what registering the hot key gave (0 it is registered) 16 the words of the typed text 17 the files found 891 note 18 1 when a file has exactly the typed text as its name 19 bytes of the answer waiting in g_net 892 note 20 1 when an answer is on show 21 1 when the model's answer has ended 22 1 when a piece of it came 893 note 23 1 when the check asks for what is chosen to be remembered without being opened 24 the count of copied 894 note things 25 the bytes of the newest one's text when it may be a web address 26 its address kind 27 the count 895 note of other copied things offered 28 the count of copied things that match the typed text 29 what the check 896 note pasted (1 text, 2 a picture) 30 the row the check chooses before Enter (0: the first) 31 the count of 897 note saved accounts 32 the place plus 1 of the app that was in front before the one in front now 898 note 33 1 once the history was set aside before this run's first change to it 34 how many unpinned copied 899 note things are kept 35 the clipboard's change count last seen 36 the screen the list shows (0 everything, 900 note 1 the copied things, 2 the saved accounts) 37 what a check does to the selected copied thing (1 pin or 901 note unpin, 2 delete) 38 half seconds since the file index was last looked at 902 note 39 1 when the answer on show belongs to a turn that has ended 40 1 when that turn failed 41 1 when the 903 note typed text reads as a question 42 1 when Hop's settings send a sentence to the agent on Enter 43 1 while 904 note the agent runs 44 1 once the person said yes to the agent 45 1 once the agents on this Mac were looked 905 note for 46 1 when a check sends what it types to the agent 47 what of the agent's run has ended (1 its 906 note output, 2 the program) 48 the turn at which a check sends Enter 49 the count of files found on other 907 note machines 50 the bytes of what the machines answered 51 what to say about a machine (1 unreachable, 2 building 908 note its list, 3 a file is on its way, 4 a path was copied, 5 a file could not be brought) 52 which machine 909 note 53 the bytes of the text the machines were asked for 54 the count of machines 55 1 when a check's file 910 note arrived 56 the machine and 57 the found file that is on its way 58 1 when a file found on a machine has exactly the typed name 911 note 59 1 when other machines may be reached 60 half seconds since the forwarded ports were last looked at 912 note 61 how many links this program has started 62 how many forwarded ports the settings name 913 global g_n ulong 64 914 note g_t: the text HOPCHECK=open:TEXT asks to type 915 global g_t uchar 64 916 global g_rg uchar 128 917 global g_nm uchar 1024 918 global g_pool uchar 65536 919 global g_off ulong 2048 920 global g_ln ulong 2048 921 global g_hit ulong 2048 922 note g_hit: the app of each row; g_rk: the kind of each row (1 an app, 2 the web address); g_dir: the folder each 923 note app is in (0 /Applications, 1 /System/Applications); g_mk and g_ms: the apps hopfuzz matched and their scores 924 global g_rk uchar 2048 925 global g_dir uchar 2048 926 global g_mk ulong 2048 927 global g_ms ulong 2048 928 global g_q uchar 256 929 note g_x: the first row's text, kept for the check's line 930 global g_x uchar 256 931 note g_ev: the hot key's event type (class 'keyb', kind 5 pressed) and, from byte 8, the reference Carbon gives back 932 global g_ev uchar 16 933 note The file index. g_fb: 0 where its bytes are (paths, a line each), 1 where the lower-case copy is, 2 how many 934 note bytes, 3 1 when it is loaded, 4 the object that holds the bytes. g_chunk: a piece of it on its way to lower case. g_line: one path, lower case. 935 note g_lq: the typed text, lower case; g_to and g_tl: where each of its words starts and how long it is. 936 note g_fs, g_fo, g_fl: the best 40 files, best first: score plus 100000, where the path starts, how long it is 937 global g_fb ulong 8 938 note The model. g_m: 0 its id, 1 the address to post to, 2 its name (three NSStrings), 3 1 when there is one, 939 note 4 the answer so far (an NSMutableString), 5 the session, 6 the running task, 7 NSDictionary, 8 NSArray, 940 note 9 NSString (the classes, to tell what a JSON value is), 10 each app's path and its place (a dictionary), 941 note 11 the id of the app in front when the panel was last shown, 12 its name, 13 its place among the apps plus 1, 942 note 14 the copied things (an array, newest first), 15 the text each one is shown by, 16 objectAtIndex:, 943 note 18 the names of the saved accounts in order, 19 what each is (its kind and note), 20 the Keychain service 944 note they are under, 21 the name of the account that holds the model's key (nothing: it needs none), 22 the 945 note accounts a check made for itself (an array of their names), to be deleted when it ends, 23 the program 946 note that is building the file index now (nothing: none), 24 the conversation with the model (an array of 947 note messages, each a role and a content), 25 what was said before the answer on show (a text), 26 the agent's 948 note program while it runs, 27 where its output is read, 28 the agents of Hop's settings (each a name and a 949 note command), 29 the name of the one to use, 30 the folder it works in, 31 the older single command, 32 its 950 note output not yet a whole line, 33 the id of its last run (to carry on from), 34 the settings (for the 951 note agent's standing instructions), 35 the agents found on this Mac, 36 when the agent last worked (a number 952 note object), 37 where its errors are read, 38 to 41 the selectors agentOut: agentErr: agentEnd: stopAgent:, 953 note 42 the ssh names of the machines (an array), 43 the program asking the machines, 44 where its answer is 954 note read, 45 the program bringing a file over, 46 to 48 the selectors remoteGo: remoteDone: fetchDone:, 955 note 49 where the fetch's answer is read, 50 where the file that is on its way lands (a path), 51 its 956 note machine's ssh name and path, for the clipboard, 52 the icon in the menu bar, 53 its Open at login item, 957 note 54 to 59 the selectors menuOpen: menuIndex: menuPaste: menuLogin: menuSettings: menuClear:, 958 note 60 the forwarded ports to keep open (each: this Mac's port, the far port, the ssh name), 61 the programs 959 note that hold them open (by this Mac's port), 62 the selector appQuit:, 63 the programs asking whether a port 960 note is served (by the port), 64 the selector probeDone:. 961 note g_net: bytes from the server not yet read as lines 962 global g_m ulong 80 963 global g_net uchar 262144 964 note What is offered before anything is typed. g_so: the apps in the order of their paths; g_lf, g_lh: each app's 965 note lift from the app in front and from the hour; g_us: how much it is used; g_rn: 1 when it is running; 966 note g_fr: the apps that were in front when the panel was shown, newest first (place plus 1); g_why: why each 967 note row is offered 968 global g_so ulong 2048 969 global g_lf ulong 2048 970 global g_lh ulong 2048 971 global g_us ulong 2048 972 global g_rn uchar 2048 973 global g_fr ulong 12 974 global g_why uchar 2048 975 note Copied things. g_ci: all of them in the order they are searched (the pinned ones first); g_cp: 1 for a 976 note pinned one; g_cr: the others offered before anything is typed; g_cm: the ones that match the typed text; 977 note g_ca: the newest one's text, kept while it may be a web address 978 global g_ci ulong 1024 979 global g_cp uchar 1024 980 global g_cr ulong 20 981 global g_cm ulong 1024 982 global g_ca uchar 256 983 note eight bytes a library function writes a pointer into 984 global g_t8 uchar 8 985 note Files on other machines. g_rb: what the machines answered (lines "K:path", K the machine's number); g_rq: 986 note the text they were asked for; g_ro, g_rl, g_rs, g_rw: the best 64 found, best first (where the path starts in 987 note g_rb, its length, its score plus 100000, its machine); g_mn and g_ml: the machines' names 988 global g_rb uchar `1048576` 989 global g_rq uchar 256 990 global g_ro ulong 64 991 global g_rl ulong 64 992 global g_rs ulong 64 993 global g_rw uchar 64 994 global g_mn uchar 640 995 global g_ml uchar 10 996 note the byte that ends a line of the file index 997 global g_nl uchar 1 998 global g_chunk uchar 524288 999 global g_line uchar 4096 1000 global g_lq uchar 256 1001 global g_to ulong 16 1002 global g_tl ulong 16 1003 global g_fs ulong 64 1004 global g_fo ulong 64 1005 global g_fl ulong 64 1006 1007 note ---- the core of Hop, from Omega/hopcore.om ---- 1008 fn isword w ulong to bool 1009 ret ne and w `4294967296` 0 1010 end 1011 1012 fn istrim w ulong to bool 1013 ret ne and w `8589934592` 0 1014 end 1015 1016 fn minu a ulong b ulong to ulong 1017 if lt a b 1018 ret a 1019 end 1020 ret b 1021 end 1022 1023 note true when inp[a .. a+n) equals inp[b .. b+n); both runs must lie inside the buffer 1024 fn same inp view ulong 256 a ulong b ulong n ulong to bool 1025 for k ulong n 1026 if ne get inp add a k get inp add b k 1027 ret false 1028 end 1029 end 1030 ret true 1031 end 1032 1033 note x is one longer than y (ls characters): true when dropping one character of x gives y 1034 fn skip1 inp view ulong 256 x ulong y ulong ls ulong to bool 1035 k = ulong 0 1036 while lt k ls bound 256 1037 if ne get inp add x k get inp add y k 1038 break 1039 end 1040 k = add k 1 1041 end 1042 ret same inp add x add k 1 add y k sub ls k 1043 end 1044 1045 note edit distance at most 1, where swapping two neighbours counts as one 1046 fn near inp view ulong 256 a ulong la ulong b ulong lb ulong to bool 1047 if eq la lb 1048 d = ulong 0 1049 p = ulong 0 1050 for k ulong la 1051 if ne get inp add a k get inp add b k 1052 if eq d 0 1053 p = k 1054 end 1055 d = add d 1 1056 end 1057 end 1058 if le d 1 1059 ret true 1060 end 1061 if eq d 2 1062 if lt add p 1 la 1063 if eq get inp add a p get inp add b add p 1 1064 if eq get inp add a add p 1 get inp add b p 1065 ret true 1066 end 1067 end 1068 end 1069 end 1070 ret false 1071 end 1072 if eq la add lb 1 1073 ret skip1 inp a b lb 1074 end 1075 if eq lb add la 1 1076 ret skip1 inp b a la 1077 end 1078 ret false 1079 end 1080 1081 note score of q = inp[qa .. qa+ql) in the name inp[72 .. 72+nl); 0 means no match. ql and nl >= 1 1082 fn one inp view ulong 256 qa ulong ql ulong nl ulong to ulong 1083 if le ql nl 1084 if same inp qa 72 ql 1085 if eq ql nl 1086 ret 200 1087 end 1088 ret sub 160 minu 30 sub nl ql 1089 end 1090 end 1091 qw = true 1092 for k ulong ql 1093 if not isword get inp add qa k 1094 qw = false 1095 end 1096 end 1097 wc = ulong 0 1098 later = false 1099 inits = true 1100 inw = false 1101 for i ulong nl 1102 c = get inp add 72 i 1103 if isword c 1104 if not inw 1105 if lt wc ql 1106 if ne c get inp add qa wc 1107 inits = false 1108 end 1109 end 1110 if gt wc 0 1111 if qw 1112 if le add i ql nl 1113 if same inp qa add 72 i ql 1114 later = true 1115 end 1116 end 1117 end 1118 end 1119 wc = add wc 1 1120 end 1121 inw = true 1122 else 1123 inw = false 1124 end 1125 end 1126 if later 1127 ret sub 120 minu 20 div nl 3 1128 end 1129 if ge ql 2 1130 if gt wc 1 1131 if ge wc ql 1132 if inits 1133 ret 110 1134 end 1135 end 1136 end 1137 end 1138 if le ql nl 1139 for i ulong add sub nl ql 1 1140 if same inp qa add 72 i ql 1141 ret sub 80 minu 20 div nl 3 1142 end 1143 end 1144 end 1145 if ge ql 4 1146 if le ql nl 1147 if near inp qa ql 72 ql 1148 ret 70 1149 end 1150 end 1151 if le sub ql 1 nl 1152 if near inp qa ql 72 sub ql 1 1153 ret 70 1154 end 1155 end 1156 if le add ql 1 nl 1157 if near inp qa ql 72 add ql 1 1158 ret 70 1159 end 1160 end 1161 end 1162 if lt ql 3 1163 ret 0 1164 end 1165 qi = ulong 0 1166 gaps = ulong 0 1167 last = ulong 0 1168 first = ulong 0 1169 for i ulong nl 1170 if lt qi ql 1171 if eq get inp add 72 i get inp add qa qi 1172 if gt qi 0 1173 gaps = add gaps sub sub i last 1 1174 else 1175 first = i 1176 end 1177 last = i 1178 qi = add qi 1 1179 end 1180 end 1181 end 1182 if ne qi ql 1183 ret 0 1184 end 1185 if gt gaps ql 1186 ret 0 1187 end 1188 t = add mul gaps 6 mul first 3 1189 if ge t 45 1190 ret 15 1191 end 1192 ret sub 60 t 1193 end 1194 1195 note first faulting word plus 1, or 0 when the input is well formed 1196 fn check inp view ulong 256 to ulong 1197 if ne get inp 0 `1212568922` 1198 ret 1 1199 end 1200 if ne get inp 1 1 1201 ret 2 1202 end 1203 ql = get inp 2 1204 nl = get inp 3 1205 if gt ql 64 1206 ret 3 1207 end 1208 if gt nl 184 1209 ret 4 1210 end 1211 for i ulong 4 1212 if ne get inp add 4 i 0 1213 ret add 5 i 1214 end 1215 end 1216 for i ulong 64 1217 w = get inp add 8 i 1218 if lt i ql 1219 if ge w `17179869184` 1220 ret add 9 i 1221 end 1222 if eq and w `4294967295` 0 1223 ret add 9 i 1224 end 1225 else 1226 if ne w 0 1227 ret add 9 i 1228 end 1229 end 1230 end 1231 for i ulong 184 1232 w = get inp add 72 i 1233 if lt i nl 1234 if ge w `17179869184` 1235 ret add 73 i 1236 end 1237 if eq and w `4294967295` 0 1238 ret add 73 i 1239 end 1240 else 1241 if ne w 0 1242 ret add 73 i 1243 end 1244 end 1245 end 1246 ret 0 1247 end 1248 1249 fn hopfuzz inp view ulong 256 res edit ulong 256 to ulong 1250 for i ulong 256 1251 put res i 0 1252 end 1253 put res 0 `1212568922` 1254 put res 1 1 1255 e = check inp 1256 if ne e 0 1257 put res 2 2 1258 put res 4 sub e 1 1259 ret 2 1260 end 1261 nl = get inp 3 1262 qa = ulong 8 1263 qe = add 8 get inp 2 1264 while lt qa qe bound 256 1265 if not istrim get inp qa 1266 break 1267 end 1268 qa = add qa 1 1269 end 1270 while gt qe qa bound 256 1271 if not istrim get inp sub qe 1 1272 break 1273 end 1274 qe = sub qe 1 1275 end 1276 ql = sub qe qa 1277 if eq ql 0 1278 ret 0 1279 end 1280 if eq nl 0 1281 ret 0 1282 end 1283 s = one inp qa ql nl 1284 if eq s 0 1285 terms = ulong 0 1286 sum = ulong 0 1287 p = qa 1288 while lt p qe bound 256 1289 if eq and get inp p `4294967295` 32 1290 p = add p 1 1291 continue 1292 end 1293 b = p 1294 while lt p qe bound 256 1295 if eq and get inp p `4294967295` 32 1296 break 1297 end 1298 p = add p 1 1299 end 1300 ts = one inp b sub p b nl 1301 if eq ts 0 1302 ret 0 1303 end 1304 terms = add terms 1 1305 sum = add sum ts 1306 end 1307 if le terms 1 1308 ret 0 1309 end 1310 s = sub div sum terms 10 1311 end 1312 put res 2 1 1313 put res 3 s 1314 ret 1 1315 end 1316 1317 note ---- file-name scoring (kind 2): how well a path found on another machine matches the typed terms ---- 1318 note The host sends bytes: the terms, and for each path its lowercased bytes, the lowercased bytes of its last 1319 note component (its name), and the byte length of the path as written. A term found in the name scores 60 when the name 1320 note starts with it and 30 otherwise; found only elsewhere in the path it scores 5; a term found nowhere, or an 1321 note empty term, means no match. One point less for every 20 bytes of path; 40 more when the name is exactly as long as the terms. 1322 1323 fn rd16 b view uchar `1048576` o ulong to ulong 1324 ret or ulong get b o shl ulong get b add o 1 8 1325 end 1326 1327 fn rd32 b view uchar `1048576` o ulong to ulong 1328 ret or rd16 b o shl rd16 b add o 2 16 1329 end 1330 1331 note true when b[x .. x+n) equals b[y .. y+n) 1332 fn beq b view uchar `1048576` x ulong y ulong n ulong to bool 1333 for k ulong n 1334 if ne get b add x k get b add y k 1335 ret false 1336 end 1337 end 1338 ret true 1339 end 1340 1341 note true when the run b[t .. t+tl) occurs in b[h .. h+hl) 1342 fn bhas b view uchar `1048576` h ulong hl ulong t ulong tl ulong to bool 1343 if gt tl hl 1344 ret false 1345 end 1346 for i ulong add sub hl tl 1 1347 if beq b add h i t tl 1348 ret true 1349 end 1350 end 1351 ret false 1352 end 1353 1354 note score of one path plus `1000000`, or 0 for no match. pm: 0 the number of terms, 1 where the path's bytes 1355 note start, 2 how many, 3 where its name's bytes start, 4 how many, 5 the path's length as written 1356 fn fscore b view uchar `1048576` toff view ulong 64 tlen view ulong 64 pm view ulong 8 to ulong 1357 nt = get pm 0 1358 p = get pm 1 1359 pl = get pm 2 1360 ns = get pm 3 1361 nl = get pm 4 1362 ol = get pm 5 1363 s = ulong `1000000` 1364 sum = ulong 0 1365 for k ulong nt 1366 t = get toff k 1367 tl = get tlen k 1368 sum = add sum tl 1369 if eq tl 0 1370 ret 0 1371 end 1372 if bhas b ns nl t tl 1373 if beq b ns t tl 1374 s = add s 60 1375 else 1376 s = add s 30 1377 end 1378 else 1379 if bhas b p pl t tl 1380 s = add s 5 1381 else 1382 ret 0 1383 end 1384 end 1385 end 1386 s = sub s div ol 20 1387 if eq nl sum 1388 s = add s 40 1389 end 1390 ret s 1391 end 1392 1393 note ---- text decisions (kind 3): is it a question, which words to search for, is it a web address ---- 1394 note The host lowercases the text and sends one 8-byte word per character: bits 0..31 an id (equal characters get 1395 note equal ids; a character of one Unicode scalar has that scalar's number), then a flag byte: 1 letter or number, 1396 note 2 trimmable white space, 4 white space, 8 white space or line end. 1397 note lists: three lists of plain words, separated by "|": 0 the words a question starts with, 1 the words a search 1398 note leaves out, 2 the endings of a bare web address. 1399 text lists "what what's whats why how how's who who's whom whose when where which explain define translate summarize summarise describe|the and for with that this what when where does did how why can you are was were have has from into about please make need want just our my its not|com org net io dev ai co edu gov xyz me us uk ca de tv gg" 1400 1401 fn cid b view uchar `1048576` i ulong to ulong 1402 ret rd32 b add 16 mul i 8 1403 end 1404 1405 fn cfl b view uchar `1048576` i ulong to ulong 1406 ret ulong get b add 20 mul i 8 1407 end 1408 1409 note true when the n characters from s are exactly one word of list sec 1410 fn inlist b view uchar `1048576` s ulong n ulong sec ulong to bool 1411 cur = ulong 0 1412 p = ulong 0 1413 ln = len lists 1414 while lt p ln bound 999999 1415 e = p 1416 while lt e ln bound 999999 1417 c = ulong get lists e 1418 if or eq c 32 eq c 124 1419 break 1420 end 1421 e = add e 1 1422 end 1423 if eq cur sec 1424 if eq sub e p n 1425 ok = true 1426 for k ulong n 1427 if ne cid b add s k ulong get lists add p k 1428 ok = false 1429 end 1430 end 1431 if ok 1432 ret true 1433 end 1434 end 1435 end 1436 if lt e ln 1437 if eq ulong get lists e 124 1438 cur = add cur 1 1439 end 1440 end 1441 p = add e 1 1442 end 1443 ret false 1444 end 1445 1446 note op 1: 1 when the text reads as a question: it ends with "?" and is longer than that, or it has three words 1447 note or more and starts with a question word 1448 fn qlike b view uchar `1048576` n ulong to ulong 1449 a = ulong 0 1450 e = n 1451 while lt a e bound 999999 1452 if eq and cfl b a 8 0 1453 break 1454 end 1455 a = add a 1 1456 end 1457 while gt e a bound 999999 1458 if eq and cfl b sub e 1 8 0 1459 break 1460 end 1461 e = sub e 1 1462 end 1463 if gt sub e a 1 1464 if eq cid b sub e 1 63 1465 ret 1 1466 end 1467 end 1468 w = ulong 0 1469 fs = ulong 0 1470 fl = ulong 0 1471 i = a 1472 while lt i e bound 999999 1473 if ne and cfl b i 4 0 1474 i = add i 1 1475 continue 1476 end 1477 st = i 1478 while lt i e bound 999999 1479 if ne and cfl b i 4 0 1480 break 1481 end 1482 i = add i 1 1483 end 1484 if eq w 0 1485 fs = st 1486 fl = sub i st 1487 end 1488 w = add w 1 1489 end 1490 if lt w 3 1491 ret 0 1492 end 1493 if inlist b fs fl 0 1494 ret 1 1495 end 1496 ret 0 1497 end 1498 1499 note a character of a search word: a letter, a number, "-", "_" or "." 1500 fn iswc b view uchar `1048576` i ulong to bool 1501 if ne and cfl b i 1 0 1502 ret true 1503 end 1504 c = cid b i 1505 if eq c 45 1506 ret true 1507 end 1508 if eq c 95 1509 ret true 1510 end 1511 ret eq c 46 1512 end 1513 1514 fn samec b view uchar `1048576` x ulong y ulong n ulong to bool 1515 for k ulong n 1516 if ne cid b add x k cid b add y k 1517 ret false 1518 end 1519 end 1520 ret true 1521 end 1522 1523 note true when the word of wl characters at st also stands earlier in the text 1524 fn seen b view uchar `1048576` st ulong wl ulong to bool 1525 i = ulong 0 1526 while lt i st bound 999999 1527 if not iswc b i 1528 i = add i 1 1529 continue 1530 end 1531 s0 = i 1532 while lt i st bound 999999 1533 if not iswc b i 1534 break 1535 end 1536 i = add i 1 1537 end 1538 if eq sub i s0 wl 1539 if samec b s0 st wl 1540 ret true 1541 end 1542 end 1543 end 1544 ret false 1545 end 1546 1547 note op 2: the words to search for: three characters or more, not a left-out word, each once, the longest four, 1548 note longest first and in the order typed among equals. Writes the count, then where each starts and its length 1549 fn keyw b view uchar `1048576` n ulong ob edit uchar 65544 to ulong 1550 ts = new ulong 4 0 1551 tl = new ulong 4 0 1552 k = ulong 0 1553 i = ulong 0 1554 while lt i n bound 999999 1555 if not iswc b i 1556 i = add i 1 1557 continue 1558 end 1559 st = i 1560 while lt i n bound 999999 1561 if not iswc b i 1562 break 1563 end 1564 i = add i 1 1565 end 1566 wl = sub i st 1567 if lt wl 3 1568 continue 1569 end 1570 if inlist b st wl 1 1571 continue 1572 end 1573 if seen b st wl 1574 continue 1575 end 1576 pos = k 1577 for j ulong k 1578 if lt get tl j wl 1579 if eq pos k 1580 pos = j 1581 end 1582 end 1583 end 1584 if lt pos 4 1585 for d ulong sub 3 pos 1586 u = sub 3 d 1587 put tl u get tl sub u 1 1588 put ts u get ts sub u 1 1589 end 1590 put tl pos wl 1591 put ts pos st 1592 if lt k 4 1593 k = add k 1 1594 end 1595 end 1596 end 1597 put ob 8 uchar k 1598 for j ulong k 1599 s = get ts j 1600 l = get tl j 1601 put ob add 9 mul j 4 uchar and s 255 1602 put ob add 10 mul j 4 uchar shr s 8 1603 put ob add 11 mul j 4 uchar and l 255 1604 put ob add 12 mul j 4 uchar shr l 8 1605 end 1606 ret add 1 mul k 4 1607 end 1608 1609 fn hasscheme b view uchar `1048576` n ulong to bool 1610 if lt n 7 1611 ret false 1612 end 1613 if ne cid b 0 104 1614 ret false 1615 end 1616 if ne cid b 1 116 1617 ret false 1618 end 1619 if ne cid b 2 116 1620 ret false 1621 end 1622 if ne cid b 3 112 1623 ret false 1624 end 1625 o = ulong 4 1626 if eq cid b 4 115 1627 o = ulong 5 1628 end 1629 if lt n add o 3 1630 ret false 1631 end 1632 if ne cid b o 58 1633 ret false 1634 end 1635 if ne cid b add o 1 47 1636 ret false 1637 end 1638 ret eq cid b add o 2 47 1639 end 1640 1641 note op 3: 0 not a web address; 1 it starts with http:// or https:// (the host then checks that it names a 1642 note machine); 2 a bare address such as example.com/page (the host then checks that it parses). aux: the text's 1643 note length in bytes as written 1644 fn weba b view uchar `1048576` n ulong aux ulong to ulong 1645 if eq n 0 1646 ret 0 1647 end 1648 if ge aux 2000 1649 ret 0 1650 end 1651 for i ulong n 1652 if ne and cfl b i 4 0 1653 ret 0 1654 end 1655 end 1656 if hasscheme b n 1657 ret 1 1658 end 1659 h0 = ulong 0 1660 while lt h0 n bound 999999 1661 if ne cid b h0 47 1662 break 1663 end 1664 h0 = add h0 1 1665 end 1666 h1 = h0 1667 while lt h1 n bound 999999 1668 if eq cid b h1 47 1669 break 1670 end 1671 h1 = add h1 1 1672 end 1673 parts = ulong 0 1674 ps = h0 1675 i = h0 1676 while le i h1 bound 999999 1677 atend = eq i h1 1678 dot = false 1679 if not atend 1680 dot = eq cid b i 46 1681 end 1682 if or atend dot 1683 if eq i ps 1684 ret 0 1685 end 1686 parts = add parts 1 1687 if atend 1688 if lt parts 2 1689 ret 0 1690 end 1691 if inlist b ps sub i ps 2 1692 ret 2 1693 end 1694 ret 0 1695 end 1696 ps = add i 1 1697 else 1698 if eq and cfl b i 1 0 1699 if ne cid b i 45 1700 ret 0 1701 end 1702 end 1703 end 1704 i = add i 1 1705 end 1706 ret 0 1707 end 1708 1709 note the single-character edits that turn one spelling into another, on letters and numbers only. r: 0 and 1 the 1710 note first spelling's characters [from, to), 2 and 3 the second's. Writes 4 the edits and 5 the longer length. 1711 note Returns 1, and writes nothing, when a spelling has more than 4096 letters and numbers 1712 fn edist b view uchar `1048576` r edit ulong 8 to ulong 1713 xa = new ulong 4096 0 1714 ya = new ulong 4096 0 1715 row = new ulong 4097 0 1716 xc = ulong 0 1717 yc = ulong 0 1718 i = get r 0 1719 x1 = get r 1 1720 while lt i x1 bound 999999 1721 if ne and cfl b i 1 0 1722 if ge xc 4096 1723 ret 1 1724 end 1725 put xa xc cid b i 1726 xc = add xc 1 1727 end 1728 i = add i 1 1729 end 1730 i = get r 2 1731 y1 = get r 3 1732 while lt i y1 bound 999999 1733 if ne and cfl b i 1 0 1734 if ge yc 4096 1735 ret 1 1736 end 1737 put ya yc cid b i 1738 yc = add yc 1 1739 end 1740 i = add i 1 1741 end 1742 for j ulong add yc 1 1743 put row j j 1744 end 1745 for k ulong xc 1746 prev = get row 0 1747 put row 0 add k 1 1748 xi = get xa k 1749 for j ulong yc 1750 cur = get row add j 1 1751 v = add cur 1 1752 w = add get row j 1 1753 if lt w v 1754 v = w 1755 end 1756 w = prev 1757 if ne xi get ya j 1758 w = add prev 1 1759 end 1760 if lt w v 1761 v = w 1762 end 1763 put row add j 1 v 1764 prev = cur 1765 end 1766 end 1767 m = xc 1768 if gt yc m 1769 m = yc 1770 end 1771 put r 4 get row yc 1772 put r 5 m 1773 ret 0 1774 end 1775 1776 note op 4: how alike two spellings are. The text is the first spelling (aux characters), then the second. Writes 1777 note the edits and the longer length, each as a 16-bit number; the host divides 1778 fn alike b view uchar `1048576` n ulong aux ulong ob edit uchar 65544 to ulong 1779 r = new ulong 8 0 1780 bad = ulong `18446744073709551615` 1781 if gt aux n 1782 ret bad 1783 end 1784 put r 0 0 1785 put r 1 aux 1786 put r 2 aux 1787 put r 3 n 1788 if ne edist b r 0 1789 ret bad 1790 end 1791 d = get r 4 1792 m = get r 5 1793 put ob 8 uchar and d 255 1794 put ob 9 uchar shr d 8 1795 put ob 10 uchar and m 255 1796 put ob 11 uchar shr m 8 1797 ret 4 1798 end 1799 1800 note op 5: which run of typed words is the fix for what was heard. The text is what was heard (aux characters), 1801 note then up to four runs: the first typed word, the first two, the first three, the first four; flag 16 marks the 1802 note last character of each run. Each run is compared with what was heard (fn edist); the most alike wins, the 1803 note shorter run among equals. Returns which run (1 to 4), or 0 for no fix: the winner is less than half alike, or 1804 note is the very text that was heard (the host says which runs are: bit k-1 of sm). 255: a spelling is too long 1805 fn pick b view uchar `1048576` n ulong aux ulong sm ulong to ulong 1806 r = new ulong 8 0 1807 if gt aux n 1808 ret 255 1809 end 1810 bk = ulong 0 1811 bn = ulong 0 1812 bd = ulong 1 1813 k = ulong 0 1814 i = aux 1815 while lt i n bound 999999 1816 e = i 1817 while lt e n bound 999999 1818 f = cfl b e 1819 e = add e 1 1820 if ne and f 16 0 1821 break 1822 end 1823 end 1824 k = add k 1 1825 if gt k 4 1826 break 1827 end 1828 put r 0 0 1829 put r 1 aux 1830 put r 2 i 1831 put r 3 e 1832 if ne edist b r 0 1833 ret 255 1834 end 1835 m = get r 5 1836 nu = ulong 1 1837 de = ulong 1 1838 if gt m 0 1839 nu = sub m get r 4 1840 de = m 1841 end 1842 if eq bk 0 1843 bk = k 1844 bn = nu 1845 bd = de 1846 else 1847 if gt mul nu bd mul bn de 1848 bk = k 1849 bn = nu 1850 bd = de 1851 end 1852 end 1853 i = e 1854 end 1855 if eq bk 0 1856 ret 0 1857 end 1858 if lt mul bn 2 bd 1859 ret 0 1860 end 1861 if ne and shr sm sub bk 1 1 0 1862 ret 0 1863 end 1864 ret bk 1865 end 1866 1867 note kind 3: op, the number of characters n (at most 16384), aux and 0 as four 32-bit numbers, then n character 1868 note words. Returns the reply length, or `18446744073709551615` for a malformed body or an unknown op 1869 fn texts ib view uchar `1048576` nb ulong ob edit uchar 65544 to ulong 1870 bad = ulong `18446744073709551615` 1871 if lt nb 16 1872 ret bad 1873 end 1874 op = rd32 ib 0 1875 n = rd32 ib 4 1876 aux = rd32 ib 8 1877 if gt n 16384 1878 ret bad 1879 end 1880 if ne nb add 16 mul n 8 1881 ret bad 1882 end 1883 if eq op 1 1884 put ob 8 uchar qlike ib n 1885 ret 1 1886 end 1887 if eq op 2 1888 ret keyw ib n ob 1889 end 1890 if eq op 3 1891 put ob 8 uchar weba ib n aux 1892 ret 1 1893 end 1894 if eq op 4 1895 ret alike ib n aux ob 1896 end 1897 if eq op 5 1898 put ob 8 uchar pick ib n aux rd32 ib 12 1899 ret 1 1900 end 1901 ret bad 1902 end 1903 1904 note ---- the helper process ---- 1905 note hopcore main: Hop's core as a helper process. A request is 8 bytes (kind, then body length n, both 32-bit 1906 note little-endian) and n body bytes, n at most `1048576`. The reply is 8 bytes (status, then length m) and m bytes. 1907 note Status 0 is an answer; 1 an unknown kind; 2 a malformed body. End of input ends it with status 0; a body 1908 note over the limit or a short read ends it with status 3 (the host starts a fresh one). 1909 note Kind 1, names: the body is k cases of 2048 bytes (256 words, the hopfuzz input); 3 bytes back per case: 1910 note verdict, score low byte, score high byte. At most 512 cases. 1911 note Kind 2, paths: 16-bit little-endian fields: number of terms (at most 64), number of paths (at most 16000); 1912 note each term as length then bytes; each path as three lengths (its lowercased bytes, its name's lowercased 1913 note bytes, the path as written), then the path bytes, then the name bytes. 4 bytes back per path: 0 for no 1914 note match, else the score plus `1000000`. 1915 note Kind 3, text: see fn texts. Op 1 and op 3 answer one byte; op 2 a count, then two 16-bit numbers a word; 1916 note op 4 two 16-bit numbers; op 5 one byte. 1917 note Kind 4, corrected words: see fn wdiff. Kind 5, a board line or a time: see fn board. Kind 6, a whole board: see fn asm. Kind 7, the members' state and the graph: see fn status. 1918 1919 note fill b[0 .. n) from stdin; false at end of input or on a short read 1920 fn rdn b edit uchar `1048576` n ulong to bool 1921 got = ulong 0 1922 while lt got n bound 999999 1923 k = read 0 b got sub n got 1924 if le k 0 1925 ret false 1926 end 1927 got = add got ulong k 1928 end 1929 ret true 1930 end 1931 1932 fn wrn b view uchar 65544 n ulong to bool 1933 p = ulong 0 1934 while lt p n bound 999999 1935 k = write 1 b p sub n p 1936 if le k 0 1937 ret false 1938 end 1939 p = add p ulong k 1940 end 1941 ret true 1942 end 1943 1944 fn put32 b edit uchar 65544 o ulong v ulong to void 1945 put b o uchar and v 255 1946 put b add o 1 uchar and shr v 8 255 1947 put b add o 2 uchar and shr v 16 255 1948 put b add o 3 uchar and shr v 24 255 1949 end 1950 1951 note kind 1: returns the reply length, or `18446744073709551615` for a malformed body 1952 note ---- one line of a plain-text board (kind 5) ---- 1953 note A swarm's board is a text file, one post a line: 1954 note