kailash 3.10.0-aarch64-linux
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 +7 -0
- data/README.md +478 -0
- data/lib/kailash/kailash.bundle +0 -0
- data/lib/kailash/kailash.so +0 -0
- data/lib/kailash/trust_plane.rb +42 -0
- data/lib/kailash/version.rb +8 -0
- data/lib/kailash.rb +10 -0
- metadata +75 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 3c6a212ae6b811ab63542e800b4a05326c622b1fe1484d67d56f23463be54d85
|
|
4
|
+
data.tar.gz: f7a2e0d34f403ecafb2795f498b989067905ab0c32c3bc8f4e1d2750822e9344
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 6dd578ba41f6d74d737451d9843fca7ddeab1cedfb40bf1ecef55d0b5f043860523cdaf65469a4129cb0773ee4c07670c439d55c5c0900407c893d761f6c56b5
|
|
7
|
+
data.tar.gz: bf225fc64d5c09bf5b09be57c6bdc1f0a0b15de7d98ed79988a0363c125d26e8c4ac11607e79b818d77929de42d5ab34cf5e9b1d428b8ac6f330bec87092977c
|
data/README.md
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
# Kailash for Ruby
|
|
2
|
+
|
|
3
|
+
[](https://www.ruby-lang.org)
|
|
4
|
+
[](#license)
|
|
5
|
+
[](#testing)
|
|
6
|
+
|
|
7
|
+
High-performance workflow automation SDK for Ruby, powered by a compiled Rust
|
|
8
|
+
engine. Build, validate, and execute workflow DAGs with **139 built-in node
|
|
9
|
+
types**, custom Ruby callback nodes, enterprise RBAC/ABAC authorization, an AI
|
|
10
|
+
agent framework, database modeling, and multi-channel deployment -- all from
|
|
11
|
+
idiomatic Ruby.
|
|
12
|
+
|
|
13
|
+
## Key Features
|
|
14
|
+
|
|
15
|
+
- **139 built-in workflow nodes** -- HTTP, SQL, file I/O, AI/LLM, authentication,
|
|
16
|
+
security, monitoring, edge computing, RAG pipelines, and more
|
|
17
|
+
- **Custom Ruby callback nodes** -- register any lambda, Proc, or callable object
|
|
18
|
+
as a first-class workflow node
|
|
19
|
+
- **GVL release during execution** -- the Rust runtime releases Ruby's Global VM
|
|
20
|
+
Lock, enabling true concurrent workflow execution across threads
|
|
21
|
+
- **Kaizen AI agent framework** -- 42+ classes covering agents, LLM clients,
|
|
22
|
+
orchestration, cost tracking, vision/audio processing, structured output, and
|
|
23
|
+
agent-to-agent communication
|
|
24
|
+
- **Enterprise features** -- RBAC with hierarchical roles, ABAC with 16
|
|
25
|
+
operators, audit trails, multi-tenancy isolation, compliance reporting
|
|
26
|
+
- **Nexus multi-channel deployment** -- server configuration, JWT authentication,
|
|
27
|
+
middleware presets, MCP protocol, workflow registries
|
|
28
|
+
- **DataFlow database framework** -- model definitions, field types, query
|
|
29
|
+
dialects, tenant-scoped query interception, migrations, schema caching
|
|
30
|
+
- **Thread-safe design** -- all core objects are safe to share across threads,
|
|
31
|
+
with block-based resource management (`Registry.open`, `Runtime.open`) that
|
|
32
|
+
guarantees cleanup
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
The gem is not yet published to RubyGems. Install from source.
|
|
37
|
+
|
|
38
|
+
### Prerequisites
|
|
39
|
+
|
|
40
|
+
- Ruby >= 3.2
|
|
41
|
+
- Rust toolchain (stable, 1.70+)
|
|
42
|
+
- Bundler
|
|
43
|
+
|
|
44
|
+
### Building from Source
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
git clone https://github.com/kailash/kailash.git
|
|
48
|
+
cd kailash/bindings/kailash-ruby
|
|
49
|
+
bundle install
|
|
50
|
+
rake compile
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
On macOS, the build script handles code signing automatically. The compiled
|
|
54
|
+
native extension (`.bundle`) is placed in `lib/kailash/`.
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
### Basic Workflow
|
|
59
|
+
|
|
60
|
+
```ruby
|
|
61
|
+
require "kailash"
|
|
62
|
+
|
|
63
|
+
# Block-based API auto-closes resources on exit
|
|
64
|
+
Kailash::Registry.open do |registry|
|
|
65
|
+
# Build a workflow DAG
|
|
66
|
+
builder = Kailash::WorkflowBuilder.new
|
|
67
|
+
builder.add_node("NoOpNode", "step1", {})
|
|
68
|
+
builder.add_node("NoOpNode", "step2", {})
|
|
69
|
+
builder.connect("step1", "output", "step2", "input")
|
|
70
|
+
workflow = builder.build(registry)
|
|
71
|
+
|
|
72
|
+
# Execute the workflow
|
|
73
|
+
Kailash::Runtime.open(registry) do |runtime|
|
|
74
|
+
result = runtime.execute(workflow, { "data" => "hello" })
|
|
75
|
+
puts result.run_id # => "a3f1b2c4-..."
|
|
76
|
+
puts result.results["step1"]["data"] # => "hello"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
workflow.close
|
|
80
|
+
end
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Custom Callback Node
|
|
84
|
+
|
|
85
|
+
Register Ruby lambdas, Procs, or any object responding to `#call` as workflow
|
|
86
|
+
nodes:
|
|
87
|
+
|
|
88
|
+
```ruby
|
|
89
|
+
Kailash::Registry.open do |registry|
|
|
90
|
+
# Register a lambda as a custom node type
|
|
91
|
+
uppercase = ->(inputs) { { "result" => inputs["text"].upcase } }
|
|
92
|
+
registry.register_callback("UppercaseNode", uppercase, ["text"], ["result"])
|
|
93
|
+
|
|
94
|
+
# Use it in a workflow alongside built-in nodes
|
|
95
|
+
builder = Kailash::WorkflowBuilder.new
|
|
96
|
+
builder.add_node("UppercaseNode", "transform", {})
|
|
97
|
+
workflow = builder.build(registry)
|
|
98
|
+
|
|
99
|
+
Kailash::Runtime.open(registry) do |runtime|
|
|
100
|
+
result = runtime.execute(workflow, { "text" => "hello world" })
|
|
101
|
+
puts result.results["transform"]["result"] # => "HELLO WORLD"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
workflow.close
|
|
105
|
+
end
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Callback nodes support any callable -- lambdas, Procs, and objects with a
|
|
109
|
+
`#call` method. They can return complex nested data structures (hashes, arrays,
|
|
110
|
+
numbers, booleans, nil) and are fully thread-safe.
|
|
111
|
+
|
|
112
|
+
### AI Agent with LlmClient
|
|
113
|
+
|
|
114
|
+
```ruby
|
|
115
|
+
# Configure an agent
|
|
116
|
+
config = Kailash::Kaizen::AgentConfig.new
|
|
117
|
+
config.set_model("gpt-4")
|
|
118
|
+
config.set_system_prompt("You are a helpful assistant.")
|
|
119
|
+
config.set_temperature(0.7)
|
|
120
|
+
config.set_max_iterations(10)
|
|
121
|
+
|
|
122
|
+
# Create an LLM client and agent
|
|
123
|
+
client = Kailash::Kaizen::LlmClient.new("openai")
|
|
124
|
+
agent = Kailash::Kaizen::Agent.new(config, client)
|
|
125
|
+
|
|
126
|
+
# Run the agent
|
|
127
|
+
result = agent.run("What is the capital of France?")
|
|
128
|
+
puts result["response"]
|
|
129
|
+
puts result["iterations"]
|
|
130
|
+
puts result["total_tokens"]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Multi-Agent Orchestration
|
|
134
|
+
|
|
135
|
+
```ruby
|
|
136
|
+
ort = Kailash::Kaizen::OrchestrationRuntime.new("sequential")
|
|
137
|
+
ort.add_agent("researcher")
|
|
138
|
+
ort.add_agent("writer")
|
|
139
|
+
ort.set_max_iterations(50)
|
|
140
|
+
|
|
141
|
+
result = ort.run("Research and write about AI safety")
|
|
142
|
+
puts result["status"] # => "completed"
|
|
143
|
+
puts result["results"]["researcher"] # per-agent results
|
|
144
|
+
puts result["results"]["writer"]
|
|
145
|
+
ort.close
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### RBAC Authorization
|
|
149
|
+
|
|
150
|
+
```ruby
|
|
151
|
+
# Define roles and permissions
|
|
152
|
+
read_perm = Kailash::Enterprise::Permission.new("documents", "read")
|
|
153
|
+
write_perm = Kailash::Enterprise::Permission.new("documents", "write")
|
|
154
|
+
|
|
155
|
+
editor = Kailash::Enterprise::Role.new("editor")
|
|
156
|
+
editor.add_permission(read_perm)
|
|
157
|
+
editor.add_permission(write_perm)
|
|
158
|
+
|
|
159
|
+
# Evaluate access
|
|
160
|
+
evaluator = Kailash::Enterprise::RbacEvaluator.new
|
|
161
|
+
evaluator.add_role(editor)
|
|
162
|
+
|
|
163
|
+
user = Kailash::Enterprise::User.new("alice")
|
|
164
|
+
user.add_role("editor")
|
|
165
|
+
|
|
166
|
+
result = evaluator.check(user, "documents", "read")
|
|
167
|
+
puts result[:allowed] # => true
|
|
168
|
+
|
|
169
|
+
# Explain access decisions
|
|
170
|
+
explanation = evaluator.explain(user, "documents", "write")
|
|
171
|
+
puts explanation[:reason]
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### DataFlow: Database Model Definition
|
|
175
|
+
|
|
176
|
+
```ruby
|
|
177
|
+
model = Kailash::DataFlow::ModelDefinition.new("User", "users")
|
|
178
|
+
model.field("id", "integer", primary_key: true)
|
|
179
|
+
model.field("email", "text", required: true, unique: true)
|
|
180
|
+
model.field("name", "text", required: true)
|
|
181
|
+
model.field("active", "boolean")
|
|
182
|
+
model.auto_timestamps
|
|
183
|
+
|
|
184
|
+
puts model.primary_key # => "id"
|
|
185
|
+
puts model.fields.length # => 6 (including created_at, updated_at)
|
|
186
|
+
model.close
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Block-Based Resource Management
|
|
190
|
+
|
|
191
|
+
All resource-owning objects support explicit `close` and idempotent cleanup.
|
|
192
|
+
Core objects also provide block-based constructors:
|
|
193
|
+
|
|
194
|
+
```ruby
|
|
195
|
+
# Registry.open and Runtime.open guarantee cleanup
|
|
196
|
+
Kailash::Registry.open do |registry|
|
|
197
|
+
Kailash::Runtime.open(registry) do |runtime|
|
|
198
|
+
# resources are automatically closed when the block exits,
|
|
199
|
+
# even if an exception is raised
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Manual lifecycle management
|
|
204
|
+
registry = Kailash::Registry.new
|
|
205
|
+
runtime = Kailash::Runtime.new(registry)
|
|
206
|
+
# ... use registry and runtime ...
|
|
207
|
+
runtime.close
|
|
208
|
+
registry.close
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## API Overview
|
|
212
|
+
|
|
213
|
+
### Core (`Kailash::`)
|
|
214
|
+
|
|
215
|
+
| Class | Description |
|
|
216
|
+
| ----------------- | --------------------------------------------------- |
|
|
217
|
+
| `Registry` | Node type registry (139+ built-in types), `.open` |
|
|
218
|
+
| `WorkflowBuilder` | DAG builder with `add_node` and `connect` |
|
|
219
|
+
| `Workflow` | Immutable validated workflow (from `builder.build`) |
|
|
220
|
+
| `Runtime` | Workflow execution engine, `.open` |
|
|
221
|
+
| `RuntimeConfig` | Execution settings (concurrency, timeouts, debug) |
|
|
222
|
+
| `ExecutionResult` | Execution output with `results` hash and `run_id` |
|
|
223
|
+
|
|
224
|
+
**Error hierarchy** (all inherit from `Kailash::Error < StandardError`):
|
|
225
|
+
|
|
226
|
+
| Class | Raised when |
|
|
227
|
+
| ---------------- | ------------------------------------------------- |
|
|
228
|
+
| `BuildError` | Workflow validation fails (empty, bad connection) |
|
|
229
|
+
| `ExecutionError` | Node execution fails at runtime |
|
|
230
|
+
| `NodeError` | Node-level error |
|
|
231
|
+
| `ConfigError` | Invalid configuration value |
|
|
232
|
+
| `ValueError` | Unsupported Ruby type in value conversion |
|
|
233
|
+
|
|
234
|
+
### Kaizen -- AI Agent Framework (`Kailash::Kaizen::`)
|
|
235
|
+
|
|
236
|
+
| Class | Description |
|
|
237
|
+
| ----------------------------- | --------------------------------------------------- |
|
|
238
|
+
| `Agent` | Core AI agent with TAOD loop and `#run` |
|
|
239
|
+
| `AgentConfig` | Agent configuration (model, temperature, tokens) |
|
|
240
|
+
| `LlmClient` | LLM provider client (openai, anthropic, mock) |
|
|
241
|
+
| `CostTracker` | Token usage and cost tracking |
|
|
242
|
+
| `ToolDef` / `ToolParam` | Tool definitions with typed parameters |
|
|
243
|
+
| `ToolRegistry` | Tool registration and lookup |
|
|
244
|
+
| `SessionMemory` | Key-value session memory with `store`/`recall` |
|
|
245
|
+
| `AgentCard` / `AgentRegistry` | Agent-to-agent discovery |
|
|
246
|
+
| `OrchestrationRuntime` | Multi-agent orchestration (sequential/parallel) |
|
|
247
|
+
| `MultiAgentOrchestrator` | Advanced orchestration with routes and dependencies |
|
|
248
|
+
| `SupervisorAgent` | Supervisor-worker delegation pattern |
|
|
249
|
+
| `WorkerAgent` | Worker with capabilities and progress tracking |
|
|
250
|
+
| `StreamingAgent` | Streaming-capable agent |
|
|
251
|
+
| `AgentExecutor` | Agent execution with timeout and retries |
|
|
252
|
+
| `StructuredOutput` | JSON parsing with retry |
|
|
253
|
+
| `OutputSchema` | JSON schema validation |
|
|
254
|
+
| `VisionProcessor` | Image analysis (single, batch, file) |
|
|
255
|
+
| `AudioProcessor` | Audio transcription with timestamps |
|
|
256
|
+
| `MultimodalOrchestrator` | Multi-modal processing (text + vision + audio) |
|
|
257
|
+
| `EatpPosture` | EATP v0.8.0 trust posture levels |
|
|
258
|
+
| `HumanCompetency` | CARE framework human competency categories |
|
|
259
|
+
| `RetryConfig` / `RetryPolicy` | Retry configuration with backoff strategies |
|
|
260
|
+
| `A2AProtocol` | Agent-to-agent communication protocol |
|
|
261
|
+
| `InMemoryMessageBus` | In-memory pub/sub message bus |
|
|
262
|
+
| `AgentCheckpoint` | Agent state checkpoint/resume |
|
|
263
|
+
|
|
264
|
+
### Enterprise (`Kailash::Enterprise::`)
|
|
265
|
+
|
|
266
|
+
| Class | Description |
|
|
267
|
+
| ---------------------------------------- | ------------------------------------------------------------ |
|
|
268
|
+
| `Permission` | RBAC permission (resource + action, wildcards) |
|
|
269
|
+
| `Role` / `RoleBuilder` | Named role with permissions |
|
|
270
|
+
| `User` | User with role assignments |
|
|
271
|
+
| `RbacEvaluator` | RBAC permission evaluator with `check` and `explain` |
|
|
272
|
+
| `RbacPolicy` / `RbacPolicyBuilder` | RBAC policy definitions |
|
|
273
|
+
| `AbacPolicy` | Attribute-based access control policy |
|
|
274
|
+
| `AbacEvaluator` | ABAC evaluator (first_applicable, deny_override) |
|
|
275
|
+
| `PolicyEngine` | Combined policy evaluation engine |
|
|
276
|
+
| `AuditEvent` | Structured audit event with UUID and timestamp |
|
|
277
|
+
| `AuditLogger` / `AuditFilter` | Audit logging with filtering |
|
|
278
|
+
| `TenantContext` / `TenantInfo` | Tenant metadata and context propagation |
|
|
279
|
+
| `TenantRegistry` | Tenant registration and lookup |
|
|
280
|
+
| `TenantStatus` | Tenant lifecycle (active, suspended, archived) |
|
|
281
|
+
| `EnterpriseTenantContext` | Tenant isolation enforcement |
|
|
282
|
+
| `EnterpriseContext` | Combined tenant + user context with roles |
|
|
283
|
+
| `AccessDecision` | Access decision with reason |
|
|
284
|
+
| `SecurityClassification` | Data classification (public, internal, confidential, secret) |
|
|
285
|
+
| `SSOProvider` | SSO provider configuration (OIDC, SAML) |
|
|
286
|
+
| `TokenManager` | Token lifecycle management |
|
|
287
|
+
| `CompetencyRequirement` | Human competency requirement levels |
|
|
288
|
+
| `ComplianceReport` / `ComplianceManager` | Compliance reporting |
|
|
289
|
+
|
|
290
|
+
### Nexus -- Multi-Channel Deployment (`Kailash::Nexus::`)
|
|
291
|
+
|
|
292
|
+
| Class | Description |
|
|
293
|
+
| --------------------- | ----------------------------------------------------------------- |
|
|
294
|
+
| `NexusConfig` | Server configuration (host, port, channels) |
|
|
295
|
+
| `NexusApp` | Application server with health checks |
|
|
296
|
+
| `Preset` | Middleware preset (none, lightweight, standard, saas, enterprise) |
|
|
297
|
+
| `HandlerParam` | Handler parameter definition (name, type, required) |
|
|
298
|
+
| `JwtConfig` | JWT authentication (secret, expiry, issuer) |
|
|
299
|
+
| `JwtClaims` | JWT token claims builder |
|
|
300
|
+
| `RbacConfig` | Route-level RBAC (roles, permissions, routes) |
|
|
301
|
+
| `MiddlewareConfig` | Middleware stack from preset |
|
|
302
|
+
| `AuthRateLimitConfig` | Rate limiting (authenticated, anonymous, burst) |
|
|
303
|
+
| `McpServer` | MCP protocol server (stdio, SSE, HTTP transports) |
|
|
304
|
+
| `PluginManager` | Plugin lifecycle management |
|
|
305
|
+
| `EventBus` | Event pub/sub bus |
|
|
306
|
+
| `WorkflowRegistry` | Named workflow registration and lookup |
|
|
307
|
+
|
|
308
|
+
### DataFlow -- Database Framework (`Kailash::DataFlow::`)
|
|
309
|
+
|
|
310
|
+
| Class | Description |
|
|
311
|
+
| -------------------------------- | ------------------------------------------------------ |
|
|
312
|
+
| `DataFlow` | Main entry point (register models, set tenant) |
|
|
313
|
+
| `Config` | Database connection (URL, pool size, auto-migrate) |
|
|
314
|
+
| `ModelDefinition` | Model builder (fields, primary key, timestamps) |
|
|
315
|
+
| `FieldType` / `FieldDef` | Field type enums and definitions |
|
|
316
|
+
| `FilterCondition` | Query filter (eq, ne, gt, gte, lt, lte, like, null) |
|
|
317
|
+
| `QueryDialect` | SQL dialect (sqlite, postgres, mysql) with auto-detect |
|
|
318
|
+
| `TenantContext` | Multi-tenancy context for query isolation |
|
|
319
|
+
| `QueryInterceptor` | Automatic tenant-scoped query rewriting |
|
|
320
|
+
| `DataFlowTransaction` | Transaction with commit/rollback |
|
|
321
|
+
| `DataFlowExpress` | Express mode for rapid model registration |
|
|
322
|
+
| `DataFlowInspector` | Schema inspection |
|
|
323
|
+
| `Migration` / `MigrationManager` | Database migration management |
|
|
324
|
+
| `SchemaCache` | In-memory schema caching |
|
|
325
|
+
| `ValidationLayer` / `StrictMode` | Query validation configuration |
|
|
326
|
+
| `LoggingConfig` | Query logging (level, format, slow query threshold) |
|
|
327
|
+
| `ErrorEnhancer` | Enhanced error context (query, params, stack) |
|
|
328
|
+
| `DebugAgent` | Query debugging |
|
|
329
|
+
|
|
330
|
+
## Value Conversion
|
|
331
|
+
|
|
332
|
+
Ruby values are automatically converted to the Rust `Value` type and back:
|
|
333
|
+
|
|
334
|
+
| Ruby type | Rust Value | Notes |
|
|
335
|
+
| --------------------- | ---------- | --------------------------------------- |
|
|
336
|
+
| `String` (UTF-8) | `String` | Preserves Unicode |
|
|
337
|
+
| `String` (ASCII-8BIT) | `Bytes` | Binary data round-trips correctly |
|
|
338
|
+
| `Integer` | `Integer` | 64-bit signed |
|
|
339
|
+
| `Float` | `Float` | 64-bit IEEE 754 |
|
|
340
|
+
| `true` / `false` | `Bool` | |
|
|
341
|
+
| `nil` | `Null` | |
|
|
342
|
+
| `Array` | `Array` | Recursive, mixed types supported |
|
|
343
|
+
| `Hash` | `Object` | String keys; symbol keys auto-converted |
|
|
344
|
+
| `Symbol` (as key) | `String` | Converted via `to_s` |
|
|
345
|
+
|
|
346
|
+
Unsupported types (`Object`, `Regexp`, `Range`, `Proc`) raise
|
|
347
|
+
`Kailash::ValueError`. Nesting depth is limited to 64 levels.
|
|
348
|
+
|
|
349
|
+
## Thread Safety
|
|
350
|
+
|
|
351
|
+
The Kailash Ruby binding is designed for concurrent use:
|
|
352
|
+
|
|
353
|
+
- **GVL release** -- `Runtime#execute` releases the Global VM Lock before
|
|
354
|
+
entering the Rust runtime, allowing other Ruby threads to run concurrently
|
|
355
|
+
while workflows execute.
|
|
356
|
+
- **Shared runtime** -- a single `Runtime` instance can be safely shared across
|
|
357
|
+
multiple threads, with each thread building and executing its own workflows.
|
|
358
|
+
- **Thread-safe close** -- `close` is idempotent and safe to call from multiple
|
|
359
|
+
threads simultaneously.
|
|
360
|
+
- **Framework objects** -- Kaizen, Enterprise, Nexus, and DataFlow types are all
|
|
361
|
+
safe for concurrent access from multiple threads.
|
|
362
|
+
|
|
363
|
+
```ruby
|
|
364
|
+
Kailash::Registry.open do |registry|
|
|
365
|
+
Kailash::Runtime.open(registry) do |runtime|
|
|
366
|
+
threads = 8.times.map do |i|
|
|
367
|
+
Thread.new do
|
|
368
|
+
builder = Kailash::WorkflowBuilder.new
|
|
369
|
+
builder.add_node("NoOpNode", "worker_#{i}", {})
|
|
370
|
+
wf = builder.build(registry)
|
|
371
|
+
result = runtime.execute(wf, { "index" => i })
|
|
372
|
+
puts "Thread #{i}: #{result.results["worker_#{i}"]["index"]}"
|
|
373
|
+
wf.close
|
|
374
|
+
end
|
|
375
|
+
end
|
|
376
|
+
threads.each(&:join)
|
|
377
|
+
end
|
|
378
|
+
end
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Known Limitation: No Ruby Thread Interrupts During Execution
|
|
382
|
+
|
|
383
|
+
When `Runtime#execute` or `Agent#run` releases the GVL to run Rust code, the
|
|
384
|
+
current Ruby thread **cannot** be interrupted by `Thread#kill`, `Thread#raise`,
|
|
385
|
+
or `Timeout.timeout`. Ruby's signal delivery and thread interruption require the
|
|
386
|
+
GVL, and the Rust runtime does not currently register an unblocking function
|
|
387
|
+
(UBF) with Ruby's threading subsystem.
|
|
388
|
+
|
|
389
|
+
**Impact**: `Timeout.timeout(5) { runtime.execute(workflow, inputs) }` will
|
|
390
|
+
**not** interrupt the Rust execution. The timeout fires only after the Rust call
|
|
391
|
+
completes and the GVL is reacquired.
|
|
392
|
+
|
|
393
|
+
**Workaround**: Use `RuntimeConfig` timeout settings, which are enforced inside
|
|
394
|
+
the Rust runtime:
|
|
395
|
+
|
|
396
|
+
```ruby
|
|
397
|
+
config = Kailash::RuntimeConfig.new
|
|
398
|
+
config.workflow_timeout = 5 # overall workflow deadline (seconds)
|
|
399
|
+
config.node_timeout = 3 # per-node deadline (seconds)
|
|
400
|
+
runtime = Kailash::Runtime.new(registry, config)
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
## Building from Source
|
|
404
|
+
|
|
405
|
+
### Full Build Steps
|
|
406
|
+
|
|
407
|
+
```bash
|
|
408
|
+
cd bindings/kailash-ruby
|
|
409
|
+
|
|
410
|
+
# Install Ruby dependencies
|
|
411
|
+
bundle install
|
|
412
|
+
|
|
413
|
+
# Compile the native extension (builds Rust code via cargo)
|
|
414
|
+
rake compile
|
|
415
|
+
|
|
416
|
+
# On macOS, sign the compiled bundle for notarization
|
|
417
|
+
codesign --sign - --force lib/kailash/kailash.bundle
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### Development Workflow
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
# Rebuild after Rust changes
|
|
424
|
+
rake compile
|
|
425
|
+
|
|
426
|
+
# Run the full test suite
|
|
427
|
+
bundle exec rspec
|
|
428
|
+
|
|
429
|
+
# Run a specific spec file
|
|
430
|
+
bundle exec rspec spec/callback_node_spec.rb
|
|
431
|
+
|
|
432
|
+
# Run with verbose output
|
|
433
|
+
bundle exec rspec --format documentation
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
## Testing
|
|
437
|
+
|
|
438
|
+
The test suite covers core workflow execution, all four frameworks, custom
|
|
439
|
+
callback nodes, value round-trips, GVL release behavior, thread safety, and
|
|
440
|
+
memory safety.
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
bundle exec rspec
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
**1,092 tests, 0 failures** across 14 spec files:
|
|
447
|
+
|
|
448
|
+
| Spec file | Coverage |
|
|
449
|
+
| -------------------------- | ------------------------------------------------ |
|
|
450
|
+
| `registry_spec.rb` | Node type registry, `.open` block API |
|
|
451
|
+
| `builder_workflow_spec.rb` | WorkflowBuilder, Workflow introspection |
|
|
452
|
+
| `runtime_spec.rb` | Runtime, RuntimeConfig, ExecutionResult, `.open` |
|
|
453
|
+
| `callback_node_spec.rb` | Custom lambda/Proc/callable nodes, errors |
|
|
454
|
+
| `value_spec.rb` | Value round-trips (all types, nesting, binary) |
|
|
455
|
+
| `gvl_release_spec.rb` | Concurrent execution, GVL release verification |
|
|
456
|
+
| `thread_safety_spec.rb` | Concurrent registry/runtime/framework access |
|
|
457
|
+
| `memory_spec.rb` | Close semantics, error hierarchy, GC pressure |
|
|
458
|
+
| `node_parity_spec.rb` | 139-node parity with Python binding |
|
|
459
|
+
| `kaizen_spec.rb` | AI agent config, tools, memory, trust postures |
|
|
460
|
+
| `kaizen_execution_spec.rb` | Agent.run, orchestration, vision, audio |
|
|
461
|
+
| `enterprise_spec.rb` | RBAC, ABAC, audit, tenancy, compliance |
|
|
462
|
+
| `nexus_spec.rb` | Server config, JWT, MCP, workflow registry |
|
|
463
|
+
| `dataflow_spec.rb` | Models, filters, dialects, transactions |
|
|
464
|
+
|
|
465
|
+
## Platform Support
|
|
466
|
+
|
|
467
|
+
| Platform | Architecture | Status |
|
|
468
|
+
| -------- | --------------------- | ------------ |
|
|
469
|
+
| macOS | arm64 (Apple Silicon) | Supported |
|
|
470
|
+
| Linux | x86_64 | CI validated |
|
|
471
|
+
|
|
472
|
+
Windows support is not yet available.
|
|
473
|
+
|
|
474
|
+
## License
|
|
475
|
+
|
|
476
|
+
**Proprietary.** This is a compiled native extension -- no Rust source code is
|
|
477
|
+
included in the gem. All `.rs` source files are trade secret and excluded from
|
|
478
|
+
distribution. See the Kailash SDK license agreement for terms.
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Kailash
|
|
4
|
+
# Trust Plane module wraps the Rust trust-plane crate, providing
|
|
5
|
+
# EATP-powered trust environment for human-AI collaborative work.
|
|
6
|
+
#
|
|
7
|
+
# All classes are defined by the native extension (Magnus).
|
|
8
|
+
# This file adds convenience methods and block-based lifecycle patterns.
|
|
9
|
+
module TrustPlane
|
|
10
|
+
# Convenience: open a TrustProject with a block for automatic scoping.
|
|
11
|
+
#
|
|
12
|
+
# Kailash::TrustPlane.create_project("/path", "MyProject", "author") do |project|
|
|
13
|
+
# project.record_decision(...)
|
|
14
|
+
# end
|
|
15
|
+
#
|
|
16
|
+
def self.create_project(path, name, author, envelope: nil, &block)
|
|
17
|
+
args = [path, name, author]
|
|
18
|
+
args << envelope if envelope
|
|
19
|
+
project = TrustProject.create(*args)
|
|
20
|
+
return project unless block
|
|
21
|
+
|
|
22
|
+
begin
|
|
23
|
+
yield project
|
|
24
|
+
ensure
|
|
25
|
+
# TrustProject has no explicit close, but ensure block completes
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Convenience: load an existing TrustProject with a block.
|
|
30
|
+
#
|
|
31
|
+
# Kailash::TrustPlane.load_project("/path/.trust") do |project|
|
|
32
|
+
# report = project.verify
|
|
33
|
+
# end
|
|
34
|
+
#
|
|
35
|
+
def self.load_project(path, &block)
|
|
36
|
+
project = TrustProject.load(path)
|
|
37
|
+
return project unless block
|
|
38
|
+
|
|
39
|
+
yield project
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Kailash
|
|
4
|
+
# Ruby gem version — kept in sync with Cargo.toml via release process.
|
|
5
|
+
# The native extension also defines Kailash::VERSION from the Rust side;
|
|
6
|
+
# this file provides a fallback before the extension is loaded.
|
|
7
|
+
GEM_VERSION = "0.2.0"
|
|
8
|
+
end
|
data/lib/kailash.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: kailash
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 3.10.0
|
|
5
|
+
platform: aarch64-linux
|
|
6
|
+
authors:
|
|
7
|
+
- Kailash Authors
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: rake-compiler
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.2'
|
|
19
|
+
type: :development
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '1.2'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: rspec
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '3.12'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '3.12'
|
|
40
|
+
description: High-performance workflow automation SDK powered by Rust. Build, validate,
|
|
41
|
+
and execute workflow DAGs from Ruby.
|
|
42
|
+
executables: []
|
|
43
|
+
extensions: []
|
|
44
|
+
extra_rdoc_files: []
|
|
45
|
+
files:
|
|
46
|
+
- README.md
|
|
47
|
+
- lib/kailash.rb
|
|
48
|
+
- lib/kailash/kailash.bundle
|
|
49
|
+
- lib/kailash/kailash.so
|
|
50
|
+
- lib/kailash/trust_plane.rb
|
|
51
|
+
- lib/kailash/version.rb
|
|
52
|
+
homepage: https://github.com/kailash/kailash
|
|
53
|
+
licenses:
|
|
54
|
+
- Proprietary
|
|
55
|
+
metadata:
|
|
56
|
+
source_code_uri: https://github.com/kailash/kailash
|
|
57
|
+
homepage_uri: https://github.com/kailash/kailash
|
|
58
|
+
rdoc_options: []
|
|
59
|
+
require_paths:
|
|
60
|
+
- lib
|
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
62
|
+
requirements:
|
|
63
|
+
- - ">="
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: 3.2.0
|
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
|
+
requirements:
|
|
68
|
+
- - ">="
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
version: 3.3.11
|
|
71
|
+
requirements: []
|
|
72
|
+
rubygems_version: 4.0.9
|
|
73
|
+
specification_version: 4
|
|
74
|
+
summary: Ruby binding for the Kailash workflow engine
|
|
75
|
+
test_files: []
|