k9o 1.3.0 → 1.5.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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +80 -1
  3. data/README.md +1516 -159
  4. data/k9o.gemspec +2 -2
  5. data/lib/k9o/ai.rb +15 -0
  6. data/lib/k9o/analytics.rb +403 -0
  7. data/lib/k9o/approvals.rb +253 -0
  8. data/lib/k9o/audit.rb +150 -0
  9. data/lib/k9o/client.rb +25 -4
  10. data/lib/k9o/crypto.rb +471 -0
  11. data/lib/k9o/custody.rb +28 -0
  12. data/lib/k9o/data.rb +125 -5
  13. data/lib/k9o/ed25519.rb +182 -0
  14. data/lib/k9o/end_users.rb +93 -0
  15. data/lib/k9o/envelope.rb +20 -5
  16. data/lib/k9o/functions.rb +82 -3
  17. data/lib/k9o/gate.rb +46 -7
  18. data/lib/k9o/http_transport.rb +71 -14
  19. data/lib/k9o/jcs.rb +117 -0
  20. data/lib/k9o/kerror.rb +57 -5
  21. data/lib/k9o/keys.rb +131 -0
  22. data/lib/k9o/kibo_client_core.rb +385 -0
  23. data/lib/k9o/kibo_ffi_core.rb +178 -0
  24. data/lib/k9o/locate.rb +118 -0
  25. data/lib/k9o/me.rb +1 -1
  26. data/lib/k9o/metadata.rb +342 -0
  27. data/lib/k9o/moat.rb +443 -0
  28. data/lib/k9o/org.rb +1 -1
  29. data/lib/k9o/query.rb +174 -0
  30. data/lib/k9o/rampart.rb +273 -0
  31. data/lib/k9o/realtime.rb +261 -10
  32. data/lib/k9o/schedules.rb +109 -0
  33. data/lib/k9o/schema.rb +35 -0
  34. data/lib/k9o/streams.rb +94 -0
  35. data/lib/k9o/vault.rb +3 -4
  36. data/lib/k9o/vectors.rb +124 -0
  37. data/lib/k9o/version.rb +1 -1
  38. data/lib/k9o.rb +17 -0
  39. data/sig/k9o/ai.rbs +4 -0
  40. data/sig/k9o/approvals.rbs +71 -0
  41. data/sig/k9o/datasets.rbs +125 -0
  42. data/sig/k9o/gate.rbs +2 -0
  43. data/sig/k9o/kerror.rbs +24 -0
  44. data/sig/k9o/kibo_client_core.rbs +25 -0
  45. data/sig/k9o/metadata.rbs +54 -0
  46. data/sig/k9o/moat.rbs +29 -0
  47. data/sig/k9o/query.rbs +26 -0
  48. data/sig/k9o/rampart.rbs +59 -0
  49. data/sig/k9o/realtime.rbs +34 -0
  50. data/sig/k9o/workload.rbs +64 -0
  51. metadata +33 -4
data/sig/k9o/moat.rbs ADDED
@@ -0,0 +1,29 @@
1
+ # RBS signatures for Moat, the local guard around a model call.
2
+
3
+ module K9o
4
+ module Moat
5
+ REASONS: Array[Symbol]
6
+
7
+ # Raised when Moat refuses input or output. `reason` is :role_marker, :input_schema, :output_schema or :pii.
8
+ class Refusal < StandardError
9
+ attr_reader reason: Symbol
10
+ attr_reader detail: String
11
+ def initialize: (Symbol reason, String detail) -> void
12
+ end
13
+
14
+ class ConfigError < ArgumentError
15
+ end
16
+
17
+ class SchemaError < ConfigError
18
+ end
19
+
20
+ def self.new: (prompt: String, ?input_schema: Hash[String | Symbol, untyped]?, ?output_schema: Hash[String | Symbol, untyped]?, ?filters: Hash[Symbol | String, ^(String) -> untyped]?) -> Guard
21
+
22
+ class Guard
23
+ def initialize: (prompt: String, ?input_schema: Hash[String | Symbol, untyped]?, ?output_schema: Hash[String | Symbol, untyped]?, ?filters: Hash[Symbol | String, ^(String) -> untyped]?) -> void
24
+ def messages: (untyped untrusted_input) -> Array[{ role: String, content: String }]
25
+ def check_output: (untyped model_output) -> untyped
26
+ def prompt_sha256: () -> String
27
+ end
28
+ end
29
+ end
data/sig/k9o/query.rbs ADDED
@@ -0,0 +1,26 @@
1
+ # RBS signatures for `client.query`, `client.search` and the select builder's search methods.
2
+
3
+ module K9o
4
+ module Query
5
+ type value = String | Integer | Float | bool | nil
6
+
7
+ # Rewrites :name placeholders to $n; returns [sql, positional values].
8
+ def self.translate_named_params: (String sql, Hash[(String | Symbol), untyped] named) -> [String, Array[value]]
9
+ end
10
+
11
+ module QueryMethods
12
+ # An Array binds positionally to $1, $2, ...; a Hash binds :name placeholders. `data` is the array of rows.
13
+ def query: (String sql, ?(Array[untyped] | Hash[(String | Symbol), untyped])? params) -> Envelope
14
+
15
+ def search: (String collection, column: String, q: String, ?language: String?, ?type: String?, ?limit: Integer?, ?cursor: String?) -> Envelope
16
+ end
17
+
18
+ class K9oClient
19
+ include QueryMethods
20
+ end
21
+
22
+ class SelectBuilder
23
+ def text_search: (String column, String query, ?language: String, ?type: (String | Symbol)) -> self
24
+ def vector_search: (String column, Array[Numeric] embedding, ?metric: (String | Symbol), ?limit: Integer?) -> self
25
+ end
26
+ end
@@ -0,0 +1,59 @@
1
+ # RBS signatures for Rampart classification and receipt verification.
2
+
3
+ module K9o
4
+ module Jcs
5
+ class Error < ArgumentError
6
+ attr_reader kind: Symbol
7
+ def initialize: (String message, ?Symbol kind) -> void
8
+ end
9
+
10
+ def self.canonicalize: (untyped value) -> String
11
+ def self.canonical_bytes: (untyped value) -> String
12
+ end
13
+
14
+ module Ed25519
15
+ def self.verify: (String public_key, String message, String signature) -> bool
16
+ def self.native?: () -> bool
17
+ end
18
+
19
+ class Rampart
20
+ RECEIPT_TYP: String
21
+ CLASSIFICATIONS: Array[String]
22
+ DEFAULT_CLOCK_SKEW: Integer
23
+ REASONS: Array[Symbol]
24
+
25
+ # Raised by verify_receipt. `reason` is one of REASONS: :malformed, :key_unknown, :alg, :typ, :signature,
26
+ # :issuer, :project_unknown, :project, :expired, :not_yet_valid, :input_hash.
27
+ class ReceiptRefusal < KError
28
+ attr_reader reason: Symbol
29
+ def initialize: (Symbol reason, String detail) -> void
30
+ end
31
+
32
+ class Verdict < Struct[untyped]
33
+ attr_accessor classification: String
34
+ attr_accessor risk_bp: Integer
35
+ attr_accessor confidence_bp: Integer
36
+ attr_accessor categories: Array[String]
37
+ attr_accessor project_id: String
38
+ attr_accessor calibration_version: String
39
+ attr_accessor input_sha256: String
40
+ attr_accessor issued_at: Time
41
+ attr_accessor expires_at: Time
42
+ attr_accessor kid: String
43
+ attr_accessor windows: Integer?
44
+ end
45
+
46
+ def initialize: (untyped config) -> void
47
+ # data: { "classification", "riskScore", "confidence", "categories", "calibrationVersion", "classificationReceipt", "projectId" }.
48
+ def classify: (Hash[String | Symbol, untyped] input, ?label: String?) -> Envelope
49
+ # data: { "keys" => [ { "kid", "kty", "crv", "x", ... } ], "issuer" => "<issuer>/rampart" }. Public: no credential is sent.
50
+ def jwks: () -> Envelope
51
+ # `receipt` is the Envelope classify returned (it carries the receipt and its projectId) or the bare receipt String.
52
+ def verify_receipt: ((Envelope | String) receipt, Hash[String | Symbol, untyped] input, ?key_set: (Hash[untyped, untyped] | Array[Hash[untyped, untyped]])?, ?issuer: String?, ?project_id: String?, ?clock_skew: Numeric, ?clock: (Time | Numeric | ^() -> (Time | Numeric))?) -> Verdict
53
+ def input_digest: (Hash[String | Symbol, untyped] input) -> String
54
+ end
55
+
56
+ class K9oClient
57
+ attr_reader rampart: Rampart
58
+ end
59
+ end
@@ -0,0 +1,34 @@
1
+ # RBS signatures for `client.realtime`.
2
+
3
+ module K9o
4
+ class Realtime
5
+ DEFAULT_RETRY_MS: Integer
6
+ SEEN_LIMIT: Integer
7
+
8
+ # Seconds without any bytes after which a connection is abandoned (default 45).
9
+ def self.idle_timeout: () -> Numeric
10
+ def self.idle_timeout=: (Numeric) -> Numeric
11
+ # Longest reconnect delay in seconds (default 30).
12
+ def self.max_backoff: () -> Numeric
13
+ def self.max_backoff=: (Numeric) -> Numeric
14
+ def self.sleeper: () -> ^(Numeric) -> void
15
+ def self.sleeper=: (^(Numeric) -> void) -> ^(Numeric) -> void
16
+
17
+ def initialize: (untyped config) -> void
18
+ # Yields { "topic", "eventType", "payload", "occurredAt", "eventId" }. Reconnects with `Last-Event-ID`, drops
19
+ # events already delivered, and calls `on_resync` with { "reason", "action" } when the position is lost.
20
+ def subscribe: (String topic, ?filter: Hash[untyped, untyped]?, ?on_resync: (^(Hash[String, untyped]) -> untyped)?) -> Enumerator[Hash[String, untyped], untyped]
21
+
22
+ # POST /@<slug>/realtime/replay: data is { "events", "nextCursor", "hasMore" } plus "resync" when the topic has no stored history.
23
+ def replay: (String topic, ?from_sequence: Integer?, ?until_sequence: Integer?, ?limit: Integer?) -> Envelope
24
+
25
+ module Topic
26
+ def self.collection: (String collection) -> String
27
+ def self.workflow_runs: () -> String
28
+ def self.query_executed: (String query_id) -> String
29
+ def self.dashboard_refresh: (String dashboard_id) -> String
30
+ def self.function_invocations: (String function_id) -> String
31
+ def self.audit_org: (String event_family) -> String
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,64 @@
1
+ # RBS signatures for write approval, event triggers, schedules, vectors and end users.
2
+
3
+ module K9o
4
+ # True when a single-record write sent with `require_approval` was queued (HTTP 202) instead of applied.
5
+ def self.queued_write?: (untyped result) -> bool
6
+
7
+ class FunctionTriggers
8
+ def initialize: (untyped config) -> void
9
+ def list: (String name) -> Envelope
10
+ def create: (String name, collection: String, events: Array[String | Symbol], ?filter: Hash[untyped, untyped]?, ?enabled: bool?, ?log_ok_invocations: bool?) -> Envelope
11
+ # Fields: events, filter (nil clears it), enabled, log_ok_invocations. At least one.
12
+ def update: (String name, String trigger_id, **untyped fields) -> Envelope
13
+ # data is nil (HTTP 204).
14
+ def delete: (String name, String trigger_id) -> Envelope
15
+ end
16
+
17
+ # Key custody (read-only). `data` holds mode, attached, provider, lastJob and hsm (nil when absent).
18
+ class Custody
19
+ def initialize: (untyped config) -> void
20
+ def status: () -> Envelope
21
+ end
22
+
23
+ class Schedules
24
+ def initialize: (untyped config) -> void
25
+ def list: (?status: (String | Symbol)?, ?function_name: String?, ?limit: Integer?, ?cursor: String?) -> Envelope
26
+ def get: (String id) -> Envelope
27
+ def create: (function_name: String, schedule_expression: String, ?schedule_timezone: String?, ?catchup_policy: (String | Symbol)?, ?collection: String?, ?enabled: bool?, ?log_ok_invocations: bool?) -> Envelope
28
+ # Fields: schedule_expression, schedule_timezone, catchup_policy, status, enabled, log_ok_invocations. At least one.
29
+ def update: (String id, **untyped fields) -> Envelope
30
+ # data is nil (HTTP 204).
31
+ def delete: (String id) -> Envelope
32
+ def runs: (String id, ?limit: Integer?, ?cursor: String?) -> Envelope
33
+ def run_now: (String id) -> Envelope
34
+ end
35
+
36
+ class Vectors
37
+ def initialize: (untyped config) -> void
38
+ # data is { "results" => [...], "collection" => String }; each result has id, score, _source, contentHash, text (nil when absent), metadata, model (nil) and chunk (nil).
39
+ def nearest: (String collection, Array[Numeric] query_vector, ?top_k: Integer?, ?min_score: Numeric?, ?metric: (String | Symbol)?, ?filters: Hash[String | Symbol, String | Numeric | bool]?) -> Envelope
40
+ # rows: Hashes with vector and _source; optional id, contentHash, text, metadata, subjectIds. A single row Hash is accepted. data is { "upserted" => Integer, "collection" => String }.
41
+ def upsert: (String collection, ?(Array[Hash[String | Symbol, untyped]] | Hash[String | Symbol, untyped])? rows, **untyped row) -> Envelope
42
+ end
43
+
44
+ class EndUsers
45
+ def initialize: (untyped config) -> void
46
+ attr_reader role_grants: EndUserRoleGrants
47
+ def list: (?status: (String | Symbol)?, ?q: String?, ?limit: Integer?, ?cursor: String?) -> Envelope
48
+ def get: (String id) -> Envelope
49
+ end
50
+
51
+ class EndUserRoleGrants
52
+ def initialize: (untyped config) -> void
53
+ # data is the Array of grants.
54
+ def list: (?end_user_id: String?) -> Envelope
55
+ # data is the grant.
56
+ def grant: (end_user_id: String, role: String) -> Envelope
57
+ # data is { "revoked" => bool, "revokedAt" => String? }.
58
+ def revoke: (String grant_id) -> Envelope
59
+ end
60
+
61
+ class K9oClient
62
+ attr_reader vectors: Vectors
63
+ end
64
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: k9o
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kilimanjaro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-26 00:00:00.000000000 Z
11
+ date: 2026-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -39,44 +39,73 @@ files:
39
39
  - k9o.gemspec
40
40
  - lib/k9o.rb
41
41
  - lib/k9o/ai.rb
42
+ - lib/k9o/analytics.rb
43
+ - lib/k9o/approvals.rb
42
44
  - lib/k9o/audit.rb
43
45
  - lib/k9o/barbican.rb
44
46
  - lib/k9o/client.rb
45
47
  - lib/k9o/compute.rb
48
+ - lib/k9o/crypto.rb
49
+ - lib/k9o/custody.rb
46
50
  - lib/k9o/data.rb
51
+ - lib/k9o/ed25519.rb
52
+ - lib/k9o/end_users.rb
47
53
  - lib/k9o/envelope.rb
48
54
  - lib/k9o/functions.rb
49
55
  - lib/k9o/gate.rb
50
56
  - lib/k9o/http_transport.rb
57
+ - lib/k9o/jcs.rb
51
58
  - lib/k9o/kerror.rb
59
+ - lib/k9o/keys.rb
52
60
  - lib/k9o/kibo.rb
61
+ - lib/k9o/kibo_client_core.rb
62
+ - lib/k9o/kibo_ffi_core.rb
63
+ - lib/k9o/locate.rb
53
64
  - lib/k9o/me.rb
65
+ - lib/k9o/metadata.rb
54
66
  - lib/k9o/migrations.rb
67
+ - lib/k9o/moat.rb
55
68
  - lib/k9o/multipart.rb
56
69
  - lib/k9o/org.rb
57
70
  - lib/k9o/orgs.rb
58
71
  - lib/k9o/policies.rb
59
72
  - lib/k9o/projects.rb
73
+ - lib/k9o/query.rb
74
+ - lib/k9o/rampart.rb
60
75
  - lib/k9o/realtime.rb
61
76
  - lib/k9o/region.rb
77
+ - lib/k9o/schedules.rb
78
+ - lib/k9o/schema.rb
62
79
  - lib/k9o/storage.rb
80
+ - lib/k9o/streams.rb
63
81
  - lib/k9o/studio.rb
64
82
  - lib/k9o/url_grammar.rb
65
83
  - lib/k9o/vault.rb
84
+ - lib/k9o/vectors.rb
66
85
  - lib/k9o/version.rb
67
86
  - sig/k9o/ai.rbs
87
+ - sig/k9o/approvals.rbs
88
+ - sig/k9o/datasets.rbs
68
89
  - sig/k9o/gate.rbs
90
+ - sig/k9o/kerror.rbs
91
+ - sig/k9o/kibo_client_core.rbs
92
+ - sig/k9o/metadata.rbs
69
93
  - sig/k9o/migrations.rbs
94
+ - sig/k9o/moat.rbs
95
+ - sig/k9o/query.rbs
96
+ - sig/k9o/rampart.rbs
97
+ - sig/k9o/realtime.rbs
70
98
  - sig/k9o/region.rbs
71
99
  - sig/k9o/storage.rbs
100
+ - sig/k9o/workload.rbs
72
101
  homepage: https://kilimanjaro.dev
73
102
  licenses:
74
103
  - Apache-2.0
75
104
  metadata:
76
105
  homepage_uri: https://kilimanjaro.dev
77
106
  documentation_uri: https://docs.kilimanjaro.dev
78
- source_code_uri: https://github.com/k9o-dev/sdk-ruby
79
- changelog_uri: https://github.com/k9o-dev/sdk-ruby/blob/main/CHANGELOG.md
107
+ source_code_uri: https://github.com/k9o-platform/sdk-ruby
108
+ changelog_uri: https://github.com/k9o-platform/sdk-ruby/blob/main/CHANGELOG.md
80
109
  post_install_message:
81
110
  rdoc_options: []
82
111
  require_paths: