igniter-extensions 0.5.2
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 +381 -0
- data/lib/igniter/extensions/contracts/aggregate_pack.rb +103 -0
- data/lib/igniter/extensions/contracts/audit/builder.rb +132 -0
- data/lib/igniter/extensions/contracts/audit/event.rb +34 -0
- data/lib/igniter/extensions/contracts/audit/snapshot.rb +44 -0
- data/lib/igniter/extensions/contracts/audit_pack.rb +60 -0
- data/lib/igniter/extensions/contracts/branch_pack.rb +199 -0
- data/lib/igniter/extensions/contracts/capabilities/declaration.rb +31 -0
- data/lib/igniter/extensions/contracts/capabilities/error.rb +35 -0
- data/lib/igniter/extensions/contracts/capabilities/policy.rb +20 -0
- data/lib/igniter/extensions/contracts/capabilities/report.rb +47 -0
- data/lib/igniter/extensions/contracts/capabilities/violation.rb +30 -0
- data/lib/igniter/extensions/contracts/capabilities_pack.rb +146 -0
- data/lib/igniter/extensions/contracts/collection_pack.rb +212 -0
- data/lib/igniter/extensions/contracts/commerce_pack.rb +91 -0
- data/lib/igniter/extensions/contracts/compose_pack.rb +213 -0
- data/lib/igniter/extensions/contracts/content_addressing/cache.rb +59 -0
- data/lib/igniter/extensions/contracts/content_addressing/content_key.rb +63 -0
- data/lib/igniter/extensions/contracts/content_addressing/declaration.rb +47 -0
- data/lib/igniter/extensions/contracts/content_addressing_pack.rb +90 -0
- data/lib/igniter/extensions/contracts/creator/profile.rb +196 -0
- data/lib/igniter/extensions/contracts/creator/report.rb +85 -0
- data/lib/igniter/extensions/contracts/creator/scaffold.rb +461 -0
- data/lib/igniter/extensions/contracts/creator/scope.rb +79 -0
- data/lib/igniter/extensions/contracts/creator/wizard.rb +269 -0
- data/lib/igniter/extensions/contracts/creator/workflow.rb +189 -0
- data/lib/igniter/extensions/contracts/creator/workflow_step.rb +51 -0
- data/lib/igniter/extensions/contracts/creator/write_result.rb +48 -0
- data/lib/igniter/extensions/contracts/creator/write_step.rb +63 -0
- data/lib/igniter/extensions/contracts/creator/writer.rb +131 -0
- data/lib/igniter/extensions/contracts/creator_pack.rb +128 -0
- data/lib/igniter/extensions/contracts/dataflow/aggregate_operators.rb +119 -0
- data/lib/igniter/extensions/contracts/dataflow/aggregate_state.rb +60 -0
- data/lib/igniter/extensions/contracts/dataflow/builder.rb +66 -0
- data/lib/igniter/extensions/contracts/dataflow/collection_result.rb +70 -0
- data/lib/igniter/extensions/contracts/dataflow/diff.rb +37 -0
- data/lib/igniter/extensions/contracts/dataflow/item_result.rb +44 -0
- data/lib/igniter/extensions/contracts/dataflow/result.rb +58 -0
- data/lib/igniter/extensions/contracts/dataflow/session.rb +173 -0
- data/lib/igniter/extensions/contracts/dataflow/window_filter.rb +49 -0
- data/lib/igniter/extensions/contracts/dataflow_pack.rb +66 -0
- data/lib/igniter/extensions/contracts/debug/pack_audit.rb +181 -0
- data/lib/igniter/extensions/contracts/debug/pack_snapshot.rb +46 -0
- data/lib/igniter/extensions/contracts/debug/profile_snapshot.rb +50 -0
- data/lib/igniter/extensions/contracts/debug/report.rb +50 -0
- data/lib/igniter/extensions/contracts/debug_pack.rb +115 -0
- data/lib/igniter/extensions/contracts/differential/divergence.rb +37 -0
- data/lib/igniter/extensions/contracts/differential/formatter.rb +85 -0
- data/lib/igniter/extensions/contracts/differential/report.rb +83 -0
- data/lib/igniter/extensions/contracts/differential/runner.rb +136 -0
- data/lib/igniter/extensions/contracts/differential_pack.rb +61 -0
- data/lib/igniter/extensions/contracts/execution_report_pack.rb +38 -0
- data/lib/igniter/extensions/contracts/incremental/formatter.rb +60 -0
- data/lib/igniter/extensions/contracts/incremental/node_state.rb +30 -0
- data/lib/igniter/extensions/contracts/incremental/result.rb +65 -0
- data/lib/igniter/extensions/contracts/incremental/session.rb +146 -0
- data/lib/igniter/extensions/contracts/incremental_pack.rb +40 -0
- data/lib/igniter/extensions/contracts/invariants/builder.rb +27 -0
- data/lib/igniter/extensions/contracts/invariants/cases_report.rb +47 -0
- data/lib/igniter/extensions/contracts/invariants/error.rb +34 -0
- data/lib/igniter/extensions/contracts/invariants/invariant.rb +30 -0
- data/lib/igniter/extensions/contracts/invariants/report.rb +45 -0
- data/lib/igniter/extensions/contracts/invariants/suite.rb +36 -0
- data/lib/igniter/extensions/contracts/invariants/violation.rb +39 -0
- data/lib/igniter/extensions/contracts/invariants_pack.rb +88 -0
- data/lib/igniter/extensions/contracts/journal_pack.rb +55 -0
- data/lib/igniter/extensions/contracts/language/formula_pack.rb +185 -0
- data/lib/igniter/extensions/contracts/language/piecewise_pack.rb +166 -0
- data/lib/igniter/extensions/contracts/language/scale_pack.rb +147 -0
- data/lib/igniter/extensions/contracts/lookup_pack.rb +50 -0
- data/lib/igniter/extensions/contracts/mcp/creator_session.rb +105 -0
- data/lib/igniter/extensions/contracts/mcp/tool_argument.rb +35 -0
- data/lib/igniter/extensions/contracts/mcp/tool_definition.rb +33 -0
- data/lib/igniter/extensions/contracts/mcp/tool_result.rb +28 -0
- data/lib/igniter/extensions/contracts/mcp_pack.rb +335 -0
- data/lib/igniter/extensions/contracts/provenance/builder.rb +80 -0
- data/lib/igniter/extensions/contracts/provenance/lineage.rb +59 -0
- data/lib/igniter/extensions/contracts/provenance/node_trace.rb +53 -0
- data/lib/igniter/extensions/contracts/provenance/text_formatter.rb +62 -0
- data/lib/igniter/extensions/contracts/provenance_pack.rb +52 -0
- data/lib/igniter/extensions/contracts/reactive/builder.rb +43 -0
- data/lib/igniter/extensions/contracts/reactive/dispatch_result.rb +59 -0
- data/lib/igniter/extensions/contracts/reactive/engine.rb +79 -0
- data/lib/igniter/extensions/contracts/reactive/event.rb +36 -0
- data/lib/igniter/extensions/contracts/reactive/matcher.rb +20 -0
- data/lib/igniter/extensions/contracts/reactive/plan.rb +58 -0
- data/lib/igniter/extensions/contracts/reactive/subscription.rb +29 -0
- data/lib/igniter/extensions/contracts/reactive_pack.rb +169 -0
- data/lib/igniter/extensions/contracts/saga/compensation.rb +25 -0
- data/lib/igniter/extensions/contracts/saga/compensation_record.rb +28 -0
- data/lib/igniter/extensions/contracts/saga/compensation_set.rb +47 -0
- data/lib/igniter/extensions/contracts/saga/formatter.rb +39 -0
- data/lib/igniter/extensions/contracts/saga/result.rb +56 -0
- data/lib/igniter/extensions/contracts/saga/runner.rb +124 -0
- data/lib/igniter/extensions/contracts/saga_pack.rb +56 -0
- data/lib/igniter/extensions/contracts.rb +445 -0
- data/lib/igniter/extensions.rb +6 -0
- data/lib/igniter-extensions.rb +3 -0
- metadata +152 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Igniter
|
|
4
|
+
module Extensions
|
|
5
|
+
module Contracts
|
|
6
|
+
module Saga
|
|
7
|
+
class Result
|
|
8
|
+
attr_reader :execution_result, :error, :failed_node, :compensations
|
|
9
|
+
|
|
10
|
+
def initialize(success:, execution_result:, error: nil, failed_node: nil, compensations: [])
|
|
11
|
+
@success = success
|
|
12
|
+
@execution_result = execution_result
|
|
13
|
+
@error = error
|
|
14
|
+
@failed_node = failed_node&.to_sym
|
|
15
|
+
@compensations = compensations.freeze
|
|
16
|
+
freeze
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def success?
|
|
20
|
+
@success
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def failed?
|
|
24
|
+
!success?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def output(name)
|
|
28
|
+
execution_result.output(name)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def explain
|
|
32
|
+
Formatter.format(self)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
alias to_s explain
|
|
36
|
+
|
|
37
|
+
def to_h
|
|
38
|
+
{
|
|
39
|
+
success: success?,
|
|
40
|
+
failed_node: failed_node,
|
|
41
|
+
error: error&.message,
|
|
42
|
+
compensations: compensations.map do |record|
|
|
43
|
+
{
|
|
44
|
+
node: record.node_name,
|
|
45
|
+
success: record.success?,
|
|
46
|
+
error: record.error&.message
|
|
47
|
+
}
|
|
48
|
+
end,
|
|
49
|
+
execution_result: execution_result.to_h
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Igniter
|
|
4
|
+
module Extensions
|
|
5
|
+
module Contracts
|
|
6
|
+
module Saga
|
|
7
|
+
class SagaError < Igniter::Contracts::Error; end
|
|
8
|
+
|
|
9
|
+
class Runner
|
|
10
|
+
def initialize(compiled_graph:, profile:, compensations:)
|
|
11
|
+
@compiled_graph = compiled_graph
|
|
12
|
+
@profile = profile
|
|
13
|
+
@compensations = normalize_compensations(compensations)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def run(inputs:)
|
|
17
|
+
state = Igniter::Contracts::MutableNamedValues.new
|
|
18
|
+
outputs = Igniter::Contracts::MutableNamedValues.new
|
|
19
|
+
normalized_inputs = Igniter::Contracts::NamedValues.new(inputs)
|
|
20
|
+
completed_operations = []
|
|
21
|
+
failed_operation = nil
|
|
22
|
+
|
|
23
|
+
@compiled_graph.operations.each do |operation|
|
|
24
|
+
failed_operation = operation
|
|
25
|
+
handler = @profile.runtime_handler(operation.kind)
|
|
26
|
+
value = handler.call(
|
|
27
|
+
operation: operation,
|
|
28
|
+
state: state,
|
|
29
|
+
outputs: outputs,
|
|
30
|
+
inputs: normalized_inputs,
|
|
31
|
+
profile: @profile
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
state.write(operation.name, value) unless operation.output?
|
|
35
|
+
outputs.write(operation.name, value) if operation.output?
|
|
36
|
+
completed_operations << operation unless operation.output?
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
Result.new(
|
|
40
|
+
success: true,
|
|
41
|
+
execution_result: execution_result_for(state, outputs)
|
|
42
|
+
)
|
|
43
|
+
rescue StandardError => e
|
|
44
|
+
execution_result = execution_result_for(state, outputs)
|
|
45
|
+
|
|
46
|
+
Result.new(
|
|
47
|
+
success: false,
|
|
48
|
+
execution_result: execution_result,
|
|
49
|
+
error: e,
|
|
50
|
+
failed_node: failed_operation&.name,
|
|
51
|
+
compensations: run_compensations(
|
|
52
|
+
completed_operations.reverse,
|
|
53
|
+
execution_result: execution_result,
|
|
54
|
+
inputs: normalized_inputs
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
private
|
|
60
|
+
|
|
61
|
+
def normalize_compensations(compensations)
|
|
62
|
+
case compensations
|
|
63
|
+
when CompensationSet
|
|
64
|
+
compensations
|
|
65
|
+
else
|
|
66
|
+
CompensationSet.new.tap do |set|
|
|
67
|
+
compensations.each do |node_name, handler|
|
|
68
|
+
set.compensate(node_name, &handler)
|
|
69
|
+
end
|
|
70
|
+
set.finalize!
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def execution_result_for(state, outputs)
|
|
76
|
+
Igniter::Contracts::ExecutionResult.new(
|
|
77
|
+
state: state.snapshot,
|
|
78
|
+
outputs: outputs.snapshot,
|
|
79
|
+
profile_fingerprint: @profile.fingerprint,
|
|
80
|
+
compiled_graph: @compiled_graph
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def run_compensations(operations, execution_result:, inputs:)
|
|
85
|
+
operations.filter_map do |operation|
|
|
86
|
+
compensation = @compensations[operation.name]
|
|
87
|
+
next unless compensation
|
|
88
|
+
|
|
89
|
+
attempt_compensation(compensation, operation, execution_result: execution_result, inputs: inputs)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def attempt_compensation(compensation, operation, execution_result:, inputs:)
|
|
94
|
+
compensation.run(
|
|
95
|
+
inputs: compensation_inputs_for(operation, execution_result: execution_result, inputs: inputs),
|
|
96
|
+
value: execution_result.state[operation.name]
|
|
97
|
+
)
|
|
98
|
+
CompensationRecord.new(node_name: compensation.node_name, success: true)
|
|
99
|
+
rescue StandardError => e
|
|
100
|
+
CompensationRecord.new(node_name: compensation.node_name, success: false, error: e)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def compensation_inputs_for(operation, execution_result:, inputs:)
|
|
104
|
+
dependency_names_for(operation).each_with_object({}) do |dependency_name, memo|
|
|
105
|
+
memo[dependency_name] =
|
|
106
|
+
if execution_result.state.key?(dependency_name)
|
|
107
|
+
execution_result.state[dependency_name]
|
|
108
|
+
else
|
|
109
|
+
inputs[dependency_name]
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def dependency_names_for(operation)
|
|
115
|
+
names = []
|
|
116
|
+
names.concat(Array(operation.attributes[:depends_on])) if operation.attribute?(:depends_on)
|
|
117
|
+
names << operation.attributes[:from] if operation.attribute?(:from)
|
|
118
|
+
names.map(&:to_sym).uniq
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "saga/compensation"
|
|
4
|
+
require_relative "saga/compensation_record"
|
|
5
|
+
require_relative "saga/compensation_set"
|
|
6
|
+
require_relative "saga/formatter"
|
|
7
|
+
require_relative "saga/result"
|
|
8
|
+
require_relative "saga/runner"
|
|
9
|
+
|
|
10
|
+
module Igniter
|
|
11
|
+
module Extensions
|
|
12
|
+
module Contracts
|
|
13
|
+
module SagaPack
|
|
14
|
+
module_function
|
|
15
|
+
|
|
16
|
+
def manifest
|
|
17
|
+
Igniter::Contracts::PackManifest.new(
|
|
18
|
+
name: :extensions_saga,
|
|
19
|
+
metadata: { category: :orchestration }
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def install_into(kernel)
|
|
24
|
+
kernel
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def build(&block)
|
|
28
|
+
Saga::CompensationSet.build(&block)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def run(environment, inputs:, compensations:, compiled_graph: nil, &block)
|
|
32
|
+
profile = environment.profile
|
|
33
|
+
ensure_installed!(profile)
|
|
34
|
+
graph = compiled_graph || environment.compile(&block)
|
|
35
|
+
|
|
36
|
+
Saga::Runner.new(
|
|
37
|
+
compiled_graph: graph,
|
|
38
|
+
profile: profile,
|
|
39
|
+
compensations: compensations
|
|
40
|
+
).run(inputs: inputs)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def explain(result)
|
|
44
|
+
result.explain
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def ensure_installed!(profile)
|
|
48
|
+
return if profile.pack_names.include?(:extensions_saga)
|
|
49
|
+
|
|
50
|
+
raise Saga::SagaError,
|
|
51
|
+
"SagaPack is not installed in profile #{profile.fingerprint}; add Igniter::Extensions::Contracts::SagaPack"
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "igniter/contracts"
|
|
4
|
+
require_relative "contracts/aggregate_pack"
|
|
5
|
+
require_relative "contracts/audit_pack"
|
|
6
|
+
require_relative "contracts/branch_pack"
|
|
7
|
+
require_relative "contracts/capabilities_pack"
|
|
8
|
+
require_relative "contracts/collection_pack"
|
|
9
|
+
require_relative "contracts/commerce_pack"
|
|
10
|
+
require_relative "contracts/compose_pack"
|
|
11
|
+
require_relative "contracts/content_addressing_pack"
|
|
12
|
+
require_relative "contracts/creator_pack"
|
|
13
|
+
require_relative "contracts/dataflow_pack"
|
|
14
|
+
require_relative "contracts/debug_pack"
|
|
15
|
+
require_relative "contracts/differential_pack"
|
|
16
|
+
require_relative "contracts/execution_report_pack"
|
|
17
|
+
require_relative "contracts/incremental_pack"
|
|
18
|
+
require_relative "contracts/invariants_pack"
|
|
19
|
+
require_relative "contracts/journal_pack"
|
|
20
|
+
require_relative "contracts/language/formula_pack"
|
|
21
|
+
require_relative "contracts/language/piecewise_pack"
|
|
22
|
+
require_relative "contracts/language/scale_pack"
|
|
23
|
+
require_relative "contracts/lookup_pack"
|
|
24
|
+
require_relative "contracts/mcp_pack"
|
|
25
|
+
require_relative "contracts/provenance_pack"
|
|
26
|
+
require_relative "contracts/reactive_pack"
|
|
27
|
+
require_relative "contracts/saga_pack"
|
|
28
|
+
|
|
29
|
+
module Igniter
|
|
30
|
+
module Extensions
|
|
31
|
+
module Contracts
|
|
32
|
+
DEFAULT_PACKS = [
|
|
33
|
+
ExecutionReportPack,
|
|
34
|
+
LookupPack
|
|
35
|
+
].freeze
|
|
36
|
+
|
|
37
|
+
AVAILABLE_PACKS = (
|
|
38
|
+
DEFAULT_PACKS +
|
|
39
|
+
[AggregatePack, AuditPack, BranchPack, CapabilitiesPack, CollectionPack, CommercePack, ComposePack,
|
|
40
|
+
ContentAddressingPack, CreatorPack, DataflowPack, DebugPack, DifferentialPack, IncrementalPack,
|
|
41
|
+
InvariantsPack, JournalPack, Language::FormulaPack, Language::PiecewisePack, Language::ScalePack,
|
|
42
|
+
McpPack, ProvenancePack, ReactivePack, SagaPack]
|
|
43
|
+
).freeze
|
|
44
|
+
|
|
45
|
+
PRESETS = {
|
|
46
|
+
default: DEFAULT_PACKS,
|
|
47
|
+
commerce: [ExecutionReportPack, CommercePack]
|
|
48
|
+
}.freeze
|
|
49
|
+
|
|
50
|
+
class << self
|
|
51
|
+
def default_packs
|
|
52
|
+
DEFAULT_PACKS
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def available_packs
|
|
56
|
+
AVAILABLE_PACKS
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def presets
|
|
60
|
+
PRESETS
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def packs_for(name)
|
|
64
|
+
presets.fetch(name.to_sym)
|
|
65
|
+
rescue KeyError
|
|
66
|
+
raise ArgumentError, "unknown contracts preset #{name}"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def build_profile(*packs)
|
|
70
|
+
Igniter::Contracts.build_profile(*normalize_packs(packs))
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def with(*packs)
|
|
74
|
+
Igniter::Contracts.with(*normalize_packs(packs))
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def build_preset_profile(name)
|
|
78
|
+
build_profile(*packs_for(name))
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def with_preset(name)
|
|
82
|
+
with(*packs_for(name))
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def lineage(result, output_name)
|
|
86
|
+
ProvenancePack.lineage(result, output_name)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def explain(result, output_name)
|
|
90
|
+
ProvenancePack.explain(result, output_name)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def build_compensations(&block)
|
|
94
|
+
SagaPack.build(&block)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def run_saga(environment, inputs:, compensations:, compiled_graph: nil, &block)
|
|
98
|
+
SagaPack.run(
|
|
99
|
+
environment,
|
|
100
|
+
inputs: inputs,
|
|
101
|
+
compensations: compensations,
|
|
102
|
+
compiled_graph: compiled_graph,
|
|
103
|
+
&block
|
|
104
|
+
)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def build_incremental_session(environment, compiled_graph: nil, &block)
|
|
108
|
+
IncrementalPack.session(environment, compiled_graph: compiled_graph, &block)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def build_dataflow_session(environment, source:, key:, window: nil, context: [], &block)
|
|
112
|
+
DataflowPack.session(
|
|
113
|
+
environment,
|
|
114
|
+
source: source,
|
|
115
|
+
key: key,
|
|
116
|
+
window: window,
|
|
117
|
+
context: context,
|
|
118
|
+
&block
|
|
119
|
+
)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def compare_differential(
|
|
123
|
+
inputs:,
|
|
124
|
+
primary_environment: nil,
|
|
125
|
+
primary_compiled_graph: nil,
|
|
126
|
+
primary_result: nil,
|
|
127
|
+
candidate_environment: nil,
|
|
128
|
+
candidate_compiled_graph: nil,
|
|
129
|
+
candidate_result: nil,
|
|
130
|
+
tolerance: nil,
|
|
131
|
+
primary_name: "primary",
|
|
132
|
+
candidate_name: "candidate"
|
|
133
|
+
)
|
|
134
|
+
DifferentialPack.compare(
|
|
135
|
+
inputs: inputs,
|
|
136
|
+
primary_environment: primary_environment,
|
|
137
|
+
primary_compiled_graph: primary_compiled_graph,
|
|
138
|
+
primary_result: primary_result,
|
|
139
|
+
candidate_environment: candidate_environment,
|
|
140
|
+
candidate_compiled_graph: candidate_compiled_graph,
|
|
141
|
+
candidate_result: candidate_result,
|
|
142
|
+
tolerance: tolerance,
|
|
143
|
+
primary_name: primary_name,
|
|
144
|
+
candidate_name: candidate_name
|
|
145
|
+
)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def shadow_differential(**arguments)
|
|
149
|
+
DifferentialPack.shadow(**arguments)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def audit_snapshot(result)
|
|
153
|
+
AuditPack.snapshot(result)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def audit_report(environment, inputs: nil, compiled_graph: nil, &block)
|
|
157
|
+
AuditPack.report(environment, inputs: inputs, compiled_graph: compiled_graph, &block)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def build_reactions(&block)
|
|
161
|
+
ReactivePack.build(&block)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def dispatch_reactive(target, reactions:)
|
|
165
|
+
ReactivePack.dispatch(target, reactions: reactions)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def run_reactive(environment, inputs:, reactions:, compiled_graph: nil, &block)
|
|
169
|
+
ReactivePack.run(environment, inputs: inputs, reactions: reactions, compiled_graph: compiled_graph, &block)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def run_incremental_reactive(session, inputs:, reactions:)
|
|
173
|
+
ReactivePack.run_incremental(session, inputs: inputs, reactions: reactions)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def build_invariants(&block)
|
|
177
|
+
InvariantsPack.build(&block)
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def check_invariants(target, invariants:)
|
|
181
|
+
InvariantsPack.check(target, invariants: invariants)
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def validate_invariants!(target, invariants:)
|
|
185
|
+
InvariantsPack.validate!(target, invariants: invariants)
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def run_invariants(environment, inputs:, invariants:, compiled_graph: nil, &block)
|
|
189
|
+
InvariantsPack.run(environment, inputs: inputs, invariants: invariants, compiled_graph: compiled_graph,
|
|
190
|
+
&block)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def verify_invariant_cases(environment, cases:, invariants:, compiled_graph: nil, &block)
|
|
194
|
+
InvariantsPack.verify_cases(environment,
|
|
195
|
+
cases: cases, invariants: invariants, compiled_graph: compiled_graph, &block)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def declare_capabilities(*capabilities, callable: nil, &block)
|
|
199
|
+
CapabilitiesPack.declare(*capabilities, callable: callable, &block)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def pure_callable(callable: nil, &block)
|
|
203
|
+
CapabilitiesPack.pure(callable: callable, &block)
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
def capability_policy(denied: [], required: [], on_undeclared: :ignore)
|
|
207
|
+
CapabilitiesPack.policy(denied: denied, required: required, on_undeclared: on_undeclared)
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def required_capabilities(compiled_graph)
|
|
211
|
+
CapabilitiesPack.required_capabilities(compiled_graph)
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def capabilities_for(compiled_graph, node_name)
|
|
215
|
+
CapabilitiesPack.capabilities_for(compiled_graph, node_name)
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
def profile_capabilities(profile_or_environment)
|
|
219
|
+
profile = profile_or_environment.respond_to?(:profile) ? profile_or_environment.profile : profile_or_environment
|
|
220
|
+
CapabilitiesPack.profile_capabilities(profile)
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def capability_report(compiled_graph, profile: nil, policy: nil)
|
|
224
|
+
CapabilitiesPack.report(compiled_graph, profile: profile, policy: policy)
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
def check_capabilities!(compiled_graph, policy:, profile: nil)
|
|
228
|
+
CapabilitiesPack.check!(compiled_graph, profile: profile, policy: policy)
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
def content_addressed(callable: nil, fingerprint: nil, capabilities: [:pure],
|
|
232
|
+
cache: ContentAddressingPack.cache, &block)
|
|
233
|
+
ContentAddressingPack.content_addressed(
|
|
234
|
+
callable: callable,
|
|
235
|
+
fingerprint: fingerprint,
|
|
236
|
+
capabilities: capabilities,
|
|
237
|
+
cache: cache,
|
|
238
|
+
&block
|
|
239
|
+
)
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
def pure_content_callable(callable: nil, fingerprint: nil, cache: ContentAddressingPack.cache, &block)
|
|
243
|
+
ContentAddressingPack.pure(callable: callable, fingerprint: fingerprint, cache: cache, &block)
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def content_key(inputs:, fingerprint: nil, callable: nil)
|
|
247
|
+
ContentAddressingPack.content_key(fingerprint: fingerprint, callable: callable, inputs: inputs)
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
def content_cache
|
|
251
|
+
ContentAddressingPack.cache
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
def reset_content_cache!
|
|
255
|
+
ContentAddressingPack.reset_cache!
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
def debug_profile(target)
|
|
259
|
+
profile = target.respond_to?(:profile) ? target.profile : target
|
|
260
|
+
DebugPack.profile_snapshot(profile)
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def debug_pack(pack_or_name, target)
|
|
264
|
+
profile = target.respond_to?(:profile) ? target.profile : target
|
|
265
|
+
DebugPack.pack_snapshot(pack_or_name, profile: profile)
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
def audit_pack(pack, target = nil)
|
|
269
|
+
profile =
|
|
270
|
+
case target
|
|
271
|
+
when nil
|
|
272
|
+
nil
|
|
273
|
+
else
|
|
274
|
+
target.respond_to?(:profile) ? target.profile : target
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
DebugPack.audit(pack, profile: profile)
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
def creator_profiles
|
|
281
|
+
CreatorPack.available_profiles
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def creator_scopes
|
|
285
|
+
CreatorPack.available_scopes
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
def scaffold_pack(name:, kind: nil, namespace: "MyCompany::IgniterPacks", profile: nil, capabilities: nil,
|
|
289
|
+
scope: :monorepo_package)
|
|
290
|
+
CreatorPack.scaffold(
|
|
291
|
+
name: name,
|
|
292
|
+
kind: kind,
|
|
293
|
+
namespace: namespace,
|
|
294
|
+
profile: profile,
|
|
295
|
+
capabilities: capabilities,
|
|
296
|
+
scope: scope
|
|
297
|
+
)
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
def creator_report(name:, kind: nil, namespace: "MyCompany::IgniterPacks", profile: nil, capabilities: nil,
|
|
301
|
+
scope: :monorepo_package, pack: nil, target: nil)
|
|
302
|
+
runtime_profile =
|
|
303
|
+
case target
|
|
304
|
+
when nil
|
|
305
|
+
nil
|
|
306
|
+
else
|
|
307
|
+
target.respond_to?(:profile) ? target.profile : target
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
CreatorPack.report(
|
|
311
|
+
name: name,
|
|
312
|
+
kind: kind,
|
|
313
|
+
namespace: namespace,
|
|
314
|
+
profile: profile,
|
|
315
|
+
capabilities: capabilities,
|
|
316
|
+
scope: scope,
|
|
317
|
+
pack: pack,
|
|
318
|
+
target_profile: runtime_profile
|
|
319
|
+
)
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
def creator_workflow(name:, kind: nil, namespace: "MyCompany::IgniterPacks", profile: nil, capabilities: nil,
|
|
323
|
+
scope: :monorepo_package, pack: nil, target: nil)
|
|
324
|
+
runtime_profile =
|
|
325
|
+
case target
|
|
326
|
+
when nil
|
|
327
|
+
nil
|
|
328
|
+
else
|
|
329
|
+
target.respond_to?(:profile) ? target.profile : target
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
CreatorPack.workflow(
|
|
333
|
+
name: name,
|
|
334
|
+
kind: kind,
|
|
335
|
+
namespace: namespace,
|
|
336
|
+
profile: profile,
|
|
337
|
+
capabilities: capabilities,
|
|
338
|
+
scope: scope,
|
|
339
|
+
pack: pack,
|
|
340
|
+
target_profile: runtime_profile
|
|
341
|
+
)
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
def creator_wizard(name: nil, kind: nil, namespace: "MyCompany::IgniterPacks", profile: nil, capabilities: nil,
|
|
345
|
+
scope: nil, root: nil, mode: :skip_existing, pack: nil, target: nil)
|
|
346
|
+
runtime_profile =
|
|
347
|
+
case target
|
|
348
|
+
when nil
|
|
349
|
+
nil
|
|
350
|
+
else
|
|
351
|
+
target.respond_to?(:profile) ? target.profile : target
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
CreatorPack.wizard(
|
|
355
|
+
name: name,
|
|
356
|
+
kind: kind,
|
|
357
|
+
namespace: namespace,
|
|
358
|
+
profile: profile,
|
|
359
|
+
capabilities: capabilities,
|
|
360
|
+
scope: scope,
|
|
361
|
+
root: root,
|
|
362
|
+
mode: mode,
|
|
363
|
+
pack: pack,
|
|
364
|
+
target_profile: runtime_profile
|
|
365
|
+
)
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
def creator_writer(name:, root:, kind: nil, namespace: "MyCompany::IgniterPacks", profile: nil, capabilities: nil,
|
|
369
|
+
scope: :monorepo_package, pack: nil, target: nil, mode: :skip_existing)
|
|
370
|
+
runtime_profile =
|
|
371
|
+
case target
|
|
372
|
+
when nil
|
|
373
|
+
nil
|
|
374
|
+
else
|
|
375
|
+
target.respond_to?(:profile) ? target.profile : target
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
CreatorPack.writer(
|
|
379
|
+
name: name,
|
|
380
|
+
kind: kind,
|
|
381
|
+
namespace: namespace,
|
|
382
|
+
profile: profile,
|
|
383
|
+
capabilities: capabilities,
|
|
384
|
+
scope: scope,
|
|
385
|
+
pack: pack,
|
|
386
|
+
target_profile: runtime_profile,
|
|
387
|
+
root: root,
|
|
388
|
+
mode: mode
|
|
389
|
+
)
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
def write_pack_scaffold(name:, root:, kind: nil, namespace: "MyCompany::IgniterPacks", profile: nil,
|
|
393
|
+
capabilities: nil, scope: :monorepo_package, pack: nil, target: nil, mode: :skip_existing)
|
|
394
|
+
runtime_profile =
|
|
395
|
+
case target
|
|
396
|
+
when nil
|
|
397
|
+
nil
|
|
398
|
+
else
|
|
399
|
+
target.respond_to?(:profile) ? target.profile : target
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
CreatorPack.write(
|
|
403
|
+
name: name,
|
|
404
|
+
kind: kind,
|
|
405
|
+
namespace: namespace,
|
|
406
|
+
profile: profile,
|
|
407
|
+
capabilities: capabilities,
|
|
408
|
+
scope: scope,
|
|
409
|
+
pack: pack,
|
|
410
|
+
target_profile: runtime_profile,
|
|
411
|
+
root: root,
|
|
412
|
+
mode: mode
|
|
413
|
+
)
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
def mcp_tools
|
|
417
|
+
McpPack.tool_catalog
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
def mcp_call(tool_name, target: nil, **arguments, &block)
|
|
421
|
+
McpPack.call(tool_name, target: target, **arguments, &block)
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
def mcp_creator_session(target: nil, **arguments)
|
|
425
|
+
mcp_call(:creator_session_start, target: target, **arguments)
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
def debug_snapshot(result, profile:)
|
|
429
|
+
DebugPack.snapshot(result, profile: profile)
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
def debug_report(environment, inputs: nil, compiled_graph: nil, &block)
|
|
433
|
+
DebugPack.report(environment, inputs: inputs, compiled_graph: compiled_graph, &block)
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
private
|
|
437
|
+
|
|
438
|
+
def normalize_packs(packs)
|
|
439
|
+
normalized = packs.flatten.compact
|
|
440
|
+
normalized.empty? ? default_packs : normalized
|
|
441
|
+
end
|
|
442
|
+
end
|
|
443
|
+
end
|
|
444
|
+
end
|
|
445
|
+
end
|