You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

54 lines
17 KiB

0.8.0
#First line must be a semantic version number
#all other lines are ignored.
#0.8.0 - G-106 powershell console-mode fallback overhaul (raw mode on twapi-less windows runtimes). Lifecycle: server starts lazily on first enableRaw/disableRaw (module load no longer spawns a process or prints to stderr), is a process-wide singleton shared across interps/threads (tsv punk_console ps_server_* under tsv::lock), and watches the owning process pid (handle-based Process.HasExited) so it exits with the session - no orphan pwsh processes. The 20s ping-staleness keepalive is removed: it was the root cause of the observed mid-session early shutdown (no tcl-side pinger ever existed).
#0.8.0 - server script listener defects fixed: per-connection StreamReader.Close disposed the underlying pipe stream so the next Disconnect/Dispose threw and killed the listener runspace after the first message; disableraw was swallowed (only enableraw was forwarded to the mode loop); a null-message connection (e.g a probe) no longer shuts the server down; AutoResetEvent replaces ManualResetEvent+late-Reset (lost-wakeup race).
#0.8.0 - new punk::console::system procs (PUNKARGS-documented): ps_consolemode_script_get (resolution chain: env PUNK_PS_CONSOLEMODE_SCRIPT -> argv0-derived -> module-location-derived -> embedded copy in this module; the old [pwd] fallback is gone - kits and unusual cwds now always resolve), ps_consolemode_server_ensure (singleton spawn), ps_consolemode_send (deadline-based connect with generous window for powershell startup, one respawn on unreachable server), ps_consolemode_server_stop (explicit shutdown for tests/tools).
#0.8.0 - enableRaw_powershell waits for the flip to be observable before returning where the runtime can read live mode (tcl9 -inputmode poll, 750ms cap) - closes the fire-and-forget race between the pipe write and the server applying the console flags; disableRaw_powershell on runtimes without -inputmode (tcl 8.6) now asks the server (previously stty-or-error, so cooked mode could not be restored via the fallback).
#0.8.0 - quiet in normal operation: server child spawned with stdout/stderr redirected to NUL (stdin stays inherited - the console input handle is how the server reaches the console), all ps1 diagnostics debug-gated; env PUNK_PS_CONSOLEMODE_DEBUG=1 enables diagnostics on both sides (tcl spawn note + ps1 write-host trail, unredirected).
#0.8.0 - canonical script scriptlib/utils/pwsh/consolemode_server_async.ps1 rewritten (protocol: enableraw|disableraw|ping|exit; parent-pid watch; posh-git MIT attribution for the NativeConsoleMethods C# snippet); the module's embedded copy is kept in sync by the new console testsuite psfallback.test.
#0.7.2 - PUNKARGS fix: console_fact_get/console_fact_set key argument now declares -choiceprefix 0 so documented behaviour matches the manual positional parser (exact key match required, no prefix matching - the proc feeds key directly into a dict lookup that has no prefix normalization)
#0.7.1 - new idle-reader hostage guard in get_ansi_response_payload: on a tcl 8.6 windows console in cooked (line) mode with a readable handler armed on stdin (the idle-at-a-line-mode-prompt condition - e.g. a query fired from an after-script or worker thread while the shell waits for input), the query now fails fast with errorcode {PUNK CONSOLE QUERY HOSTAGE_COOKED_READ} and emits nothing, instead of timing out (~500ms) and having the response swallowed by the driver's parked cooked ReadConsole until Enter then leaking to the line reader as phantom input. Mid-command queries (repl reader disarmed) and raw mode are unaffected; best-effort - a parked read can outlive a removed handler, so the guard catches the systematic case only
#0.7.1 - compound emit-then-query operations flush their emissions before querying: get_size_using_cursormove/get_size_using_cursorrestore (the far-corner move), test_char_width (positioning and the measured test emission) and test_string_cursor (alt-screen/move/erase). Under G-007 routing the position query may execute in the console-owning thread, whose flush acts on its own channel instance for the same OS handle - the caller's unflushed emissions then reach the terminal after the query measures, e.g. get_size returning 'columns 1' on tcl 8.6 where the -winsize shortcut is unavailable and the ANSI mechanism actually runs (pre-routing this was masked because emit and query shared one channel instance, so the query's flush pushed the emissions too). Error paths flush their cursor-restore emissions likewise.
#0.7.1 - ensure_object_integration hardening: returns 0 as a graceful no-op (without latching object_integration_done) when opunk::console is not loaded, instead of erroring into the nonexistent namespace; and on wiring the lifecycle callback it retro-registers ownership for anchors created in this interp before the wiring (previously 'package require opunk::console; opunk::console::create ...' with no intervening punk::console object operation left the console without a registered owner - fact-store share qualifiers then fell back to the calling thread and other threads could not address that console's facts). Retro-registration fills empty registry entries only; existing live registrations are preserved.
#0.7.1 - fix Tcl 8.6 windows console misdetection (one root cause, three sites): 8.6 console channels expose no -inputmode configure key, so guards that test for -inputmode/-mode classified a real 8.6 console as a pipe. A twapi console handle for stdin is now treated as definitive at all three sites (stdin only - pipe probes still never flip the process console; mintty-as-pipes has no console handle and falls through to the env heuristics). Site 1: get_ansi_response_payload's raw-cycling gate (0.1.5) skipped the raw cycle for 8.6 line-mode queries. Site 2: is_input_console_or_tty false negative made settle_can_respond's layer-2 heuristic settle a real 8.6 console as unable to respond. Site 3 (the line-mode query killer, introduced 0.1.2): input_at_eof took the pipe branch and performed its probe read on the drained console channel - a read on a drained 8.6 console makes the channel driver park a blocking cooked-mode ReadConsole that a later raw flip cannot cancel (verified empirically against clean tclkits 8.6.13/8.6.17: driver reads sample the console mode when issued, not when data arrives), and since get_ansi_response_payload calls input_at_eof immediately before its raw cycle, every 8.6 line-mode query's response was swallowed by that parked read until Enter (~500ms timeout + response leaking to the line reader as phantom input; also the cause of increased ANSI artifacts in outputs like 'help env' once 0.7.0 brokering made code-interp queries actually reach the terminal).
#0.7.0 - G-007 slice 2 (choke-point brokering): a terminal query (internal::get_ansi_response_payload and every query proc layered above it) on the process-default console {stdin stdout} issued by a thread that is not the registered owner is forwarded whole to the owning thread via synchronous thread::send, so queueing, raw-mode cycling, cooperative reader handling (input_chunks_waiting) and can_respond gating all execute in the owner's context; owner-side errors propagate to the caller with routing context
#0.7.0 - new internal::console_route_owner decides the routing: default console pair only (non-std channel names are thread-local, so an {in out} pair spec always names the calling thread's own console and operates locally - a console anchored by code-interp/worker code round-trips nowhere); unregistered, owner==caller, and dead-owner (liveness-validated) cases operate locally, preserving single-interp behaviour exactly
#0.6.0 - G-007 slice 1 (facts + ownership): per-console facts store is tsv-backed (shared array punk_console_facts) so all threads of a punk session read the same values; the default console {stdin stdout} keeps the legacy namespace variables as its authoritative local storage with write traces mirroring every write (including direct variable writes) into tsv; non-default consoles store facts only in tsv, keyed with an owner qualifier because non-std channel names are thread-local
#0.6.0 - new console ownership registry: console_owner_register/console_owner_get/console_owner_forget record which thread owns a console (tsv punk_console_owners, keyed by canonical {in out} pair); ownership is captured at anchor time via the new opunk::console lifecycle_callback (wired by ensure_object_integration) and by default_console; consult-time liveness validation clears entries for exited threads; for {stdin stdout} first registration wins and only the owner's forget releases the entry
#0.6.0 - console_fact_set from a thread that does not own the default console forwards the write to the owning thread via thread::send (vt52-alias transport precedent) with a direct tsv fallback; console_fact_get from a non-owner reads the tsv mirror
#0.6.0 - new console_fact_clear proc clears recorded facts for a console (default console facts re-record their module defaults)
#0.6.0 - dec_has_mode/ansi_has_mode caches moved from per-interp dicts to tsv (shared array punk_console_modecache, one entry per {dectype qualifier in out passthrough mode}) - all threads share one cache per console
#0.6.0 - infrastructure tsv arrays renamed with punk_ prefix to avoid collisions with application tsv usage in subshells: console -> punk_console (is_raw; coordinated call-site updates in punk::repl, punk::lib, punk::basictelnet), and the new stores are punk_console_facts/punk_console_owners/punk_console_modecache; mixed loading of pre-0.6.0 and 0.6.0 punk::console in one process would see divergent raw-mode state
#0.6.0 - module is now loadable in secondary threads without ::argv0 (powershell consolemode fallback guarded with info exists)
#0.5.0 - migration complete: the remaining trailing-positional query functions (get_cursor_pos, get_cursor_pos_list, get_checksum_rect, get_device_status, get_device_attributes, get_device_attributes_tertiary, get_terminal_id, get_tabstops, get_tabstop_apparent_width, get_dimensions, get_xterm_size, get_xterm_pixels, dec_get_mode_line_wrap, ansi_get_mode_LNM) converted to the get_size hybrid pattern via new internal::hybrid_console_spec - each accepts the legacy positional console spec or -console <consolespec> (any spec form), with PUNKARGS documentation
#0.5.0 - get_size refactored onto internal::hybrid_console_spec (behaviour unchanged)
#0.5.0 - documentation-only PUNKARGS added for input_at_eof, is_input_console_or_tty, size_via_query_mechanisms, console_size_provider and the get_size_using_* mechanism helpers (signatures unchanged - internal size mechanisms remain canonical-pair only)
#0.4.0 - mode setters (dec_set_mode/dec_unset_mode/ansi_set_mode/ansi_unset_mode) and cursor_style resolve their -console spec via console_spec_resolve instead of '[lindex $terminal 1]' - anchored instance names and ::opunk::Console object values now work (previously silently wrote to the wrong target)
#0.4.0 - the fourteen '-console -type list -minsize 2' declarations replaced with shared fragment ::punk::console::argdoc::console_opts (the -minsize 2 constraint rejected 1-element instance-name specs at parse time); show_input_response and cell_size -console docs unified on the fragment
#0.4.0 - dec_has_mode/ansi_has_mode cache on the canonical {in out} pair - all spec forms addressing the same console share one cache entry (previously keyed on the raw spec string)
#0.4.0 - test_is_vt52 option -inoutchannels renamed to -console per the documented convention (breaking for that experimental/broken proc only)
#0.4.0 - set/unset mode argdocs corrected: <codes> are semicolon delimited (docs said colon)
#0.3.0 - per-console facts (interim store for multi-console goals G-001/G-002): is_vt52, tabwidth, cell_size, last_da1_result, grapheme_cluster_support and check::has_bug_* are keyed by canonical {in out} pair via new console_fact_get/console_fact_set; the default console {stdin stdout} stores facts in the legacy namespace variables so external readers (punk::repl, textblock, overtype, punk::ansi, punk::ns) are unaffected
#0.3.0 - vt52 state, size_via_query_mechanisms, get_cursor_pos and all vt52-aware emit wrappers (incl. string-returning ansi::move) consult the spec'd console's is_vt52 fact instead of the process-global flag
#0.3.0 - grapheme_cluster_support and check::has_bug_legacysymbolwidth/has_bug_zwsp accept a trailing '-console <consolespec>'; the TERM_PROGRAM shortcut in grapheme_cluster_support only applies to the default console (env hints describe the process's own terminal)
#0.3.0 - check::has_bug_zwsp: cached-true path no longer errors on an undefined variable, and a query verdict is now actually cached (previously checked but never populated)
#0.3.0 - ansi_wanted/colour_disabled (gate string generation), ansi_available and raw-mode state deliberately remain process-global - documented at the console_facts store
#0.3.0 - PUNKARGS for the emit-side functions restructured per the Argument Order rule (leading positionals documented as @leaders before @opts so synopses match call-site order); internal opt_console_* helpers gained documentation-only definitions
#0.2.0 - emit-side console targeting: punk::console::ansi::* emit functions, mouse/paste toggles, start_application_mode, vt52, set_tabstop_width, titleset, top-level move, test_char_width and test_string_cursor accept an optional trailing '-console <consolespec>' (channel pair, anchored opunk::console instance name, or ::opunk::Console object value) parsed via new internal::opt_console_out/opt_console_channels helpers (+_var variants for triple-tail procs); documentation via shared PUNKARGS fragment ::punk::console::argdoc::console_emit_opts
#0.2.0 - fallback chains keep the console spec: get_tabstop_apparent_width passes its spec to test_char_width; set_tabstop_width passes its spec to get_size (both previously queried the default console)
#0.2.0 - move_call_return now actually emits its cursor moves (previously discarded the string-returning ansi::move results - moves were no-ops)
#0.2.0 - get_size_using_cursorrestore uses string-returning punk::ansi::cursor_on (previously called the emitting punk::console::cursor_on which wrote to stdout mid-sequence)
#0.2.0 - top-level move wrapper is an explicit proc with -console support (replaces the generator loop)
#0.1.8 - bug fixes: disableAnsi was defined as a duplicate enableAnsi in the windows no-twapi branch; get_size_using_cursormove flushed stdout instead of the supplied output channel; removed unreachable code after error in get_size_using_chanconfigure; cell_size query path now passes its -console spec to get_size and error message names punk::console (was punk::sixel); test_string_cursor undefined $test_string reference and swapped rowoffset/columnoffset return labels; ansi::move_emit vt52 branch called nonexistent v52move_emit (now vt52move_emit); move_emit_return no longer re-expands args inside its per-triple loop (duplicated emissions); dec_has_mode unknown-mode error named dec_get_mode
#0.1.7 - get_size dispatches object-governed calls through the virtual ::opunk::Console::size method (subclass overrides honoured); ANSI/tput mechanisms factored into size_via_query_mechanisms and registered as the class size_query_provider via ensure_object_integration; legacy channel path returns 80x24 instead of erroring when undetermined
#0.1.6 - get_ansi_response_payload performs first-use active settling (with recursion latch) so all query paths pay one probe instead of a timeout per call on unsettled ambiguous consoles; default_console unifies the opunk::console probe-byte store with input_chunks_waiting
#0.1.5 - settle_can_respond: layered active settling of console response capability (certainty/heuristic without emission, CSI 6n probe with timeout in the ambiguous zone); get_size triggers it at first use for anchored/default console specs; new variable can_respond_probe_timeout_ms
#0.1.5 - get_ansi_response_payload only cycles console raw mode when the input channel is a console/tty - pipe-targeted probes no longer flip the process console mode (also fixes a repeat-cycle deadlock under captured-channel environments)
#0.1.4 - new default_console proc; console_spec_resolve auto-attaches the anchored opunk::console instance (name: default) for matching channel pairs
#0.1.3 - new console_spec_resolve: -console (and legacy positional inoutchannels) accept a channel pair, an anchored opunk::console instance name, or an ::opunk::Console object value
#0.1.3 - get_size converted to manual-parse hybrid signature with PUNKARGS documentation; a supplied console object with settled can_respond skips/permits ANSI mechanisms authoritatively and supplies the fallback default size
#0.1.3 - get_ansi_response_payload resolves console specs and errors immediately for objects settled as unable to respond
#0.1.2 - get_ansi_response_payload fails fast when the input channel is closed/at eof instead of emitting a query that can never be answered
#0.1.2 - get_size skips ANSI cursor-report mechanisms and falls back to tput then a default 80x24 when input is not a console/tty (new helpers input_at_eof with probe read, is_input_console_or_tty)
#0.1.2 - removed erroneous repl restart attempts from get_ansi_response_payload eof handling (re-entrancy, bypassed app-layer PUNK_PIPE_EOF policy; one call was a typo repl::reopen). eof now flows to the active reader.