ctx_driver 0.2.8 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e16f6458370d2fd1faed594b6e3b26f15fece62edd4ecc868e4f426d83643f73
4
- data.tar.gz: d31b0cff024ecff064f466bb54bfa4f2aef9170e033d3b0e57e5095cb6d1d7b4
3
+ metadata.gz: 4568b50606564c6f379c1110bd52c00566cfc7868f59f4253e38f675e2cf11db
4
+ data.tar.gz: 32e3dc04f8ee25ec7c21dd6c52beb607f0a51ecf2e80b4d39a30b125a28f70d4
5
5
  SHA512:
6
- metadata.gz: 5ff09c69fbaa5c1d9568b87520a6ca61b8933e1c5651d77926402071cd7f4089ec2759ea78acd5627fdbc2db452d4766dc472c1609a203d0cd9a122300351d03
7
- data.tar.gz: c8724a5627823cc81c3d2eecc17b7e91eeb56e9da7cca2796c396e4ce7a05daae9c80fdae37e465092f56197bca5eb0c8a7238d4c0d8693503b9155acf48d3e4
6
+ metadata.gz: af9f05c3a2fa5f0f9324641a2d81dc95a0488ab0ff7fccc50ec1302852f04e75b074015c34390f27ce7c66aa9a9bfb8ced2916f29c2878656929d85c6ea35cf8
7
+ data.tar.gz: 8527273f5407104dfa36c6414d0b65a5a2ecc9991a1572c408044b435fa8792346f4c923fabda6ee2dd365df6a1bc793a2cce3fa325d98e155282df8e63d66e2
data/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ Changes to the public contract are recorded here. Versions follow Semantic Versi
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.4.0 (2026-10-29)
8
+
9
+ - Use the parser command contract for borrowed-session reads; preserve single-command identity and stop-after-desynchronization behavior.
10
+ - Require ctx_parser 0.4.x.
11
+
12
+ ## 0.3.0 (2026-10-29)
13
+
14
+ - Require every completed receipt step to identify the exact requested command as `{ command: String }`; malformed identities stop later queries while retaining raw fingerprints. Normalize native connector steps at the session boundary.
15
+
7
16
  ## 0.2.8 (2026-10-24)
8
17
 
9
18
  - Leave the ctx_parser dependency unconstrained in the gemspec; applications select and lock a verified dependency combination.
data/README-zh.md CHANGED
@@ -118,3 +118,6 @@ CI 在 Linux、macOS 上执行测试、lint、示例、构建和隔离安装。`
118
118
  ## 许可证
119
119
 
120
120
  MIT,见 [LICENSE](LICENSE)。
121
+
122
+
123
+ 回执协议:每个已完成步骤必须是 `{ command: String }`,命令字节与请求完全一致。成功恰好一个步骤;失败可以零或一个。旧的不透明占位步骤不再支持;缺失或不匹配标记 `invalid_command_result` 并停止后续查询,保留原始字节摘要。原生 net-connector 步骤由 Session 自动适配。
data/README.md CHANGED
@@ -118,3 +118,8 @@ Publish dependency gems first. A Git tag, a successful build, or a workflow file
118
118
  ## License
119
119
 
120
120
  MIT. See [LICENSE](LICENSE).
121
+
122
+
123
+ Receipt protocol: each completed step is `{ command: String }` with exactly the requested command bytes. Success requires one step; failure permits zero or one. Opaque placeholder steps are no longer accepted. Missing or mismatched identity yields `invalid_command_result` and stops later queries while retaining raw fingerprints. Session adapts native net-connector steps automatically.
124
+
125
+ 本次使用 ctx_parser 0.4 系列契约;`Result` 新增 `covered_scopes`,单行命令统一由 `CtxParser::Commands.command_text` 校验。跨模块约定见 [ctx_runner 契约迁移](https://github.com/gatework/ctx_runner/blob/main/docs/contracts-2026-10-29.md)。
data/docs/release.md CHANGED
@@ -11,3 +11,7 @@ Configure `RUBYGEMS_API_KEY` as an encrypted secret in the GitHub `release` envi
11
11
  A failed publish is not permission to overwrite an existing version. Rerun the failed publish job to retain the original CI artifact. The script verifies an existing RubyGems version before proceeding and rejects different bytes or yanked versions. `workflow_dispatch` is restricted to version tags by the publish validation.
12
12
 
13
13
  Raw device `*.log`, local secrets, and build outputs are ignored. Package files use an explicit gemspec allowlist; review both the Git index and gem contents before publishing. Tests and examples must use synthetic or sanitized evidence.
14
+
15
+ For a workspace release, `script/verify_package.rb` also accepts dependency artifacts after the driver gem. Pass them in installation order: ctx_cli, expect-pty, ctx_parser, then the optional net-connector candidate. The verifier installs those exact packages in its isolated GEM_HOME and skips the registry connector install when a connector candidate is supplied.
16
+
17
+ Candidate installation and registry installation are separate checks. Publish the parser dependency first and confirm its registry availability before running the driver's clean Linux/macOS CI; the release tag must point to the commit whose complete CI matrix passed.
@@ -7,7 +7,7 @@ require "net/connector"
7
7
  class ExampleConnectorTransport < Net::Connector::Transports::Pty
8
8
  # 子进程先给出提示符,随后逐条回显查询和合成正文。
9
9
  def argv
10
- [ RbConfig.ruby, "-e", '$stdout.sync = true; print "device>"; while (line = gets); print line, " interface Ethernet1/1 up\r\ndevice>"; end' ]
10
+ [ RbConfig.ruby, "--disable-gems", "-e", '$stdout.sync = true; print "device>"; while (line = gets); print line, " interface Ethernet1/1 up\r\ndevice>"; end' ]
11
11
  end
12
12
  end
13
13
 
@@ -1,16 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "ctx_parser/commands"
4
+
3
5
  module CtxDriver
4
6
  # 单条命令的值边界;只校验文本完整性,是否为只读查询由宿主决定。
5
7
  module Command
6
8
  # 校验并固定命令;已有冻结文本可以安全共享。
7
- def self.snapshot(value)
8
- unless value.is_a?(String) && !value.strip.empty? && !/[\x00-\x1f\x7f]/.match?(value)
9
- raise ArgumentError, "One command without control characters is required"
10
- end
11
-
12
- value.frozen? ? value : value.dup.freeze
13
- end
9
+ def self.snapshot(value) = CtxParser::Commands.command_text(value)
14
10
  end
15
11
  private_constant :Command
16
12
  end
@@ -71,6 +71,9 @@ module CtxDriver
71
71
  unless [ true, false ].include?(success) && steps.is_a?(Array) && (success ? steps.one? : steps.size <= 1)
72
72
  raise TypeError, "One query must return one completed command"
73
73
  end
74
+ unless steps.all? { |step| step.is_a?(Hash) && step[:command].is_a?(String) && step[:command].b == command.b }
75
+ raise TypeError, "Completed step must belong to the requested command"
76
+ end
74
77
  receipt_validated = true
75
78
  if success
76
79
  body = receipt.value!
@@ -17,7 +17,10 @@ module CtxDriver
17
17
  def pretty_print(printer) = printer.text(inspect)
18
18
 
19
19
  def output = result.output
20
- def steps = result.steps
20
+ # 原生命令对象在适配边界投影为驱动的单命令身份协议。
21
+ def steps
22
+ result.steps.map { |step| { command: Command.snapshot(step.command.text) }.freeze }.freeze
23
+ end
21
24
  def success? = result.success?
22
25
  def error = result.error
23
26
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  module CtxDriver
4
4
  # 公开包版本,供 RubyGems 元数据和运行时调用方共用。
5
- VERSION = "0.2.8"
5
+ VERSION = "0.4.0"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ctx_driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gatework contributors
@@ -15,14 +15,20 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '0'
18
+ version: 0.4.0
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '0.5'
19
22
  type: :runtime
20
23
  prerelease: false
21
24
  version_requirements: !ruby/object:Gem::Requirement
22
25
  requirements:
23
26
  - - ">="
24
27
  - !ruby/object:Gem::Version
25
- version: '0'
28
+ version: 0.4.0
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '0.5'
26
32
  - !ruby/object:Gem::Dependency
27
33
  name: digest
28
34
  requirement: !ruby/object:Gem::Requirement