bitfab 0.78.1 → 0.78.3
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.
- checksums.yaml +4 -4
- data/lib/bitfab/agent_session_experiments.rb +40 -0
- data/lib/bitfab/cloudReplay.mjs +24170 -0
- data/lib/bitfab/cloud_replay_cli.rb +4 -3
- data/lib/bitfab/replay.rb +7 -0
- data/lib/bitfab/version.rb +1 -1
- metadata +3 -2
- data/lib/bitfab/cloudReplay.py +0 -3758
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 602f2542bbe3aa4124307d785a1245f876cce5fb9d8b5fa6e6855c55a4bc2742
|
|
4
|
+
data.tar.gz: 38080d38cb7d519e93c76b32803cc0f8c2c5dac250890737ec7ac263bade9033
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7259519f92fb9c7fa0643533bcd32a1bb6b1158dc0a7b1b1ef9719cec358ca7d3e7a5e66ab0b2539fcbd37ddc2e1887333bca195abbcd4ceaf5432ea298f8b94
|
|
7
|
+
data.tar.gz: 189534fca713e081ed518632bc1bdf4b3ce5e5a02f27951a8fe6f022d391230592a29b212ba32d2f6c6d1536cfce907fb9eadb6a945ed2b9dbafefbd529406b9
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "fileutils"
|
|
4
|
+
require "json"
|
|
5
|
+
require "time"
|
|
6
|
+
require_relative "agent_session"
|
|
7
|
+
|
|
8
|
+
module Bitfab
|
|
9
|
+
module AgentSessionExperiments
|
|
10
|
+
SAFE_SESSION_ID = /\A[A-Za-z0-9_-][A-Za-z0-9._-]*\z/
|
|
11
|
+
|
|
12
|
+
module_function
|
|
13
|
+
|
|
14
|
+
def record(experiment_id:, experiment_url:, name:, service_url:, explicit_agent_session_id:)
|
|
15
|
+
session_id = session_id_for_path(explicit_agent_session_id)
|
|
16
|
+
return if session_id.nil?
|
|
17
|
+
|
|
18
|
+
directory = File.join(Dir.home, ".bitfab", "agent-sessions", session_id)
|
|
19
|
+
FileUtils.mkdir_p(directory)
|
|
20
|
+
line = JSON.generate(
|
|
21
|
+
experimentId: experiment_id,
|
|
22
|
+
experimentUrl: experiment_url,
|
|
23
|
+
name: name,
|
|
24
|
+
serviceUrl: service_url,
|
|
25
|
+
startedAt: Time.now.utc.iso8601(3)
|
|
26
|
+
)
|
|
27
|
+
File.open(File.join(directory, "experiments.jsonl"), "a") { |file| file.write("#{line}\n") }
|
|
28
|
+
nil
|
|
29
|
+
rescue
|
|
30
|
+
nil
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def session_id_for_path(explicit)
|
|
34
|
+
session_id = AgentSession.resolve(explicit)
|
|
35
|
+
(session_id && SAFE_SESSION_ID.match?(session_id)) ? session_id : nil
|
|
36
|
+
rescue
|
|
37
|
+
nil
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|