pocketshell 0.5.15__tar.gz → 0.5.16__tar.gz

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 (462) hide show
  1. {pocketshell-0.5.15 → pocketshell-0.5.16}/PKG-INFO +2 -1
  2. pocketshell-0.5.16/docs/account-intercepting-proxy.md +112 -0
  3. {pocketshell-0.5.15 → pocketshell-0.5.16}/docs/account.md +4 -0
  4. {pocketshell-0.5.15 → pocketshell-0.5.16}/docs/windows-tray-installer.md +18 -4
  5. {pocketshell-0.5.15 → pocketshell-0.5.16}/pyproject.toml +4 -1
  6. pocketshell-0.5.16/release/inputs/guardian-login-shell/DERIVATION.diff +11 -0
  7. pocketshell-0.5.16/release/inputs/guardian-login-shell/README.md +14 -0
  8. pocketshell-0.5.16/release/inputs/guardian-login-shell/SHA256SUMS +3 -0
  9. pocketshell-0.5.16/release/inputs/guardian-login-shell/guardian.py +332 -0
  10. pocketshell-0.5.16/release/inputs/guardian-login-shell/policy.py +95 -0
  11. pocketshell-0.5.16/release/inputs/guardian-servicing/native_api.py +94 -0
  12. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/ci/tray_terminal_gate.py +14 -2
  13. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/release/build_tray_installer.py +2 -2
  14. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/release/private_shell_overlay.py +144 -8
  15. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/account/broker.py +86 -0
  16. pocketshell-0.5.16/src/pocketshell/account/sealed.py +175 -0
  17. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/service_agent_endpoint.py +14 -1
  18. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/service_endpoint.py +8 -1
  19. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray_bundle.py +11 -3
  20. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray_repair.py +6 -6
  21. pocketshell-0.5.16/tests/account/fixtures/sealed-v1-vector.json +21 -0
  22. pocketshell-0.5.16/tests/account/test_account_sealed.py +265 -0
  23. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_endpoint_setup.py +40 -1
  24. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_service_endpoint.py +3 -0
  25. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/release/test_build_backend.py +50 -0
  26. pocketshell-0.5.16/tests/release/test_private_shell_path_native.py +111 -0
  27. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/release/test_tray_terminal_gate.py +12 -1
  28. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/release/test_windows_tray_terminal_native.py +114 -1
  29. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/release/tray_terminal_fixture.py +12 -2
  30. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_aplexer_contract.py +6 -4
  31. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_bundle.py +45 -0
  32. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_repair.py +9 -3
  33. {pocketshell-0.5.15 → pocketshell-0.5.16}/uv.lock +15 -1
  34. {pocketshell-0.5.15 → pocketshell-0.5.16}/.gitattributes +0 -0
  35. {pocketshell-0.5.15 → pocketshell-0.5.16}/.gitignore +0 -0
  36. {pocketshell-0.5.15 → pocketshell-0.5.16}/LICENSE +0 -0
  37. {pocketshell-0.5.15 → pocketshell-0.5.16}/README.md +0 -0
  38. {pocketshell-0.5.15 → pocketshell-0.5.16}/SCOPE.md +0 -0
  39. {pocketshell-0.5.15 → pocketshell-0.5.16}/docs/architecture.md +0 -0
  40. {pocketshell-0.5.15 → pocketshell-0.5.16}/docs/bounded-container-sessions.md +0 -0
  41. {pocketshell-0.5.15 → pocketshell-0.5.16}/docs/gateway-distribution.md +0 -0
  42. {pocketshell-0.5.15 → pocketshell-0.5.16}/docs/gateway.md +0 -0
  43. {pocketshell-0.5.15 → pocketshell-0.5.16}/docs/keys.md +0 -0
  44. {pocketshell-0.5.15 → pocketshell-0.5.16}/docs/link-transport.md +0 -0
  45. {pocketshell-0.5.15 → pocketshell-0.5.16}/docs/tray.md +0 -0
  46. {pocketshell-0.5.15 → pocketshell-0.5.16}/docs/vault-enrollment.md +0 -0
  47. {pocketshell-0.5.15 → pocketshell-0.5.16}/docs/windows-gateway-client.md +0 -0
  48. {pocketshell-0.5.15 → pocketshell-0.5.16}/docs/windows-gateway-private-runtime.md +0 -0
  49. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/launcher/go.mod +0 -0
  50. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/launcher/main.go +0 -0
  51. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/launcher/stdio_windows.go +0 -0
  52. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/verify/context.go +0 -0
  53. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/verify/context_test.go +0 -0
  54. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/verify/context_windows.go +0 -0
  55. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/verify/entry.go +0 -0
  56. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/verify/go.mod +0 -0
  57. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/verify/go.sum +0 -0
  58. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/verify/main.go +0 -0
  59. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/verify/protocol.go +0 -0
  60. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/verify/protocol_test.go +0 -0
  61. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/verify/spawn_test.go +0 -0
  62. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/verify/spawn_windows.go +0 -0
  63. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/verify/verify_other.go +0 -0
  64. {pocketshell-0.5.15 → pocketshell-0.5.16}/native/verify/verify_windows.go +0 -0
  65. {pocketshell-0.5.15 → pocketshell-0.5.16}/pocketshell-tray.spec +0 -0
  66. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/aplexer-fc396/README.md +0 -0
  67. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/aplexer-fc396/SHA256SUMS +0 -0
  68. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/aplexer-fc396/windows-native-fc396.zip +0 -0
  69. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/dossiers/OWNED-BUILD-V26A.json +0 -0
  70. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/dossiers/SHA256SUMS +0 -0
  71. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/dossiers/quiet-build-terminal-fields-addendum.json +0 -0
  72. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/dossiers/quiet-host-source-build-role-handoff.json +0 -0
  73. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/dossiers/transfer-manifest.json +0 -0
  74. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/dossiers/windows-aplexer-msys-backend-source-role-handoff.json +0 -0
  75. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-6cf7ae85/.gitattributes +0 -0
  76. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-6cf7ae85/README.md +0 -0
  77. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-6cf7ae85/SHA256SUMS +0 -0
  78. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-6cf7ae85/guardian.py +0 -0
  79. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-6cf7ae85/native_api.py +0 -0
  80. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-6cf7ae85/policy.py +0 -0
  81. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-e862645d/DERIVATION.diff +0 -0
  82. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-e862645d/README.md +0 -0
  83. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-e862645d/SHA256SUMS +0 -0
  84. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-e862645d/guardian.py +0 -0
  85. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-e862645d/native_api.py +0 -0
  86. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-e862645d/policy.py +0 -0
  87. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-interactive/README.md +0 -0
  88. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-interactive/SHA256SUMS +0 -0
  89. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-interactive/guardian.py +0 -0
  90. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-interactive/native_api.py +0 -0
  91. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-interactive/policy.py +0 -0
  92. {pocketshell-0.5.15/release/inputs/guardian-servicing → pocketshell-0.5.16/release/inputs/guardian-login-shell}/native_api.py +0 -0
  93. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-servicing/README.md +0 -0
  94. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-servicing/SHA256SUMS +0 -0
  95. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-servicing/guardian.py +0 -0
  96. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/guardian-servicing/policy.py +0 -0
  97. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/msys2-runtime-5a1665c8/SHA256SUMS +0 -0
  98. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/msys2-runtime-5a1665c8/console.cc +0 -0
  99. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/openssh-quiet-e302fe1/NULL-PATH-FIX.md +0 -0
  100. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/openssh-quiet-e302fe1/SHA256SUMS +0 -0
  101. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/openssh-quiet-e302fe1/policy-manifest.json +0 -0
  102. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/openssh-quiet-e302fe1/shell-host.c +0 -0
  103. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/openssh-quiet-e302fe1/w32fd.c +0 -0
  104. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/openssh-quiet-e302fe1/wmain_sshd-auth.c +0 -0
  105. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/openssh-quiet-e302fe1/wmain_sshd-session.c +0 -0
  106. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/openssh-quiet-e302fe1/wmain_sshd.c +0 -0
  107. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/pocketshell-link-70f5a4b/README.md +0 -0
  108. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/pocketshell-link-70f5a4b/SHA256SUMS +0 -0
  109. {pocketshell-0.5.15 → pocketshell-0.5.16}/release/inputs/pocketshell-link-70f5a4b/pocketshell-link-windows-amd64.exe +0 -0
  110. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/check-antigravity-contract.py +0 -0
  111. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/check-cgroup-cap-proof.sh +0 -0
  112. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/check-product-tmux-absent.sh +0 -0
  113. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/check-python-ci-lock.sh +0 -0
  114. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/ci/scope_guard.py +0 -0
  115. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/ci/test_scope_guard.py +0 -0
  116. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/reinstall-box-cli.sh +0 -0
  117. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/release/build_backend_windows.py +0 -0
  118. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/release/build_closure.py +0 -0
  119. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/release/psc-install.ps1 +0 -0
  120. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/release/smoke_tray_bundle.py +0 -0
  121. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/release/tray-installer.nsi +0 -0
  122. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/release/update_tray_runtime.py +0 -0
  123. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/sync-readme-exit-codes.py +0 -0
  124. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/test-usage-missing-window-mutation.sh +0 -0
  125. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/windows-e2e-sshd-setup.ps1 +0 -0
  126. {pocketshell-0.5.15 → pocketshell-0.5.16}/scripts/windows-gateway-qualify.py +0 -0
  127. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/__init__.py +0 -0
  128. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/__main__.py +0 -0
  129. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/account/__init__.py +0 -0
  130. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/account/cli.py +0 -0
  131. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/account/config.py +0 -0
  132. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/account/credentials.py +0 -0
  133. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/account/device.py +0 -0
  134. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/account/errors.py +0 -0
  135. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/account/jsonutil.py +0 -0
  136. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/account/sanitize.py +0 -0
  137. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/account/shared_vault.py +0 -0
  138. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/__init__.py +0 -0
  139. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/conversations/__init__.py +0 -0
  140. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/conversations/cli.py +0 -0
  141. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/conversations/readers.py +0 -0
  142. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/conversations/resolve.py +0 -0
  143. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/conversations/roots.py +0 -0
  144. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/kind.py +0 -0
  145. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/launch/__init__.py +0 -0
  146. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/launch/cli.py +0 -0
  147. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/launch/command.py +0 -0
  148. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/launch/environment.py +0 -0
  149. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/launch/run.py +0 -0
  150. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/launch/spec.py +0 -0
  151. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/agents/launch/trust.py +0 -0
  152. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/attachments/__init__.py +0 -0
  153. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/attachments/cli.py +0 -0
  154. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/attachments/prune.py +0 -0
  155. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/cli.py +0 -0
  156. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/daemon/__init__.py +0 -0
  157. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/daemon/cache.py +0 -0
  158. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/daemon/client.py +0 -0
  159. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/daemon/dispatch.py +0 -0
  160. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/daemon/failures.py +0 -0
  161. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/daemon/lifecycle.py +0 -0
  162. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/daemon/methods.py +0 -0
  163. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/daemon/paths.py +0 -0
  164. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/daemon/protocol.py +0 -0
  165. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/daemon/server.py +0 -0
  166. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/engines/__init__.py +0 -0
  167. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/engines/builtin.py +0 -0
  168. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/engines/cli.py +0 -0
  169. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/engines/harness.py +0 -0
  170. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/engines/registry.py +0 -0
  171. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/engines/spec.py +0 -0
  172. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/env/__init__.py +0 -0
  173. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/env/cli.py +0 -0
  174. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/env/parse.py +0 -0
  175. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/env/store.py +0 -0
  176. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/__init__.py +0 -0
  177. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/cli.py +0 -0
  178. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/client_cli.py +0 -0
  179. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/devices.py +0 -0
  180. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/endpoint.py +0 -0
  181. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/helper.py +0 -0
  182. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/pins.py +0 -0
  183. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/private_endpoint.py +0 -0
  184. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/proxy.py +0 -0
  185. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/service.py +0 -0
  186. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/service_agent_firstuse.py +0 -0
  187. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/service_agent_install.py +0 -0
  188. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/service_common.py +0 -0
  189. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/service_hostkey.py +0 -0
  190. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/service_linux.py +0 -0
  191. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/service_task_acl.py +0 -0
  192. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/service_user_agent.py +0 -0
  193. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/service_windows.py +0 -0
  194. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/service_windows_endpoint.py +0 -0
  195. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/sshcmd.py +0 -0
  196. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/status.py +0 -0
  197. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/tokens.py +0 -0
  198. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/vault_enrollment.py +0 -0
  199. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/gateway/winssh.py +0 -0
  200. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/github.py +0 -0
  201. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/hooks/__init__.py +0 -0
  202. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/hooks/cli.py +0 -0
  203. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/hooks/handlers.py +0 -0
  204. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/hooks/installers.py +0 -0
  205. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/hooks/paths.py +0 -0
  206. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/hooks/providers/__init__.py +0 -0
  207. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/hooks/providers/claude.py +0 -0
  208. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/hooks/providers/codex.py +0 -0
  209. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/hooks/status.py +0 -0
  210. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/keys/__init__.py +0 -0
  211. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/keys/cli.py +0 -0
  212. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/keys/crypto.py +0 -0
  213. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/keys/prompt.py +0 -0
  214. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/keys/session.py +0 -0
  215. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/keys/sshkeys.py +0 -0
  216. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/keys/store.py +0 -0
  217. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/link/__init__.py +0 -0
  218. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/link/cli.py +0 -0
  219. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/link/client.py +0 -0
  220. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/link/daemon.py +0 -0
  221. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/link/protocol.py +0 -0
  222. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/link/relay.py +0 -0
  223. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/logs/__init__.py +0 -0
  224. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/logs/cli.py +0 -0
  225. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/logs/events.py +0 -0
  226. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/logs/hooks.py +0 -0
  227. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/logs/paths.py +0 -0
  228. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/logs/redact.py +0 -0
  229. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/profiles/__init__.py +0 -0
  230. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/profiles/cli.py +0 -0
  231. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/profiles/discovery.py +0 -0
  232. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/profiles/model.py +0 -0
  233. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/profiles/resolve.py +0 -0
  234. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/repos/__init__.py +0 -0
  235. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/repos/cli.py +0 -0
  236. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/repos/handlers.py +0 -0
  237. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/repos/local.py +0 -0
  238. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/repos/model.py +0 -0
  239. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/repos/remote.py +0 -0
  240. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/repos/render.py +0 -0
  241. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/runtime/__init__.py +0 -0
  242. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/runtime/aplexer.py +0 -0
  243. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/runtime/cgroups.py +0 -0
  244. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/runtime/console_scripts.py +0 -0
  245. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/runtime/inherited_cgroup.py +0 -0
  246. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/runtime/memcap.py +0 -0
  247. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/runtime/sessions.py +0 -0
  248. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/runtime/windows_job.py +0 -0
  249. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/serve.py +0 -0
  250. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/sessions/__init__.py +0 -0
  251. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/sessions/attach.py +0 -0
  252. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/sessions/cli.py +0 -0
  253. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/sessions/create.py +0 -0
  254. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/sessions/kill.py +0 -0
  255. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/sessions/listing.py +0 -0
  256. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/sessions/rename.py +0 -0
  257. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/sessions/warnings.py +0 -0
  258. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tokentls.py +0 -0
  259. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray/__init__.py +0 -0
  260. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray/__main__.py +0 -0
  261. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray/app.py +0 -0
  262. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray/autostart.py +0 -0
  263. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray/cli.py +0 -0
  264. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray/dialogs.py +0 -0
  265. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray/gateway_auth.py +0 -0
  266. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray/icons.py +0 -0
  267. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray/model.py +0 -0
  268. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray/single_instance.py +0 -0
  269. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray/status_client.py +0 -0
  270. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray/vault_password.py +0 -0
  271. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tray_supervisor.py +0 -0
  272. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tree/__init__.py +0 -0
  273. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tree/cli.py +0 -0
  274. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tree/daemon.py +0 -0
  275. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tree/model.py +0 -0
  276. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tree/paths.py +0 -0
  277. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tree/storage.py +0 -0
  278. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tree/workspaces/__init__.py +0 -0
  279. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tree/workspaces/cli.py +0 -0
  280. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/tree/workspaces/membership.py +0 -0
  281. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/usage/__init__.py +0 -0
  282. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/usage/cli.py +0 -0
  283. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/usage/normalize.py +0 -0
  284. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/usage/quse.py +0 -0
  285. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/windows_security.py +0 -0
  286. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/windows_session_lifecycle.py +0 -0
  287. {pocketshell-0.5.15 → pocketshell-0.5.16}/src/pocketshell/windows_sessions.py +0 -0
  288. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/__init__.py +0 -0
  289. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/fixtures/trusted-host-v1-vector.json +0 -0
  290. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/fixtures/vault-v1-vectors.json +0 -0
  291. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/fixtures/windows-gateway-config-native-v1.json +0 -0
  292. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/test_account_basics.py +0 -0
  293. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/test_account_broker.py +0 -0
  294. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/test_account_cli.py +0 -0
  295. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/test_account_credentials.py +0 -0
  296. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/test_account_device_flow.py +0 -0
  297. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/test_account_tls.py +0 -0
  298. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/test_shared_vault.py +0 -0
  299. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/test_vault_enrollment.py +0 -0
  300. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/test_vault_revocation_replay.py +0 -0
  301. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/test_vault_trust_store.py +0 -0
  302. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/test_windows_gateway_config_native.py +0 -0
  303. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/account/test_windows_private_storage.py +0 -0
  304. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/aplexer_requirement.py +0 -0
  305. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/conftest.py +0 -0
  306. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/data/quse-0.0.11-usage.json +0 -0
  307. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/data/quse-0.0.13-usage.json +0 -0
  308. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/data/quse-0.0.15-usage.json +0 -0
  309. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/data/quse-0.0.15-usage.ndjson +0 -0
  310. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/data/quse-0.0.15-usage.provenance.txt +0 -0
  311. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/data/quse-0.0.17-gemini.json +0 -0
  312. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/data/quse-0.0.17-gemini.provenance.txt +0 -0
  313. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/data/quse-0.0.9-usage.json +0 -0
  314. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/data/sshd_anchor/Dockerfile.from-unanchored-base +0 -0
  315. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/docker/inherited-memory/Dockerfile +0 -0
  316. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/docker/inherited-memory/proof.py +0 -0
  317. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/docker/link/e2e.sh +0 -0
  318. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/docker/link/e2e_client.py +0 -0
  319. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/docker/link/host_entry.py +0 -0
  320. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/docker/link/relay_entry.py +0 -0
  321. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/docker/phone-host/.gitattributes +0 -0
  322. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/docker/phone-host/Dockerfile +0 -0
  323. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/docker/phone-host/README.md +0 -0
  324. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/docker/phone-host/entrypoint.sh +0 -0
  325. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/fake_broker.py +0 -0
  326. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/fixtures/aplexer/README.md +0 -0
  327. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/fixtures/aplexer/snapshot-agent.json +0 -0
  328. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/fixtures/aplexer/snapshot-crashed-start.json +0 -0
  329. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/fixtures/aplexer/snapshot-liveness-mix.json +0 -0
  330. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/fixtures/aplexer/snapshot-mid-create.json +0 -0
  331. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/fixtures/aplexer/snapshot-post-kill-window.json +0 -0
  332. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/fixtures/aplexer/snapshot-reported-state.json +0 -0
  333. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/fixtures/aplexer/snapshot.json +0 -0
  334. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/agent_harness.py +0 -0
  335. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/conftest.py +0 -0
  336. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/fake_gateway.py +0 -0
  337. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/fakeguardian/go.mod +0 -0
  338. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/fakeguardian/go.sum +0 -0
  339. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/fakeguardian/main.go +0 -0
  340. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/fakelink/main.go +0 -0
  341. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/fixtures/ordinary-v2-authority.schema.json +0 -0
  342. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/fixtures/task-object-authority.ps1 +0 -0
  343. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/gateway_keyblobs.py +0 -0
  344. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/packaged_gateway_config_runner.py +0 -0
  345. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_bundled_hostkey.py +0 -0
  346. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_agent_firstuse.py +0 -0
  347. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_agent_install.py +0 -0
  348. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_agent_resume.py +0 -0
  349. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_agent_setup_cli.py +0 -0
  350. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_auth_cli.py +0 -0
  351. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_cli.py +0 -0
  352. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_connect_e2e.py +0 -0
  353. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_devices.py +0 -0
  354. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_endpoint.py +0 -0
  355. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_enroll_login.py +0 -0
  356. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_exec_passthrough.py +0 -0
  357. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_helper_metadata.py +0 -0
  358. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_helper_resolution.py +0 -0
  359. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_helper_wheel.py +0 -0
  360. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_pins.py +0 -0
  361. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_proxy.py +0 -0
  362. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_service.py +0 -0
  363. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_service_task_acl.py +0 -0
  364. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_service_task_object.py +0 -0
  365. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_ssh.py +0 -0
  366. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_ssh_key.py +0 -0
  367. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_ssh_key_e2e.py +0 -0
  368. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_status.py +0 -0
  369. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_gateway_user_agent.py +0 -0
  370. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_private_endpoint.py +0 -0
  371. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_agent_install_native.py +0 -0
  372. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_aplexer_probe_native.py +0 -0
  373. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_complete_runtime_native.py +0 -0
  374. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_endpoint_keys_native.py +0 -0
  375. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_gateway_e2e.py +0 -0
  376. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_gateway_service_native.py +0 -0
  377. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_gateway_user_agent_native.py +0 -0
  378. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_helper_execution.py +0 -0
  379. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_launcher_quiet_native.py +0 -0
  380. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_packaged_gateway_config_native.py +0 -0
  381. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_qualify_accounting.py +0 -0
  382. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_release_closure_native.py +0 -0
  383. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_service_private_read.py +0 -0
  384. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_spawn_entry_tree_native.py +0 -0
  385. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_sshcmd.py +0 -0
  386. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_verify_native.py +0 -0
  387. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_windows_winssh_native.py +0 -0
  388. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/test_winssh.py +0 -0
  389. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/gateway/unelevated.py +0 -0
  390. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/keys/conftest.py +0 -0
  391. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/keys/keyhelpers.py +0 -0
  392. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/keys/test_keys_cli.py +0 -0
  393. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/keys/test_keys_crypto.py +0 -0
  394. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/keys/test_keys_store.py +0 -0
  395. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/link/test_adversarial_security.py +0 -0
  396. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/link/test_cli_link.py +0 -0
  397. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/link/test_exec_semantics.py +0 -0
  398. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/link/test_loopback.py +0 -0
  399. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/link/test_protocol.py +0 -0
  400. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/link/test_resilience.py +0 -0
  401. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/link/test_workload_integrity.py +0 -0
  402. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/release/test_private_pty_argv_native.py +0 -0
  403. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/release/test_tray_installer.py +0 -0
  404. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/release/test_tray_memory_oracle.py +0 -0
  405. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/release/test_windows_psc_install_native.py +0 -0
  406. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/release/test_windows_psc_upgrade_native.py +0 -0
  407. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/release/tray_endpoint_harness.py +0 -0
  408. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/release/tray_launcher_probe.py +0 -0
  409. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/release/tray_memory_oracle.py +0 -0
  410. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_agent_log.py +0 -0
  411. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_agents.py +0 -0
  412. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_agents_kind.py +0 -0
  413. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_antigravity.py +0 -0
  414. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_aplexer_resolution.py +0 -0
  415. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_attachments.py +0 -0
  416. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_cgroup_agents.py +0 -0
  417. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_cli.py +0 -0
  418. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_daemon.py +0 -0
  419. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_daemon_fallback.py +0 -0
  420. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_daemon_wire.py +0 -0
  421. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_engines.py +0 -0
  422. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_env.py +0 -0
  423. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_github.py +0 -0
  424. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_hooks.py +0 -0
  425. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_inherited_cgroup.py +0 -0
  426. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_inherited_cgroup_kernel_proof.py +0 -0
  427. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_logs.py +0 -0
  428. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_main.py +0 -0
  429. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_profiles.py +0 -0
  430. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_repos.py +0 -0
  431. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_serve.py +0 -0
  432. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_serve_http.py +0 -0
  433. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_session_cgroup_kernel_proof.py +0 -0
  434. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_session_enum.py +0 -0
  435. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_sessions.py +0 -0
  436. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_sessions_attach.py +0 -0
  437. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_sessions_create_routing.py +0 -0
  438. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_sessions_kill.py +0 -0
  439. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_sessions_mem_cap.py +0 -0
  440. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_sessions_rename.py +0 -0
  441. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_sessions_warnings.py +0 -0
  442. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_tree.py +0 -0
  443. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_usage.py +0 -0
  444. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_windows_config_ci_selection.py +0 -0
  445. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_windows_session_lifecycle.py +0 -0
  446. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_windows_startup.py +0 -0
  447. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/test_workspaces.py +0 -0
  448. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/__init__.py +0 -0
  449. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/conftest.py +0 -0
  450. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_app.py +0 -0
  451. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_autostart.py +0 -0
  452. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_cli.py +0 -0
  453. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_endpoint_native.py +0 -0
  454. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_gateway_auth.py +0 -0
  455. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_icons.py +0 -0
  456. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_model.py +0 -0
  457. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_private_replacement.py +0 -0
  458. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_single_instance.py +0 -0
  459. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_status_client.py +0 -0
  460. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_supervisor.py +0 -0
  461. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_vault_password.py +0 -0
  462. {pocketshell-0.5.15 → pocketshell-0.5.16}/tests/tray/test_windows_sessions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pocketshell
3
- Version: 0.5.15
3
+ Version: 0.5.16
4
4
  Summary: Unified server-side Python utility for the PocketShell Android and desktop clients.
5
5
  Project-URL: Homepage, https://github.com/PocketShell-io/pocketshell-cli
6
6
  Project-URL: Issues, https://github.com/PocketShell-io/pocketshell-cli/issues
@@ -23,6 +23,7 @@ Requires-Dist: aplexer<0.2,>=0.1.19; sys_platform == 'linux'
23
23
  Requires-Dist: argon2-cffi>=23.1.0
24
24
  Requires-Dist: click>=8.2.0
25
25
  Requires-Dist: cryptography>=42
26
+ Requires-Dist: pyhpke<1,>=0.6
26
27
  Requires-Dist: pyyaml>=6.0
27
28
  Requires-Dist: quse>=0.0.15
28
29
  Provides-Extra: dev
@@ -0,0 +1,112 @@
1
+ # Login through a TLS-intercepting egress proxy (design and blocker)
2
+
3
+ Status: **broker deployed and production key pinned (2026-11-27).**
4
+ The plain path still refuses an intercepting proxy, which is correct. The opt-in
5
+ sealed transport (`POCKETSHELL_BROKER_SEALED=1`, `pocketshell.account.sealed`) is
6
+ in this repo, and its broker route came from PocketShell-io/pocketshell-sync PR #3
7
+ (`docs/SEALED-TRANSPORT.md` there has the wire format and the key runbook). The
8
+ broker serves `POST /sealed` with the SSM key `/pocketshell-sync/sealed-transport-key`;
9
+ its public half is pinned in `PINNED_KEYS` (`sealed.py`, kid `575a6a86`). Sealed
10
+ mode works from the first CLI release that contains this pin.
11
+
12
+ Rotation is not supported yet: the broker accepts only its current key, so the
13
+ CLI must pin exactly one key until the broker accepts a current+previous pair.
14
+
15
+ Usage once released: `POCKETSHELL_BROKER_SEALED=1 pocketshell login --no-open`
16
+ with the sandbox's `HTTPS_PROXY` (and CA bundle) set. Sealed mode applies to
17
+ `login`, `whoami`, `logout` and token mints against the production broker only.
18
+ `pocketshell gateway ssh/proxy` talk to the gateway, not the broker, and are not
19
+ covered.
20
+
21
+ ## The case
22
+
23
+ Some managed cloud sandboxes have no direct DNS or routing. Their only egress
24
+ is an environment HTTP proxy (`HTTPS_PROXY`) that terminates TLS and
25
+ re-signs it with its own CA. For example, a `CONNECT` probe of the production
26
+ broker through one such proxy completes, but the leaf certificate is issued by
27
+ the proxy operator, not by a public CA. Everything sent inside that "TLS"
28
+ session is readable by the proxy, including `device_code` and the `psc_`
29
+ session token returned by `/auth/device/token`.
30
+
31
+ ## Why the current client refuses (and must keep refusing)
32
+
33
+ See [account.md](account.md#network-and-trust). Token-bearing requests ignore
34
+ proxy variables and `SSL_CERT_FILE`/`SSL_CERT_DIR`, never follow redirects, and
35
+ verify against the platform CA bundle only.
36
+
37
+ Each of the usual fixes breaks that guarantee:
38
+
39
+ | Change | Why it is not acceptable |
40
+ | --- | --- |
41
+ | Honour `HTTPS_PROXY` | Direct DNS fails, so this is needed, but alone it makes the request go to the interceptor and then fail certificate verification. |
42
+ | Also trust the proxy CA / `SSL_CERT_FILE` | The proxy then reads `device_code` and the 30-day `psc_` token. The proxy is an eavesdropper by construction. |
43
+ | Insecure mode, pinning the proxy leaf | Same disclosure. |
44
+ | Pinning the broker's own TLS leaf | Fails closed, as it should: the proxy presents a different leaf, so nothing completes. |
45
+
46
+ TLS between the CLI and the broker cannot be end-to-end through this proxy, so
47
+ the protection has to live **above TLS**.
48
+
49
+ ## Verified facts
50
+
51
+ - Broker: AWS API Gateway HTTP API + Lambda in eu-west-1 (default endpoint
52
+ `https://a7sota2qic.execute-api.eu-west-1.amazonaws.com`). Canonical repo:
53
+ private `PocketShell-io/pocketshell-sync` (`lambda/device-flow.mjs`,
54
+ `docs/CLI-DEVICE-FLOW.md`). Infra stack lives in `aws-infra`.
55
+ - Nothing in that repo (or in this one) provides an application-layer sealed
56
+ channel, a pinned broker key for the CLI, or a first-party tunnel that avoids
57
+ the interceptor. The only broker public key is the RS256 gateway-JWT key at
58
+ `GET /gateway/jwks`, which signs tokens and cannot be used to protect a
59
+ request, and which would itself be fetched through the proxy.
60
+ - This repo's latest PyPI release when checked was 0.5.15; `main` is 0.5.16.
61
+ No released version supports this case.
62
+
63
+ ## Design (as implemented)
64
+
65
+ Use an established construction, not custom crypto: **HPKE (RFC 9180) with
66
+ Oblivious-HTTP-style request/response encapsulation (RFC 9458)**. The proxy
67
+ acts as the (untrusted) relay.
68
+
69
+ 1. The broker publishes an HPKE key config (for example DHKEM(P-256) or
70
+ X25519, HKDF-SHA256, AES-128-GCM). The private key stays server-side; with
71
+ P-256 it can stay in AWS KMS (`DeriveSharedSecret`).
72
+ 2. The **public key and key id are pinned inside the CLI release**, with a short
73
+ list of accepted keys for rotation. It is never fetched through the proxy
74
+ and never taken from the environment.
75
+ 3. A new broker route accepts `POST` of an encapsulated request (`message/ohttp-req`
76
+ style): the inner request is the existing `/auth/device/start`,
77
+ `/auth/device/token`, `/cli/gateway/token`, `/cli/session` or `/cli/logout`
78
+ call, including its body and `Authorization` header. The Lambda decapsulates,
79
+ dispatches internally to the existing handlers and encapsulates the
80
+ response, so `device_code` and `psc_` never appear in clear outside the
81
+ client and the Lambda. The `Origin`-refusal rule applies to the inner request.
82
+ 4. The CLI uses this transport only when explicitly opted in (`POCKETSHELL_BROKER_SEALED=1`, exact value). The default direct
83
+ TLS path is unchanged.
84
+ 5. In sealed mode the outer connection may use the environment proxy and its CA,
85
+ but carries only ciphertext and public routing data. There is no fallback to
86
+ the plain path in either direction: any decapsulation, key id, length or
87
+ replay failure aborts the command.
88
+ 6. Only the approved origins are contacted, with no redirects. The verification
89
+ URL printed to the user stays pinned to `https://app.pocketshell.io`. The
90
+ user approves in their own browser, so the cloud never holds a browser session.
91
+
92
+ Residual exposure the proxy still has: it sees that a login happened, its timing
93
+ and size, and can withhold service. It cannot read or alter the credentials.
94
+
95
+ ## Work split
96
+
97
+ - `pocketshell-sync` (broker): key config, sealed route, tests with fixed vectors,
98
+ deploy. This must land and be deployed first. It needs an owner decision on
99
+ key custody (KMS vs Secrets Manager) and rollout.
100
+ - `pocketshell-cli` (this repo): pinned key list, opt-in transport in
101
+ `pocketshell.account.broker`, a vetted HPKE implementation (for example
102
+ `cryptography`'s HPKE support if the pinned version has it, otherwise a
103
+ maintained library), and tests against the broker vectors: synthetic secrets,
104
+ an intercepting fake proxy that records every byte, a wrong-key broker, and
105
+ replay/truncation cases.
106
+ - Hub: nothing, except tracking the dependency.
107
+
108
+ ## What was not verified
109
+
110
+ The cloud sandbox itself was not reachable from the worker that wrote this, so
111
+ the real proxy behaviour above rests on the probe reported in the task. No
112
+ login credentials were created or sent.
@@ -146,6 +146,9 @@ device. See [keys.md](keys.md).
146
146
  commands won't work there. If no CA bundle exists at the default location
147
147
  (e.g. a python.org macOS build without "Install Certificates"), TLS
148
148
  verification fails rather than falling back to the environment.
149
+ Behind a TLS-intercepting proxy login cannot work safely today; see
150
+ [account-intercepting-proxy.md](account-intercepting-proxy.md) for why and the
151
+ opt-in sealed transport that fixes it.
149
152
  - Beyond those variables and `POCKETSHELL_BROKER_URL` (see above), the
150
153
  process environment is trusted. An `.envrc` or profile that can set
151
154
  `PYTHONPATH`, `LD_PRELOAD` and the like can run code inside the CLI
@@ -182,6 +185,7 @@ device. See [keys.md](keys.md).
182
185
  | --- | --- |
183
186
  | `POCKETSHELL_BROKER_URL` | Broker base URL for `login` (default: the production broker). Must be `https://` with no credentials, query or fragment. An existing session always uses the broker stored with it, and the command refuses to run when this variable names a different one. |
184
187
  | `POCKETSHELL_DEV_WEB_ORIGIN` | Staging and development only: the trusted approval origin, as a bare `https://host[:port]`. It's honored only when `POCKETSHELL_BROKER_URL` is also set. |
188
+ | `POCKETSHELL_BROKER_SEALED=1` | Opt in to the sealed broker transport for networks that intercept TLS (production broker only; see [account-intercepting-proxy.md](account-intercepting-proxy.md)). The only mode that honors `HTTPS_PROXY` and the ambient CA bundle, and only for ciphertext; it never falls back to the plain path. |
185
189
  | `POCKETSHELL_BROKER_INSECURE_DEV=1` | Development and tests only: also allows `http://` when the host is loopback (`127.0.0.0/8`, `::1`, `localhost`). |
186
190
 
187
191
  ## Exit codes
@@ -148,10 +148,24 @@ The tray builder also requires `--endpoint-backend OWNED_OPENSSH_OUTPUT` and
148
148
  `--endpoint-backend-receipt-sha256 RECEIPT_SHA256`. Build the pinned backend with
149
149
  `scripts/release/build_backend_windows.py --part openssh --work FRESH_WORK --out
150
150
  BACKEND_OUTPUT`; its `openssh` directory includes the measured `receipt.json`.
151
- The private OpenSSH source overlay derives Bash and command PATH from its own
152
- release directory, not the registry's DefaultShell or user/system PATH. Plain
153
- `pocketshell` and `a` commands from older PSC clients therefore resolve the
154
- bundled executables without client provisioning. The builder verifies the
151
+ The private OpenSSH source overlay derives the Bash executable from its own
152
+ release directory, not the registry's DefaultShell. Session PATH is the managed
153
+ runtime directories first (so plain `pocketshell` and `a` from older PSC clients
154
+ resolve the bundled executables, which also stay pinned as exported Bash
155
+ functions), followed by the expanded machine and user registry `Path` values,
156
+ read fresh at every session start (REG_EXPAND_SZ entries such as `%USERPROFILE%\...` expand against the user's own environment block, not sshd-session's closed one) so tools installed later (claude, codex, npm,
157
+ git, ...) are found without reinstalling. Interactive shells, both the SSH PTY
158
+ and the aplexer `shell` engine, run `bash --login -i`, so the user's
159
+ `~/.bash_profile` and `~/.bashrc` apply as in Git Bash. Exec commands and probes
160
+ stay `bash --noprofile --norc -c` with `BASH_ENV`/`ENV` cleared, so a user's
161
+ startup files can never change a non-interactive command. Durable `a` sessions (shell and agent engines) are
162
+ spawned by `a start` / `pocketshell sessions create` run inside that SSH session,
163
+ so they inherit this environment; the bundled `/etc/profile` keeps
164
+ `MSYS2_PATH_TYPE=inherit`. Already-running `a` workers and their shells keep the
165
+ environment they were started with: after upgrading, stop and recreate old
166
+ sessions. The guardian daemon's own closed environment is unchanged. The `guardian-login-shell` source trio pins
167
+ the `--login -i` engine command (`DERIVATION.diff` is one line).
168
+ The builder verifies the
155
169
  complete rebuilt executable/DLL inventory and every digest before staging it.
156
170
  For this managed Bash, PTY and non-PTY commands use its MSYS argument decoder,
157
171
  which requires escaping every backslash as well as quotes. A private spawn
@@ -11,7 +11,7 @@ name = "pocketshell"
11
11
  # since the extraction (PocketShell-io/pocketshell#2643): the first
12
12
  # self-governed release is 0.5.5, continuing from the last app-coupled
13
13
  # release 0.5.4 so `uv tool upgrade pocketshell` stays monotonic.
14
- version = "0.5.15"
14
+ version = "0.5.16"
15
15
  description = "Unified server-side Python utility for the PocketShell Android and desktop clients."
16
16
  readme = "README.md"
17
17
  requires-python = ">=3.11"
@@ -57,6 +57,9 @@ dependencies = [
57
57
  # of transitive dependency choices. 42 is a conservative floor for the
58
58
  # APIs used (GCM `update_into`, OpenSSH private-key serialization).
59
59
  "cryptography>=42",
60
+ # Sealed broker transport (RFC 9180 HPKE) for logins behind a TLS-intercepting
61
+ # proxy; see docs/account-intercepting-proxy.md. No custom primitives.
62
+ "pyhpke>=0.6,<1",
60
63
  # The account vault shares the clients' Argon2id v1 format. Never use
61
64
  # the separate local device-password vault's PBKDF2 format for sync.
62
65
  "argon2-cffi>=23.1.0",
@@ -0,0 +1,11 @@
1
+ --- guardian-interactive/guardian.py 2026-11-17 21:26:59.850772910 +0100
2
+ +++ guardian-login-shell/guardian.py 2026-11-17 21:30:19.519551334 +0100
3
+ @@ -263,7 +263,7 @@
4
+ import tomllib
5
+ backend=tomllib.loads(pathlib.Path(m['configBindings']['backendConfig']).read_text(encoding='utf8'))
6
+ shell=backend.get('engines',{}).get('shell',{})
7
+ - if shell.get('command')!=[m['configBindings']['backendExecutable'],'--noprofile','--norc','-i'] or shell.get('env_unset')!=['BASH_ENV','ENV','ZDOTDIR']:raise RuntimeError('Pinned interactive backend command mismatch')
8
+ + if shell.get('command')!=[m['configBindings']['backendExecutable'],'--login','-i'] or shell.get('env_unset')!=['BASH_ENV','ENV','ZDOTDIR']:raise RuntimeError('Pinned interactive backend command mismatch')
9
+ for p in (m['environment']['TEMP'],m['environment']['TMP']):path_authority(p,m['ownerSID'],True,True)
10
+ if args.check_only:
11
+ print(json.dumps({'phase':'preflight-only','manifestSHA256':manifest_sha,'context':context,'port':m['port'],'sourceSHA256':a.digest(pathlib.Path(__file__)),'daemonSpawned':False,'stateAllocated':False}),flush=True)
@@ -0,0 +1,14 @@
1
+ # Login-shell guardian
2
+
3
+ Derived from `guardian-interactive` by one line (`DERIVATION.diff`): the pinned
4
+ aplexer `engines.shell` command is `[bash, "--login", "-i"]` instead of
5
+ `[bash, "--noprofile", "--norc", "-i"]`, so durable shell sessions read the
6
+ user's `~/.bash_profile` / `~/.bashrc` like Git Bash does. `env_unset` stays
7
+ `["BASH_ENV", "ENV", "ZDOTDIR"]`. `native_api.py` and `policy.py` are unchanged
8
+ (same hashes as `guardian-interactive`).
9
+
10
+ The generated endpoint config selects the pinned command from the guardian's
11
+ own source digest (`service_agent_endpoint.SHELL_ARGV_BY_GUARDIAN`), so an older
12
+ guardian still validates the older command. Older source triples stay trusted
13
+ only so the existing tray-repair path can stop and upgrade enrolled installs.
14
+ Never modify hashes or installed guardian files manually.
@@ -0,0 +1,3 @@
1
+ 75ab56270bdc59e195d980f0fe1164616ff0f43e7a29e9b8920dc454c855e2c7 guardian.py
2
+ cab601e27e9814ee8c4e3cd72e0dfd55fd2808682d302655725885b4a4812231 native_api.py
3
+ e39ee0ea26879f3418e1d14c270a507def71acd84be2e6cfe409afee3bcb1c17 policy.py
@@ -0,0 +1,332 @@
1
+ """Isolated durable guardian candidate. No task registration or enrollment.
2
+ Own private Job and held daemon identity; caller supplies a protected closed manifest.
3
+ """
4
+ import argparse, ctypes as C, ctypes.wintypes as W, hashlib, importlib.util, json, msvcrt, os, pathlib, socket, subprocess, sys, time, uuid
5
+ HERE=pathlib.Path(__file__).resolve().parent
6
+ # Frozen sibling source checks before importing native definitions or policy.
7
+ API_SHA='cab601e27e9814ee8c4e3cd72e0dfd55fd2808682d302655725885b4a4812231';POLICY_SHA='e39ee0ea26879f3418e1d14c270a507def71acd84be2e6cfe409afee3bcb1c17'
8
+ for name,pin in (('native_api.py',API_SHA),('policy.py',POLICY_SHA)):
9
+ if hashlib.sha256((HERE/name).read_bytes()).hexdigest()!=pin:raise RuntimeError('Guardian source custody mismatch')
10
+ sys.path.insert(0,str(HERE))
11
+ import native_api as a
12
+ from policy import absolute, below, validate_manifest, validate_context, validate_stop, config_guard, require_source_pins, servicing_role, require_regular_links
13
+ k,u=a.k,a.u
14
+
15
+ class TOKEN_STATISTICS(C.Structure):
16
+ _fields_=[('TokenIdLow',W.DWORD),('TokenIdHigh',W.LONG),('AuthLow',W.DWORD),('AuthHigh',W.LONG),('Expiration',C.c_longlong),('TokenType',W.DWORD),('ImpersonationLevel',W.DWORD),('DynamicCharged',W.DWORD),('DynamicAvailable',W.DWORD),('GroupCount',W.DWORD),('PrivilegeCount',W.DWORD),('ModifiedLow',W.DWORD),('ModifiedHigh',W.LONG)]
17
+ a.adv.OpenProcessToken.argtypes=[W.HANDLE,W.DWORD,C.POINTER(W.HANDLE)]
18
+ a.adv.GetTokenInformation.argtypes=[W.HANDLE,C.c_int,W.LPVOID,W.DWORD,C.POINTER(W.DWORD)]
19
+
20
+ def token_context():
21
+ token=W.HANDLE()
22
+ if not a.adv.OpenProcessToken(W.HANDLE(-1),8,C.byref(token)):raise C.WinError(C.get_last_error())
23
+ try:
24
+ needed=W.DWORD();a.adv.GetTokenInformation(token,1,None,0,C.byref(needed))
25
+ if not 0<needed.value<=16384:raise RuntimeError('Token metadata bound refused')
26
+ buf=C.create_string_buffer(needed.value)
27
+ if not a.adv.GetTokenInformation(token,1,buf,len(buf),C.byref(needed)):raise C.WinError(C.get_last_error())
28
+ sid=a.sid_text(C.cast(buf,C.POINTER(W.LPVOID))[0])
29
+ session=W.DWORD();token_session=W.DWORD()
30
+ if not k.ProcessIdToSessionId(k.GetCurrentProcessId(),C.byref(session)):raise C.WinError(C.get_last_error())
31
+ if not a.adv.GetTokenInformation(token,12,C.byref(token_session),C.sizeof(token_session),C.byref(needed)) or token_session.value!=session.value:raise RuntimeError('Process/token session mismatch')
32
+ stats=TOKEN_STATISTICS()
33
+ if not a.adv.GetTokenInformation(token,10,C.byref(stats),C.sizeof(stats),C.byref(needed)) or needed.value!=C.sizeof(stats):raise RuntimeError('Token statistics layout mismatch')
34
+ station=u.GetProcessWindowStation()
35
+ return {'ownerSID':sid,'session':session.value,'station':a.object_name(station),'stationVisible':bool(a.desktop_flags(station)['dwFlags']&1),'desktop':a.object_name(u.GetThreadDesktop(k.GetCurrentThreadId())),'activeConsoleSession':k.WTSGetActiveConsoleSessionId(),'authenticationLUID':str((stats.AuthHigh&0xffffffff)<<32|stats.AuthLow)}
36
+ finally:
37
+ if not k.CloseHandle(token):raise C.WinError(C.get_last_error())
38
+
39
+ def ordinary(path,directory=False,allow_servicing=False):
40
+ path=pathlib.Path(path)
41
+ for item in [path,*path.parents]:
42
+ st=item.lstat()
43
+ if getattr(st,'st_file_attributes',0)&0x400:raise RuntimeError('Reparse path refused')
44
+ st=path.stat()
45
+ if directory:
46
+ if not path.is_dir():raise RuntimeError('Directory required')
47
+ else:
48
+ if not path.is_file():raise RuntimeError('Regular file required')
49
+ require_regular_links(path,st.st_nlink,allow_servicing)
50
+ return path
51
+
52
+ TRUSTED_INSTALLER='S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464'
53
+ def check_acl(path,owner_sid,role='private',protected=False,servicing=False):
54
+ owner=W.LPVOID();group=W.LPVOID();dacl=W.LPVOID();sacl=W.LPVOID();sd=W.LPVOID()
55
+ a.adv.GetNamedSecurityInfoW.argtypes=[W.LPWSTR,C.c_int,W.DWORD,C.POINTER(W.LPVOID),C.POINTER(W.LPVOID),C.POINTER(W.LPVOID),C.POINTER(W.LPVOID),C.POINTER(W.LPVOID)]
56
+ code=a.adv.GetNamedSecurityInfoW(str(path),1,5,C.byref(owner),C.byref(group),C.byref(dacl),C.byref(sacl),C.byref(sd))
57
+ if code:raise RuntimeError('Path ACL query failed '+str(code))
58
+ try:
59
+ trusted={owner_sid,'S-1-5-18','S-1-5-32-544',TRUSTED_INSTALLER}
60
+ if servicing:trusted.discard(owner_sid) # Servicing images require system-owned, non-user-writable authority.
61
+ actual_owner=a.sid_text(owner)
62
+ if actual_owner not in ({owner_sid} if role=='private' else trusted):raise RuntimeError('Path owner authority mismatch')
63
+ ctrl=W.WORD();rev=W.DWORD()
64
+ if not a.adv.GetSecurityDescriptorControl(sd,C.byref(ctrl),C.byref(rev)) or (protected and not ctrl.value&0x1000):raise RuntimeError('Protected private root required')
65
+ if not dacl:raise RuntimeError('NULL path DACL refused')
66
+ count=C.c_ushort.from_address(dacl.value+4).value
67
+ for i in range(count):
68
+ ace=W.LPVOID()
69
+ if not a.adv.GetAce(dacl,i,C.byref(ace)):raise C.WinError(C.get_last_error())
70
+ header=(C.c_ubyte*4).from_address(ace.value)
71
+ if header[0] not in (0,1):raise RuntimeError('Unsupported path ACE refused')
72
+ if header[0]!=0 or header[1]&8:continue # Deny cannot grant; INHERIT_ONLY does not apply to this object.
73
+ sid=a.sid_text(W.LPVOID(ace.value+8));mask=W.DWORD.from_address(ace.value+4).value
74
+ if sid in trusted:continue
75
+ # Parent create-file/create-directory rights alone do not authorize replacing the protected child.
76
+ mutation=0x500d0150 if role=='ancestor' else 0x500d0116
77
+ if role=='private' or mask&mutation:raise RuntimeError('Foreign path mutation/read authority refused')
78
+ finally:
79
+ if k.LocalFree(sd):raise RuntimeError('ACL descriptor release failed')
80
+
81
+ def path_authority(path,owner_sid,private=False,directory=False,protected=False,allow_servicing=False):
82
+ if allow_servicing and (private or directory or not servicing_role(str(path))):raise RuntimeError('Servicing role misuse refused')
83
+ p=ordinary(path,directory,allow_servicing)
84
+ for parent in reversed(p.parents):check_acl(parent,owner_sid,'ancestor')
85
+ check_acl(p,owner_sid,'private' if private else 'file',protected,allow_servicing)
86
+ return p
87
+
88
+ def times(handle):
89
+ b,e,kt,ut=W.FILETIME(),W.FILETIME(),W.FILETIME(),W.FILETIME()
90
+ if not k.GetProcessTimes(handle,C.byref(b),C.byref(e),C.byref(kt),C.byref(ut)):raise C.WinError(C.get_last_error())
91
+ return str(b.dwHighDateTime<<32|b.dwLowDateTime)
92
+
93
+ class TCPROW(C.Structure):_fields_=[('state',W.DWORD),('localAddress',W.DWORD),('localPort',W.DWORD),('remoteAddress',W.DWORD),('remotePort',W.DWORD),('pid',W.DWORD)]
94
+ ip=C.WinDLL('iphlpapi',use_last_error=True)
95
+ ip.GetExtendedTcpTable.argtypes=[W.LPVOID,C.POINTER(W.DWORD),W.BOOL,W.DWORD,C.c_int,W.DWORD]
96
+ def listeners(port):
97
+ size=W.DWORD();code=ip.GetExtendedTcpTable(None,C.byref(size),False,2,3,0)
98
+ if code!=122 or not 4<=size.value<=1048576:raise RuntimeError('Listener allocation refused')
99
+ data=C.create_string_buffer(size.value)
100
+ code=ip.GetExtendedTcpTable(data,C.byref(size),False,2,3,0)
101
+ if code:raise RuntimeError('Listener query failed '+str(code))
102
+ count=W.DWORD.from_buffer(data).value
103
+ if 4+count*C.sizeof(TCPROW)>len(data):raise RuntimeError('Listener count exceeds buffer')
104
+ rows=[]
105
+ for i in range(count):
106
+ r=TCPROW.from_buffer(data,4+i*C.sizeof(TCPROW))
107
+ if socket.ntohs(r.localPort&0xffff)==port:rows.append({'pid':r.pid,'address':socket.inet_ntoa(int(r.localAddress).to_bytes(4,'little'))})
108
+ return rows
109
+
110
+ def new_job():
111
+ job=k.CreateJobObjectW(None,None)
112
+ if not job:raise C.WinError(C.get_last_error())
113
+ try:
114
+ limits=a.LIMITS();limits.BasicLimitInformation.LimitFlags=0x2000
115
+ if not k.SetInformationJobObject(job,9,C.byref(limits),C.sizeof(limits)):raise C.WinError(C.get_last_error())
116
+ return job
117
+ except Exception:
118
+ k.CloseHandle(job);raise
119
+
120
+ def start_owned(image,arguments,desktop,job,label,pi):
121
+ # PI storage belongs to caller before creation, retaining custody even on failure.
122
+ files=[];attrs=None;initialized=False;returned=False
123
+ try:
124
+ for path,mode in ((os.devnull,'rb'),(LOG_ROOT/(label+'.stdout.log'),'wb'),(LOG_ROOT/(label+'.stderr.log'),'wb')):
125
+ stream=open(path,mode,buffering=0);files.append(stream);os.set_inheritable(stream.fileno(),True)
126
+ handles=(W.HANDLE*4)(*[msvcrt.get_osfhandle(stream.fileno()) for stream in files],desktop)
127
+ if len(set(int(handle) for handle in handles))!=4 or not a.desktop_flags(desktop)['fInherit']:raise RuntimeError('Exactly three stdio and one actual inheritable HDESKTOP required')
128
+ size=C.c_size_t();k.InitializeProcThreadAttributeList(None,1,0,C.byref(size))
129
+ if not size.value:raise C.WinError(C.get_last_error())
130
+ attrs=C.create_string_buffer(size.value)
131
+ if not k.InitializeProcThreadAttributeList(attrs,1,0,C.byref(size)):raise C.WinError(C.get_last_error())
132
+ initialized=True
133
+ if not k.UpdateProcThreadAttribute(attrs,0,0x20002,handles,C.sizeof(handles),None,None):raise C.WinError(C.get_last_error())
134
+ si=a.SIEX();si.StartupInfo.cb=C.sizeof(si);si.StartupInfo.lpDesktop=STATION+'\\'+DESKTOP
135
+ si.StartupInfo.dwFlags=0x101;si.StartupInfo.wShowWindow=0
136
+ si.StartupInfo.hStdInput,si.StartupInfo.hStdOutput,si.StartupInfo.hStdError=handles[:3]
137
+ si.lpAttributeList=C.cast(attrs,W.LPVOID)
138
+ command=C.create_unicode_buffer(subprocess.list2cmdline([str(image),*arguments]))
139
+ if not k.CreateProcessW(str(image),command,None,None,True,0x08080404,C.cast(ENV_BLOCK,W.LPVOID),str(ROOT),C.byref(si.StartupInfo),C.byref(pi)):raise C.WinError(C.get_last_error())
140
+ if not k.AssignProcessToJobObject(job,pi.hProcess):raise C.WinError(C.get_last_error())
141
+ member=W.BOOL()
142
+ if not k.IsProcessInJob(pi.hProcess,job,C.byref(member)) or not member.value:raise RuntimeError('Actual owned process Job assignment absent')
143
+ if k.ResumeThread(pi.hThread)==0xffffffff:raise C.WinError(C.get_last_error())
144
+ returned=True;return pi
145
+ finally:
146
+ errors=[]
147
+ if not returned and pi.hProcess:
148
+ stopped=False
149
+ try:
150
+ if k.WaitForSingleObject(pi.hProcess,0)!=0:
151
+ if not k.TerminateProcess(pi.hProcess,1):raise C.WinError(C.get_last_error())
152
+ if k.WaitForSingleObject(pi.hProcess,5000)!=0:raise RuntimeError('Exact owned startup process did not stop')
153
+ stopped=True
154
+ except Exception as exc:errors.append(str(exc))
155
+ # On stop failure keep held handles in caller PI for its checked cleanup.
156
+ if stopped:
157
+ for attribute in ('hThread','hProcess'):
158
+ handle=getattr(pi,attribute)
159
+ if handle:
160
+ if not k.CloseHandle(handle):errors.append('Owned startup '+attribute+' close failed '+str(C.get_last_error()))
161
+ else:setattr(pi,attribute,None)
162
+ if initialized:k.DeleteProcThreadAttributeList(attrs)
163
+ for stream in files:
164
+ try:stream.close()
165
+ except Exception as exc:errors.append('Owned startup stream close failed '+str(exc))
166
+ if errors:raise RuntimeError('Checked owned startup cleanup failed: '+repr(errors))
167
+
168
+ def release(pi):
169
+ for attribute in ('hThread','hProcess'):
170
+ handle=getattr(pi,attribute)
171
+ if handle:
172
+ if not k.CloseHandle(handle):raise C.WinError(C.get_last_error())
173
+ setattr(pi,attribute,None)
174
+
175
+
176
+ def startup_members(job,pins,result,owner_sid):
177
+ listed=a.JOBPIDS()
178
+ if not k.QueryInformationJobObject(job,3,C.byref(listed),C.sizeof(listed),None):raise C.WinError(C.get_last_error())
179
+ if listed.NumberOfAssignedProcesses>64 or listed.NumberOfProcessIdsInList>64:raise RuntimeError('Startup Job diagnostic bound exceeded')
180
+ rows=result.setdefault('startupMembers',[]);allow={os.path.normcase(absolute(p)):h for p,h in pins.items()}
181
+ for i in range(listed.NumberOfProcessIdsInList):
182
+ pid=int(listed.ProcessIdList[i]);handle=k.OpenProcess(0x1000,False,pid)
183
+ if not handle:raise RuntimeError('Unknown startup Job process open failure '+str(C.get_last_error()))
184
+ try:
185
+ member=W.BOOL()
186
+ if not k.IsProcessInJob(handle,job,C.byref(member)) or not member.value:raise RuntimeError('Startup exact Job membership refused')
187
+ birth=times(handle);image=C.create_unicode_buffer(32768);size=W.DWORD(len(image));code=W.DWORD()
188
+ row={'pid':pid,'creationFILETIME':birth,'exactOwnedJobMembership':True};rows.append(row)
189
+ if not k.QueryFullProcessImageNameW(handle,0,image,C.byref(size)):
190
+ row['imageQueryError']=C.get_last_error()
191
+ if not k.GetExitCodeProcess(handle,C.byref(code)) or code.value==259:raise RuntimeError('Live/unknown startup image query refusal')
192
+ stamps=[]
193
+ for _ in range(2):
194
+ b,e,kt,ut=W.FILETIME(),W.FILETIME(),W.FILETIME(),W.FILETIME()
195
+ if not k.GetProcessTimes(handle,C.byref(b),C.byref(e),C.byref(kt),C.byref(ut)):raise C.WinError(C.get_last_error())
196
+ stamps.append((str(b.dwHighDateTime<<32|b.dwLowDateTime),e.dwHighDateTime<<32|e.dwLowDateTime))
197
+ if stamps[0]!=stamps[1] or stamps[0][0]!=birth or stamps[0][1]<int(birth) or not stamps[0][1]:raise RuntimeError('Unknown exited observation refused')
198
+ row.update(provenExited=True,exitCode=code.value,exitFILETIME=str(stamps[0][1]));continue
199
+ row['image']=image.value
200
+ pin=allow.get(os.path.normcase(os.path.abspath(image.value)))
201
+ if servicing_role(image.value):
202
+ path_authority(image.value,owner_sid,allow_servicing=True)
203
+ elif not pin or a.digest(ordinary(image.value))!=pin:raise RuntimeError('Startup image outside exact manifest custody')
204
+ finally:
205
+ if not k.CloseHandle(handle):raise C.WinError(C.get_last_error())
206
+ return rows
207
+
208
+ def accounting(job):
209
+ info=a.ACCOUNTING()
210
+ if not k.QueryInformationJobObject(job,1,C.byref(info),C.sizeof(info),None):raise C.WinError(C.get_last_error())
211
+ return info.ActiveProcesses
212
+
213
+ k.CreateFileW.argtypes=[W.LPCWSTR,W.DWORD,W.DWORD,W.LPVOID,W.DWORD,W.DWORD,W.HANDLE];k.CreateFileW.restype=W.HANDLE
214
+
215
+ def allocate_generation(base,owner_sid):
216
+ lock_path=base/'INSTANCE.lock'
217
+ if lock_path.exists():path_authority(lock_path,owner_sid,True)
218
+ lock=k.CreateFileW(str(lock_path),0x80000000,0,None,4,0x00200000,None) # OPEN_ALWAYS, OPEN_REPARSE_POINT, exclusive share.
219
+ if not lock or lock==W.HANDLE(-1).value:raise RuntimeError('Another invocation or lock failure; no generation reuse')
220
+ try:
221
+ path_authority(lock_path,owner_sid,True)
222
+ generation=base/('generation-'+uuid.uuid4().hex)
223
+ generation.mkdir() # Fresh own child; do not clear or reuse any historical state.
224
+ path_authority(generation,owner_sid,True,True)
225
+ return generation,lock
226
+ except Exception:
227
+ if not k.CloseHandle(lock):raise RuntimeError('Generation lock cleanup failed')
228
+ raise
229
+
230
+ def publish_current(base,generation,ready,manifest_sha,owner_sid):
231
+ current=base/'CURRENT.json'
232
+ if current.exists():path_authority(current,owner_sid,True)
233
+ payload={'version':1,'generation':str(generation),'ready':str(ready),'manifestSHA256':manifest_sha}
234
+ temporary=generation/'CURRENT.tmp'
235
+ temporary.write_text(json.dumps(payload,indent=2),encoding='utf8')
236
+ os.replace(temporary,current) # Replace only this declared public pointer; retain every generation's evidence.
237
+
238
+ def main():
239
+ global ROOT,LOG_ROOT,STATION,DESKTOP,ENV_BLOCK
240
+ parser=argparse.ArgumentParser();parser.add_argument('--manifest',required=True);parser.add_argument('--check-only',action='store_true');args=parser.parse_args()
241
+ if (C.sizeof(W.DWORD),C.sizeof(W.HANDLE),C.sizeof(TOKEN_STATISTICS),C.sizeof(a.SI),C.sizeof(a.SIEX),C.sizeof(a.PI))!=(4,8,56,104,112,24):raise RuntimeError('Qualified x64 Windows native ABI mismatch')
242
+ manifest_path=ordinary(absolute(args.manifest))
243
+ if manifest_path.stat().st_size>8388608:raise RuntimeError('Manifest bound exceeded')
244
+ manifest_bytes=manifest_path.read_bytes();manifest_sha=hashlib.sha256(manifest_bytes).hexdigest()
245
+ m=validate_manifest(json.loads(manifest_bytes));context=validate_context(token_context(),m['ownerSID'])
246
+ ROOT=path_authority(m['root'],m['ownerSID'],True,True,True);state=path_authority(m['state'],m['ownerSID'],True,True);LOG_ROOT=state
247
+ below(str(manifest_path),str(ROOT));path_authority(manifest_path,m['ownerSID'],True)
248
+ require_source_pins(m['pins'],[str(pathlib.Path(__file__)),str(HERE/'native_api.py'),str(HERE/'policy.py')])
249
+ for p in (pathlib.Path(__file__),HERE/'native_api.py',HERE/'policy.py'):
250
+ below(str(p),str(ROOT));path_authority(p,m['ownerSID'],True)
251
+ path_authority(m['config'],m['ownerSID'],True)
252
+ for p,pin in m['pins'].items():
253
+ if servicing_role(p):raise RuntimeError('OS servicing images must not be hash-pinned')
254
+ if a.digest(path_authority(p,m['ownerSID']))!=pin:raise RuntimeError('Startup exact file custody mismatch')
255
+ for p in ('C:/Windows/System32/cmd.exe','C:/Windows/System32/conhost.exe'):
256
+ path_authority(p,m['ownerSID'],allow_servicing=True)
257
+ if a.digest(pathlib.Path(sys.executable))!=m['pins'][m['python']] or os.path.normcase(os.path.abspath(sys.executable))!=os.path.normcase(absolute(m['python'])):raise RuntimeError('Actual Python executable mismatch')
258
+ config_guard(pathlib.Path(m['config']).read_text(encoding='utf8'),m['port'],m['configBindings'])
259
+ for key in ('hostKey','authorizedKeys'):path_authority(m['configBindings'][key],m['ownerSID'],True)
260
+ for key in ('sftp','backendExecutable','backendDLL'):path_authority(m['configBindings'][key],m['ownerSID'])
261
+ path_authority(m['configBindings']['backendConfig'],m['ownerSID'],True)
262
+ for key in ('APLEXER_RUNTIME_DIR','APLEXER_STATE_DIR','XDG_CONFIG_HOME','XDG_STATE_HOME','XDG_DATA_HOME','XDG_CACHE_HOME'):path_authority(m['configBindings']['setEnv'][key],m['ownerSID'],True,True)
263
+ import tomllib
264
+ backend=tomllib.loads(pathlib.Path(m['configBindings']['backendConfig']).read_text(encoding='utf8'))
265
+ shell=backend.get('engines',{}).get('shell',{})
266
+ if shell.get('command')!=[m['configBindings']['backendExecutable'],'--login','-i'] or shell.get('env_unset')!=['BASH_ENV','ENV','ZDOTDIR']:raise RuntimeError('Pinned interactive backend command mismatch')
267
+ for p in (m['environment']['TEMP'],m['environment']['TMP']):path_authority(p,m['ownerSID'],True,True)
268
+ if args.check_only:
269
+ print(json.dumps({'phase':'preflight-only','manifestSHA256':manifest_sha,'context':context,'port':m['port'],'sourceSHA256':a.digest(pathlib.Path(__file__)),'daemonSpawned':False,'stateAllocated':False}),flush=True)
270
+ return 0
271
+ STATION=context['station'];DESKTOP='PocketShellPrivate_'+uuid.uuid4().hex
272
+ ENV_BLOCK=C.create_unicode_buffer('\0'.join(key+'='+value for key,value in sorted(m['environment'].items(),key=lambda x:x[0].casefold()))+'\0\0')
273
+ if listeners(m['port']):raise RuntimeError('Candidate port occupied')
274
+ state_base=state;state,instance_lock=allocate_generation(state_base,m['ownerSID']);LOG_ROOT=state
275
+ ready,stop,closed=[state/name for name in ('READY.json','STOP.json','CLOSED.json')]
276
+ result={'accepted':False,'manifestSHA256':manifest_sha,'context':context,'cleanupErrors':[]};desk=None;job=None;sd=W.LPVOID();pi=a.PI()
277
+ failed=False
278
+ try:
279
+ sddl='O:'+m['ownerSID']+'D:P(A;;GA;;;SY)(A;;GA;;;BA)(A;;GA;;;'+m['ownerSID']+')'
280
+ if not a.adv.ConvertStringSecurityDescriptorToSecurityDescriptorW(sddl,1,C.byref(sd),None):raise C.WinError(C.get_last_error())
281
+ sa=a.SA(C.sizeof(a.SA),sd,True);desk=u.CreateDesktopW(DESKTOP,None,None,0,0x201ff,C.byref(sa))
282
+ if not desk:raise C.WinError(C.get_last_error())
283
+ result['privateDesktop']=STATION+'\\'+DESKTOP;result['desktopACL']=a.verify_desktop_acl(desk,m['ownerSID'])
284
+ job=new_job();start_owned(pathlib.Path(m['daemon']),['-D','-f',m['config']],desk,job,'daemon',pi)
285
+ birth=times(pi.hProcess);deadline=time.monotonic()+10
286
+ while True:
287
+ startup_members(job,m['pins'],result,m['ownerSID'])
288
+ if listeners(m['port'])==[{'pid':pi.dwProcessId,'address':'127.0.0.1'}]:break
289
+ if k.WaitForSingleObject(pi.hProcess,0)!=258 or time.monotonic()>deadline:raise RuntimeError('Exact private listener absent')
290
+ time.sleep(.05)
291
+ result.update(pid=pi.dwProcessId,creationFILETIME=birth,guardianPID=k.GetCurrentProcessId(),sourceSHA256=a.digest(pathlib.Path(__file__)),port=m['port'],heldProcessHandle=True,ownedJob=True)
292
+ ready.write_text(json.dumps(result,indent=2),encoding='utf8')
293
+ publish_current(state_base,state,ready,manifest_sha,m['ownerSID'])
294
+ print(json.dumps({'phase':'ready','pid':pi.dwProcessId,'creationFILETIME':birth,'guardianPID':k.GetCurrentProcessId(),'port':m['port']}),flush=True)
295
+ while not stop.exists():
296
+ if k.WaitForSingleObject(pi.hProcess,1000)!=258:raise RuntimeError('Held daemon exited unexpectedly')
297
+ path_authority(stop,m['ownerSID'],True)
298
+ if stop.stat().st_size>4096:raise RuntimeError('Stop bound exceeded')
299
+ validate_stop(json.loads(stop.read_text(encoding='utf8')),pi.dwProcessId,birth,manifest_sha)
300
+ result['requestedOwnedJobStop']=True
301
+ except Exception as exc:
302
+ result['failure']=str(exc);failed=True
303
+ finally:
304
+ errors=result['cleanupErrors']
305
+ if job:
306
+ try:
307
+ result['activeBeforeStop']=accounting(job)
308
+ if result['activeBeforeStop'] and not k.TerminateJobObject(job,1 if failed else 0):raise C.WinError(C.get_last_error())
309
+ deadline=time.monotonic()+5
310
+ while accounting(job):
311
+ if time.monotonic()>deadline:raise RuntimeError('Owned Job drain timeout')
312
+ time.sleep(.05)
313
+ result['activeAtClose']=accounting(job)
314
+ except Exception as exc:errors.append(str(exc))
315
+ if pi.hProcess:
316
+ try:
317
+ if k.WaitForSingleObject(pi.hProcess,5000)!=0:raise RuntimeError('Held daemon cleanup timeout')
318
+ release(pi)
319
+ except Exception as exc:errors.append(str(exc))
320
+ if job and not k.CloseHandle(job):errors.append('Job close failed')
321
+ if desk and not u.CloseDesktop(desk):errors.append('Private desktop close failed')
322
+ if sd and k.LocalFree(sd):errors.append('Descriptor release failed')
323
+ try:
324
+ if listeners(m['port']):errors.append('Candidate listener remains')
325
+ except Exception as exc:errors.append(str(exc))
326
+ result['accepted']=not failed and not errors and result.get('requestedOwnedJobStop') is True and result.get('activeAtClose')==0
327
+ if not k.CloseHandle(instance_lock):errors.append('Invocation lock close failed')
328
+ result['accepted']=not failed and not errors and result.get('requestedOwnedJobStop') is True and result.get('activeAtClose')==0
329
+ closed.write_text(json.dumps(result,indent=2),encoding='utf8')
330
+ print(json.dumps({'phase':'closed','accepted':result['accepted'],'cleanupErrors':errors}),flush=True)
331
+ return 0 if result['accepted'] else 1
332
+ if __name__=='__main__':sys.exit(main())