Class: KairosMcp::DefinitionContext
- Inherits:
-
Object
- Object
- KairosMcp::DefinitionContext
- Defined in:
- lib/kairos_mcp/skill_contexts.rb
Overview
Definition block context — collects partially-formalized AST nodes Used in the structural layer (definition block) of dual-representation Skills. Nodes represent the subset of content that has been formalized into AST form.
Instance Attribute Summary collapse
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Instance Method Summary collapse
-
#check(name, condition:, **opts) ⇒ Object
Condition check (clear success/failure criteria).
-
#constraint(name, **opts) ⇒ Object
Deterministic constraint (binary, measurable criteria).
-
#initialize ⇒ DefinitionContext
constructor
A new instance of DefinitionContext.
-
#node(name, type:, prompt:, source_span: nil) ⇒ Object
Semantic reasoning node (delegates to LLM — formal expression of non-formalization).
-
#plan(name, steps:) ⇒ Object
Execution step sequence (deterministic, order-dependent procedures).
- #to_h ⇒ Object
-
#tool_call(name, command:, **opts) ⇒ Object
External tool/command execution (strict parameter precision required).
Constructor Details
#initialize ⇒ DefinitionContext
Returns a new instance of DefinitionContext.
126 127 128 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 126 def initialize @nodes = [] end |
Instance Attribute Details
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
124 125 126 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 124 def nodes @nodes end |
Instance Method Details
#check(name, condition:, **opts) ⇒ Object
Condition check (clear success/failure criteria)
171 172 173 174 175 176 177 178 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 171 def check(name, condition:, **opts) @nodes << AstNode.new( type: :Check, name: name, options: opts.merge(condition: condition), source_span: nil ) end |
#constraint(name, **opts) ⇒ Object
Deterministic constraint (binary, measurable criteria)
131 132 133 134 135 136 137 138 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 131 def constraint(name, **opts) @nodes << AstNode.new( type: :Constraint, name: name, options: opts, source_span: nil ) end |
#node(name, type:, prompt:, source_span: nil) ⇒ Object
Semantic reasoning node (delegates to LLM — formal expression of non-formalization)
141 142 143 144 145 146 147 148 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 141 def node(name, type:, prompt:, source_span: nil) @nodes << AstNode.new( type: type.to_sym, name: name, options: { prompt: prompt }, source_span: source_span ) end |
#plan(name, steps:) ⇒ Object
Execution step sequence (deterministic, order-dependent procedures)
151 152 153 154 155 156 157 158 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 151 def plan(name, steps:) @nodes << AstNode.new( type: :Plan, name: name, options: { steps: steps }, source_span: nil ) end |
#to_h ⇒ Object
180 181 182 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 180 def to_h { nodes: @nodes.map(&:to_h) } end |
#tool_call(name, command:, **opts) ⇒ Object
External tool/command execution (strict parameter precision required)
161 162 163 164 165 166 167 168 |
# File 'lib/kairos_mcp/skill_contexts.rb', line 161 def tool_call(name, command:, **opts) @nodes << AstNode.new( type: :ToolCall, name: name, options: opts.merge(command: command), source_span: nil ) end |