@namewta/speculo 1.0.5 → 1.0.6

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 (155) hide show
  1. package/README.md +1 -1
  2. package/dist/src/kernel.d.ts +23 -2
  3. package/dist/src/kernel.js +9 -0
  4. package/dist/src/kernel.js.map +1 -1
  5. package/dist/src/ops-resources.d.ts +3 -0
  6. package/dist/src/ops-resources.js +188 -0
  7. package/dist/src/ops-resources.js.map +1 -0
  8. package/dist/src/refresh.js +20 -2
  9. package/dist/src/refresh.js.map +1 -1
  10. package/dist/src/structured.js +7 -0
  11. package/dist/src/structured.js.map +1 -1
  12. package/dist/src/workflows.js +1 -1
  13. package/dist/src/workflows.js.map +1 -1
  14. package/package.json +1 -1
  15. package/template/.speculo/README.md +3 -3
  16. package/template/.speculo/kernel/README.md +3 -0
  17. package/template/.speculo/kernel/checkpoint.schema.json +138 -4
  18. package/template/commands/archive-and-consolidate.md +5 -1
  19. package/template/commands/status.md +2 -2
  20. package/template/workflows/ops/D-project-deploy/D-project-deploy.md +34 -0
  21. package/template/workflows/ops/H-host-manage/H-host-manage.md +30 -0
  22. package/template/workflows/ops/I-initialize/I-initialize.md +28 -0
  23. package/template/workflows/ops/INDEX.md +15 -17
  24. package/template/workflows/ops/README.md +59 -93
  25. package/template/workflows/ops/_state/status.json +15 -3
  26. package/template/workflows/ops/common/CAPABILITIES.md +23 -0
  27. package/template/workflows/ops/common/USAGE.md +112 -0
  28. package/template/workflows/ops/common/examples/README.md +7 -0
  29. package/template/workflows/ops/common/examples/binding.example.json +12 -0
  30. package/template/workflows/ops/common/examples/compose-app.example.json +56 -0
  31. package/template/workflows/ops/common/examples/credential.example.json +9 -0
  32. package/template/workflows/ops/common/examples/environment-request.example.json +7 -0
  33. package/template/workflows/ops/common/examples/register.example.json +44 -0
  34. package/template/workflows/ops/common/examples/shared-allocation.example.json +37 -0
  35. package/template/workflows/ops/common/rules/activation-and-memory.md +5 -20
  36. package/template/workflows/ops/common/rules/persistence-and-secrets.md +27 -0
  37. package/template/workflows/ops/common/rules/recovery.md +15 -0
  38. package/template/workflows/ops/common/rules/shared-services.md +13 -0
  39. package/template/workflows/ops/common/schemas/allocation.schema.json +92 -0
  40. package/template/workflows/ops/common/schemas/approval.schema.json +41 -21
  41. package/template/workflows/ops/common/schemas/binding.schema.json +73 -0
  42. package/template/workflows/ops/common/schemas/deployment.schema.json +244 -0
  43. package/template/workflows/ops/common/schemas/host.schema.json +88 -0
  44. package/template/workflows/ops/common/schemas/plan.schema.json +1573 -0
  45. package/template/workflows/ops/common/schemas/project.schema.json +55 -11
  46. package/template/workflows/ops/common/schemas/spec.schema.json +1032 -0
  47. package/template/workflows/ops/common/schemas/status.schema.json +758 -17
  48. package/template/workflows/ops/common/service-profiles/custom.md +5 -0
  49. package/template/workflows/ops/common/service-profiles/docker-engine.md +11 -0
  50. package/template/workflows/ops/common/service-profiles/minio.md +7 -0
  51. package/template/workflows/ops/common/service-profiles/mysql.md +7 -0
  52. package/template/workflows/ops/common/service-profiles/redis.md +7 -0
  53. package/template/workflows/ops/common/templates/CONTROLLER-RECORD.md +13 -0
  54. package/template/workflows/ops/common/templates/EXECUTION-PLAN.md +15 -0
  55. package/template/workflows/ops/common/templates/HOST-README.md +11 -0
  56. package/template/workflows/ops/common/templates/PROJECT-README.md +15 -0
  57. package/template/workflows/ops/common/tests/test_ops.py +392 -0
  58. package/template/workflows/ops/common/tools/bootstrap.ps1 +18 -0
  59. package/template/workflows/ops/common/tools/bootstrap.sh +27 -0
  60. package/template/workflows/ops/common/tools/demo-local.py +64 -0
  61. package/template/workflows/ops/common/tools/ops.py +7 -0
  62. package/template/workflows/ops/common/tools/opslib/__init__.py +2 -0
  63. package/template/workflows/ops/common/tools/opslib/__pycache__/__init__.cpython-312.pyc +0 -0
  64. package/template/workflows/ops/common/tools/opslib/__pycache__/core.cpython-312.pyc +0 -0
  65. package/template/workflows/ops/common/tools/opslib/__pycache__/model.cpython-312.pyc +0 -0
  66. package/template/workflows/ops/common/tools/opslib/agent.py +510 -0
  67. package/template/workflows/ops/common/tools/opslib/cli.py +172 -0
  68. package/template/workflows/ops/common/tools/opslib/core.py +199 -0
  69. package/template/workflows/ops/common/tools/opslib/docs.py +199 -0
  70. package/template/workflows/ops/common/tools/opslib/execution.py +248 -0
  71. package/template/workflows/ops/common/tools/opslib/host_recipes.py +67 -0
  72. package/template/workflows/ops/common/tools/opslib/model.py +199 -0
  73. package/template/workflows/ops/common/tools/opslib/native_windows.py +32 -0
  74. package/template/workflows/ops/common/tools/opslib/planner.py +497 -0
  75. package/template/workflows/ops/common/tools/opslib/services.py +47 -0
  76. package/template/workflows/ops/common/tools/opslib/sources.py +27 -0
  77. package/template/workflows/ops/common/tools/opslib/transport.py +55 -0
  78. package/template/workflows/ops/common/tools/validate-ops.mjs +32 -1014
  79. package/template/workflows/ops/manifest.json +60 -1
  80. package/template/workflows/ops/runtime-contract.json +1 -6
  81. package/template/workflows/ops/A-archive-and-learn/A-archive-and-learn.md +0 -73
  82. package/template/workflows/ops/A-archive-and-learn/promotion-plan-template.md +0 -41
  83. package/template/workflows/ops/A-archive-and-learn/retrospective-template.md +0 -53
  84. package/template/workflows/ops/E-execute-and-stabilize/E-execute-and-stabilize.md +0 -82
  85. package/template/workflows/ops/E-execute-and-stabilize/attempt-summary-template.md +0 -44
  86. package/template/workflows/ops/E-execute-and-stabilize/diagnosis-template.md +0 -24
  87. package/template/workflows/ops/E-execute-and-stabilize/handoff-template.md +0 -32
  88. package/template/workflows/ops/E-execute-and-stabilize/rollback-template.md +0 -26
  89. package/template/workflows/ops/E-execute-and-stabilize/verification-state-template.json +0 -30
  90. package/template/workflows/ops/E-execute-and-stabilize/verification-template.md +0 -55
  91. package/template/workflows/ops/H-computer-hygiene/H-computer-hygiene.md +0 -105
  92. package/template/workflows/ops/H-computer-hygiene/examples/README.md +0 -9
  93. package/template/workflows/ops/H-computer-hygiene/examples/linux/2026-09-14.environment.md +0 -45
  94. package/template/workflows/ops/H-computer-hygiene/examples/linux/2026-09-14.json +0 -970
  95. package/template/workflows/ops/H-computer-hygiene/examples/linux/2026-09-14.md +0 -216
  96. package/template/workflows/ops/H-computer-hygiene/examples/macos/2026-09-14.environment.md +0 -45
  97. package/template/workflows/ops/H-computer-hygiene/examples/macos/2026-09-14.json +0 -970
  98. package/template/workflows/ops/H-computer-hygiene/examples/macos/2026-09-14.md +0 -216
  99. package/template/workflows/ops/H-computer-hygiene/examples/windows/2026-09-14.environment.md +0 -45
  100. package/template/workflows/ops/H-computer-hygiene/examples/windows/2026-09-14.json +0 -969
  101. package/template/workflows/ops/H-computer-hygiene/examples/windows/2026-09-14.md +0 -216
  102. package/template/workflows/ops/H-computer-hygiene/references/00-sources.md +0 -58
  103. package/template/workflows/ops/H-computer-hygiene/references/01-safety.md +0 -52
  104. package/template/workflows/ops/H-computer-hygiene/references/10-windows.md +0 -47
  105. package/template/workflows/ops/H-computer-hygiene/references/11-macos.md +0 -46
  106. package/template/workflows/ops/H-computer-hygiene/references/12-linux.md +0 -13
  107. package/template/workflows/ops/H-computer-hygiene/references/20-toolchains.md +0 -83
  108. package/template/workflows/ops/H-computer-hygiene/references/21-path-migration.md +0 -64
  109. package/template/workflows/ops/H-computer-hygiene/references/22-repositories.md +0 -35
  110. package/template/workflows/ops/H-computer-hygiene/references/30-software-removal.md +0 -41
  111. package/template/workflows/ops/H-computer-hygiene/references/40-report-spec.md +0 -54
  112. package/template/workflows/ops/H-computer-hygiene/references/50-speculo-integration.md +0 -26
  113. package/template/workflows/ops/H-computer-hygiene/references/source-register.json +0 -406
  114. package/template/workflows/ops/H-computer-hygiene/rules/catalog.json +0 -191
  115. package/template/workflows/ops/H-computer-hygiene/scripts/hygiene.py +0 -1348
  116. package/template/workflows/ops/H-computer-hygiene/scripts/run.ps1 +0 -7
  117. package/template/workflows/ops/H-computer-hygiene/scripts/run.sh +0 -5
  118. package/template/workflows/ops/H-computer-hygiene/templates/config.example.json +0 -13
  119. package/template/workflows/ops/H-computer-hygiene/templates/maven-settings.fragment.xml +0 -6
  120. package/template/workflows/ops/H-computer-hygiene/templates/native-evidence.example.json +0 -19
  121. package/template/workflows/ops/H-computer-hygiene/tests/cli_smoke.py +0 -65
  122. package/template/workflows/ops/H-computer-hygiene/tests/make_examples.py +0 -114
  123. package/template/workflows/ops/H-computer-hygiene/tests/test_hygiene.py +0 -486
  124. package/template/workflows/ops/I-intake-and-assess/I-intake-and-assess.md +0 -73
  125. package/template/workflows/ops/I-intake-and-assess/change-status-template.json +0 -26
  126. package/template/workflows/ops/I-intake-and-assess/collector-catalog.md +0 -28
  127. package/template/workflows/ops/I-intake-and-assess/deployment-dossier-template.md +0 -62
  128. package/template/workflows/ops/I-intake-and-assess/global-change-status-template.json +0 -26
  129. package/template/workflows/ops/I-intake-and-assess/project-detection.md +0 -38
  130. package/template/workflows/ops/I-intake-and-assess/request-template.md +0 -44
  131. package/template/workflows/ops/I-intake-and-assess/system-report-template.md +0 -34
  132. package/template/workflows/ops/I-intake-and-assess/target-profile-template.json +0 -24
  133. package/template/workflows/ops/P-plan-and-approve/P-plan-and-approve.md +0 -72
  134. package/template/workflows/ops/P-plan-and-approve/plan-review-template.md +0 -78
  135. package/template/workflows/ops/_state/archive/.gitkeep +0 -1
  136. package/template/workflows/ops/_state/changes/.gitkeep +0 -1
  137. package/template/workflows/ops/common/rules/artifact-contract.md +0 -38
  138. package/template/workflows/ops/common/rules/closure-and-learning.md +0 -27
  139. package/template/workflows/ops/common/rules/evidence-and-redaction.md +0 -22
  140. package/template/workflows/ops/common/rules/execution-loop.md +0 -27
  141. package/template/workflows/ops/common/rules/path-and-scope-contract.md +0 -21
  142. package/template/workflows/ops/common/rules/plan-and-approval.md +0 -25
  143. package/template/workflows/ops/common/rules/project-and-change-scope.md +0 -20
  144. package/template/workflows/ops/common/rules/target-profile-and-release-gates.md +0 -44
  145. package/template/workflows/ops/common/schemas/attempt.schema.json +0 -42
  146. package/template/workflows/ops/common/schemas/change-status.schema.json +0 -43
  147. package/template/workflows/ops/common/schemas/deployment-model.schema.json +0 -26
  148. package/template/workflows/ops/common/schemas/implementation-plan.schema.json +0 -221
  149. package/template/workflows/ops/common/schemas/inventory-snapshot.schema.json +0 -31
  150. package/template/workflows/ops/common/schemas/journal-event.schema.json +0 -22
  151. package/template/workflows/ops/common/schemas/promotion-approval.schema.json +0 -20
  152. package/template/workflows/ops/common/schemas/promotion-manifest.schema.json +0 -22
  153. package/template/workflows/ops/common/schemas/target-profile.schema.json +0 -32
  154. package/template/workflows/ops/common/schemas/verification-state.schema.json +0 -30
  155. package/template/workflows/ops/common/tools/close-change.mjs +0 -177
@@ -0,0 +1,55 @@
1
+ """Strict host-key SSH and subprocess local transport. No passwords in argv."""
2
+ from __future__ import annotations
3
+ import base64, json, shlex, subprocess, sys
4
+ from pathlib import Path
5
+ from .core import *
6
+
7
+ AGENT=Path(__file__).with_name("agent.py")
8
+
9
+ def host_transport_digest(host: dict) -> str:
10
+ c=host["connection"]
11
+ kh=None
12
+ if host["transport"]=="ssh":
13
+ p=Path(c["known_hosts"])
14
+ no_symlinks(p,allow_missing=False)
15
+ kh=digest(p.read_bytes())
16
+ return digest({"host":host,"known_hosts_digest":kh})
17
+
18
+ def call(host: dict, request: dict, *, timeout: int=1800) -> dict:
19
+ request={"identity":host["identity"],**request}
20
+ content="import base64,json\nOPS_REQUEST=json.loads(base64.b64decode("+repr(base64.b64encode(canonical(request)).decode())+"))\n"+AGENT.read_text(encoding="utf-8").replace("from __future__ import annotations\n", "")
21
+ code="import sys;exec(compile(sys.stdin.buffer.read(),'<ops-target-agent>','exec'))"
22
+ if host["transport"]=="local":
23
+ argv=[sys.executable,"-c",code]
24
+ else:
25
+ c=host["connection"];kh=Path(c["known_hosts"]).absolute();no_symlinks(kh,allow_missing=False)
26
+ argv=["ssh","-T","-o","BatchMode=yes","-o","StrictHostKeyChecking=yes","-o",f"UserKnownHostsFile={kh}",
27
+ "-o","ConnectTimeout=15","-o","ServerAliveInterval=15","-o","ServerAliveCountMax=3","-p",str(c.get("port",22))]
28
+ if c.get("identity_file"):argv += ["-i",c["identity_file"],"-o","IdentitiesOnly=yes"]
29
+ remote=[c["python"],"-c",code]
30
+ if c.get("sudo"):remote=["sudo","-n","--",*remote]
31
+ if c.get("shell","posix")=="powershell":
32
+ if c.get("sudo"):raise OpsError("sudo not valid for PowerShell transport")
33
+ remote_command="& "+" ".join("'"+x.replace("'","''")+"'" for x in remote)
34
+ ps=base64.b64encode(remote_command.encode("utf-16le")).decode()
35
+ remote_command="powershell -NoProfile -NonInteractive -EncodedCommand "+ps
36
+ else:remote_command=shlex.join(remote)
37
+ argv += ["--",c["username"]+"@"+c["hostname"],remote_command]
38
+ try:
39
+ p=subprocess.run(argv,input=content.encode(),stdout=subprocess.PIPE,stderr=subprocess.PIPE,timeout=timeout)
40
+ except (OSError,subprocess.TimeoutExpired) as e:
41
+ if request["action"] in ("step","lock","unlock"):raise UnknownResult("target transport interrupted; inspect receipts before retry") from e
42
+ raise OpsError("target read unavailable: "+str(e)) from e
43
+ if p.returncode!=0:
44
+ text=redact(p.stderr.decode("utf8","replace"),request.get("secrets",[]))[-2000:]
45
+ if request["action"] in ("step","lock","unlock"):raise UnknownResult("target transport failed: "+text)
46
+ raise OpsError("target read failed: "+text)
47
+ try:value=json.loads(p.stdout)
48
+ except ValueError as e:raise UnknownResult("invalid target response; stdout noise or interrupted operation") from e
49
+ if not value.get("ok"):raise OpsError("target blocked: "+value.get("error","unknown"))
50
+ return value["result"]
51
+
52
+ def probe_local() -> dict:
53
+ from .agent import fingerprint
54
+ host={"host_id":"probe-local","platform":"windows" if os.name=="nt" else "linux","transport":"local","connection":{},"identity":fingerprint()}
55
+ return call(host,{"action":"probe"},timeout=120)