praxo-core 0.6.0 → 0.8.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 +4 -4
- data/README.md +4 -2
- data/REGISTRY.md +25 -6
- data/api/0.7.0.txt +135 -0
- data/api/0.8.0.txt +135 -0
- data/lib/praxo/adapters/otel_sink.rb +121 -0
- data/lib/praxo/agent.rb +21 -2
- data/lib/praxo/delegation.rb +150 -0
- data/lib/praxo/retriever.rb +22 -0
- data/lib/praxo.rb +3 -0
- data/llms.md +21 -4
- data/llms.txt +21 -4
- metadata +6 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 16f51199165f1dfbb11aea069e4aea7b246a352e900464e43fd6017a32187df5
|
|
4
|
+
data.tar.gz: 10bcb9c2f8856b6ad318f8a45e0b5cb58ed8aac3e1dc0b3e4ee43ea03f7b53f2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b7fef8001aa05f6c884f850820298a213cb6abafc8e0751a9b74867e3221ed79058ba1da42555d9236db1c73f7f7d6c53f5a333ab98397e9359acc867a2a2ff
|
|
7
|
+
data.tar.gz: d70c6a3138e435d5c7f77bde234377272b2dbdddb19514e2efa242c29cd10757fc586dbf56ee7dcaf1247eba7422ea637fa7f737f7c6a07ccc5218ce045cb2f1
|
data/README.md
CHANGED
|
@@ -20,8 +20,10 @@ reference implementation.
|
|
|
20
20
|
|
|
21
21
|
- Registry introduction: [REGISTRY.md](https://github.com/axisvela/praxo-core/blob/main/language/ruby/REGISTRY.md)
|
|
22
22
|
- Machine-readable entry: [llms.txt](https://github.com/axisvela/praxo-core/blob/main/language/ruby/llms.txt) and [llms.md](https://github.com/axisvela/praxo-core/blob/main/language/ruby/llms.md)
|
|
23
|
+
- [Examples](https://github.com/axisvela/praxo-core/tree/main/language/ruby/examples): runnable language-specific examples.
|
|
23
24
|
- Coding-agent contract: [docs/getting-started/coding-agents.md](https://github.com/axisvela/praxo-core/blob/main/docs/getting-started/coding-agents.md)
|
|
24
|
-
- Registry: [RubyGems](https://rubygems.org/gems/praxo-core/versions/0.
|
|
25
|
+
- Registry: [RubyGems](https://rubygems.org/gems/praxo-core/versions/0.7.0)
|
|
26
|
+
- Community: [X](https://x.com/axisvela) · [Weibo](https://weibo.com/u/1936025761)
|
|
25
27
|
|
|
26
28
|
## Install
|
|
27
29
|
|
|
@@ -132,5 +134,5 @@ before emitting.
|
|
|
132
134
|
|
|
133
135
|
## Release
|
|
134
136
|
|
|
135
|
-
Tag shape: `ruby/v0.
|
|
137
|
+
Tag shape: `ruby/v0.8.0`. The tag targets `SPEC_VERSION` `0.2.0`. See
|
|
136
138
|
[CHANGELOG.md](CHANGELOG.md) for per-release changes and compatibility notes.
|
data/REGISTRY.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# PRAXO-CORE Ruby Registry Introduction
|
|
2
2
|
|
|
3
|
-
**Status:** published; split source repository. Source version `0.
|
|
4
|
-
tag `ruby/v0.
|
|
3
|
+
**Status:** published; split source repository. Source version `0.8.0`, source
|
|
4
|
+
tag `ruby/v0.8.0`. Published registry version: `0.7.0`. Registry
|
|
5
5
|
pages are release snapshots; verify the published version before relying on a
|
|
6
6
|
feature.
|
|
7
7
|
|
|
@@ -14,23 +14,42 @@ PRAXO-CORE is an embeddable, MIT-licensed agent framework. This gem is its nativ
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
| --- | --- |
|
|
16
16
|
| Package | `praxo-core` |
|
|
17
|
-
| Registry | [RubyGems](https://rubygems.org/gems/praxo-core/versions/0.
|
|
18
|
-
| Source version | `0.
|
|
19
|
-
| Published registry version | `0.
|
|
17
|
+
| Registry | [RubyGems](https://rubygems.org/gems/praxo-core/versions/0.7.0) |
|
|
18
|
+
| Source version | `0.8.0` |
|
|
19
|
+
| Published registry version | `0.7.0` |
|
|
20
20
|
| Install (published) | `gem install praxo-core` |
|
|
21
21
|
| Install (source/release prepared) | `gem install praxo-core` |
|
|
22
|
-
| Source tag | `ruby/v0.
|
|
22
|
+
| Source tag | `ruby/v0.8.0` |
|
|
23
23
|
| Tier | Core |
|
|
24
24
|
| Contract | `SPEC_VERSION` `0.2.0` |
|
|
25
25
|
| Documentation | https://axisvela.github.io/praxo-core/languages/ruby/ |
|
|
26
26
|
|
|
27
|
+
## Capabilities and Status
|
|
28
|
+
|
|
29
|
+
| Adapter | Status | Detail |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| OpenAI-compatible model | native | `Praxo::Adapters::OpenAICompatible` |
|
|
32
|
+
| Anthropic model | native | `Praxo::Adapters::Anthropic`; injectable transport |
|
|
33
|
+
| Gemini model | native | `Praxo::Adapters::Gemini`; injectable transport |
|
|
34
|
+
| MCP client | native | `Praxo::Adapters::MCPClient`; stdio, plus `HttpMCPTransport` for Streamable HTTP 2025-03-26 |
|
|
35
|
+
| Harmovela sink | native | `Praxo::Adapters::HarmovelaSink` |
|
|
36
|
+
| OpenTelemetry sink | native (transport seam) | `OtelSink`; caller supplies OTLP/HTTP transport |
|
|
37
|
+
| Subagent delegation | native | `Delegation::SubagentManager` |
|
|
38
|
+
| Retriever | native | `Document`, `FuncRetriever` |
|
|
39
|
+
|
|
27
40
|
## Coding-agent entry
|
|
28
41
|
|
|
42
|
+
- [Examples](https://github.com/axisvela/praxo-core/tree/main/language/ruby/examples): runnable language-specific examples.
|
|
29
43
|
- [llms.txt](llms.txt): compact machine-readable entry for this language.
|
|
30
44
|
- [llms.md](llms.md): Markdown version of the same entry.
|
|
31
45
|
- [Coding-agent contract](../../docs/getting-started/coding-agents.md): explicit
|
|
32
46
|
scope, final-argument authorization, denial tests, and verification commands.
|
|
33
47
|
|
|
48
|
+
## Community
|
|
49
|
+
|
|
50
|
+
- X: <https://x.com/axisvela>
|
|
51
|
+
- Weibo: <https://weibo.com/u/1936025761>
|
|
52
|
+
|
|
34
53
|
## Boundaries
|
|
35
54
|
|
|
36
55
|
- PRAXO-CORE is an embeddable, MIT-licensed execution kernel, not a hosted
|
data/api/0.7.0.txt
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# PRAXO-CORE Ruby API 0.7.0
|
|
2
|
+
# SPEC_VERSION 0.2.0
|
|
3
|
+
|
|
4
|
+
class AgentOptions
|
|
5
|
+
class CallLimit
|
|
6
|
+
class CheckpointAllowlist
|
|
7
|
+
class ContextBudget
|
|
8
|
+
class Error
|
|
9
|
+
class FilterSink
|
|
10
|
+
class FuncRetriever
|
|
11
|
+
class FuncTool
|
|
12
|
+
class MemoryStore
|
|
13
|
+
class MultiSink
|
|
14
|
+
class PathChecker
|
|
15
|
+
class PiiRedactor
|
|
16
|
+
class Runner
|
|
17
|
+
class StaticModel
|
|
18
|
+
class StructuredOutput
|
|
19
|
+
class SubagentManager
|
|
20
|
+
class ToolRegistry
|
|
21
|
+
class ToolSelection
|
|
22
|
+
def action
|
|
23
|
+
def after_run
|
|
24
|
+
def allowed?
|
|
25
|
+
def allows?
|
|
26
|
+
def apply
|
|
27
|
+
def apply_interrupt
|
|
28
|
+
def array
|
|
29
|
+
def as_int
|
|
30
|
+
def as_object
|
|
31
|
+
def as_string
|
|
32
|
+
def authorize
|
|
33
|
+
def before_model
|
|
34
|
+
def before_run
|
|
35
|
+
def before_tool
|
|
36
|
+
def bool
|
|
37
|
+
def cancel
|
|
38
|
+
def check
|
|
39
|
+
def check_cancelled
|
|
40
|
+
def check_enum
|
|
41
|
+
def check_keys
|
|
42
|
+
def compact
|
|
43
|
+
def content_block
|
|
44
|
+
def copy
|
|
45
|
+
def decision
|
|
46
|
+
def emit
|
|
47
|
+
def emit_stream
|
|
48
|
+
def equals
|
|
49
|
+
def error
|
|
50
|
+
def error_code
|
|
51
|
+
def estimate_tokens
|
|
52
|
+
def event
|
|
53
|
+
def execute
|
|
54
|
+
def execute_tool
|
|
55
|
+
def extract_json
|
|
56
|
+
def fallback_model
|
|
57
|
+
def filter
|
|
58
|
+
def generate
|
|
59
|
+
def get
|
|
60
|
+
def has?
|
|
61
|
+
def initialize
|
|
62
|
+
def int
|
|
63
|
+
def interrupt
|
|
64
|
+
def interrupt_decision
|
|
65
|
+
def invoke
|
|
66
|
+
def invoke_tool
|
|
67
|
+
def invoke_tools
|
|
68
|
+
def launch
|
|
69
|
+
def marshal
|
|
70
|
+
def memory_record
|
|
71
|
+
def message
|
|
72
|
+
def message_assistant
|
|
73
|
+
def message_text
|
|
74
|
+
def message_tool
|
|
75
|
+
def message_wire
|
|
76
|
+
def parse
|
|
77
|
+
def parse_input_json
|
|
78
|
+
def parse_json_call
|
|
79
|
+
def parse_manifest
|
|
80
|
+
def parse_plain
|
|
81
|
+
def parse_tag
|
|
82
|
+
def parse_toolcall
|
|
83
|
+
def parse_xml
|
|
84
|
+
def plus
|
|
85
|
+
def prepare_tool
|
|
86
|
+
def put
|
|
87
|
+
def redact
|
|
88
|
+
def redact_value
|
|
89
|
+
def register
|
|
90
|
+
def reject
|
|
91
|
+
def request
|
|
92
|
+
def resolve_path
|
|
93
|
+
def response
|
|
94
|
+
def retrieve
|
|
95
|
+
def run
|
|
96
|
+
def run_agent
|
|
97
|
+
def run_result
|
|
98
|
+
def search
|
|
99
|
+
def session
|
|
100
|
+
def set
|
|
101
|
+
def specs
|
|
102
|
+
def stream_part
|
|
103
|
+
def string
|
|
104
|
+
def stringify
|
|
105
|
+
def strip_markup
|
|
106
|
+
def structured_apply
|
|
107
|
+
def text_present
|
|
108
|
+
def timestamp
|
|
109
|
+
def to_wire
|
|
110
|
+
def tool_call
|
|
111
|
+
def tool_spec
|
|
112
|
+
def truncate_to_tokens
|
|
113
|
+
def unmarshal
|
|
114
|
+
def update
|
|
115
|
+
def usage
|
|
116
|
+
def validate
|
|
117
|
+
def visit
|
|
118
|
+
def visit_array
|
|
119
|
+
def visit_boolean
|
|
120
|
+
def visit_number
|
|
121
|
+
def visit_object
|
|
122
|
+
def visit_string
|
|
123
|
+
def wait
|
|
124
|
+
def within?
|
|
125
|
+
module Agent
|
|
126
|
+
module Delegation
|
|
127
|
+
module Json
|
|
128
|
+
module JsonSchema
|
|
129
|
+
module Middleware
|
|
130
|
+
module Models
|
|
131
|
+
module Plugin
|
|
132
|
+
module Praxo
|
|
133
|
+
module Runtime
|
|
134
|
+
module SSE
|
|
135
|
+
module Toolcall
|
data/api/0.8.0.txt
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# PRAXO-CORE Ruby API 0.8.0
|
|
2
|
+
# SPEC_VERSION 0.2.0
|
|
3
|
+
|
|
4
|
+
class AgentOptions
|
|
5
|
+
class CallLimit
|
|
6
|
+
class CheckpointAllowlist
|
|
7
|
+
class ContextBudget
|
|
8
|
+
class Error
|
|
9
|
+
class FilterSink
|
|
10
|
+
class FuncRetriever
|
|
11
|
+
class FuncTool
|
|
12
|
+
class MemoryStore
|
|
13
|
+
class MultiSink
|
|
14
|
+
class PathChecker
|
|
15
|
+
class PiiRedactor
|
|
16
|
+
class Runner
|
|
17
|
+
class StaticModel
|
|
18
|
+
class StructuredOutput
|
|
19
|
+
class SubagentManager
|
|
20
|
+
class ToolRegistry
|
|
21
|
+
class ToolSelection
|
|
22
|
+
def action
|
|
23
|
+
def after_run
|
|
24
|
+
def allowed?
|
|
25
|
+
def allows?
|
|
26
|
+
def apply
|
|
27
|
+
def apply_interrupt
|
|
28
|
+
def array
|
|
29
|
+
def as_int
|
|
30
|
+
def as_object
|
|
31
|
+
def as_string
|
|
32
|
+
def authorize
|
|
33
|
+
def before_model
|
|
34
|
+
def before_run
|
|
35
|
+
def before_tool
|
|
36
|
+
def bool
|
|
37
|
+
def cancel
|
|
38
|
+
def check
|
|
39
|
+
def check_cancelled
|
|
40
|
+
def check_enum
|
|
41
|
+
def check_keys
|
|
42
|
+
def compact
|
|
43
|
+
def content_block
|
|
44
|
+
def copy
|
|
45
|
+
def decision
|
|
46
|
+
def emit
|
|
47
|
+
def emit_stream
|
|
48
|
+
def equals
|
|
49
|
+
def error
|
|
50
|
+
def error_code
|
|
51
|
+
def estimate_tokens
|
|
52
|
+
def event
|
|
53
|
+
def execute
|
|
54
|
+
def execute_tool
|
|
55
|
+
def extract_json
|
|
56
|
+
def fallback_model
|
|
57
|
+
def filter
|
|
58
|
+
def generate
|
|
59
|
+
def get
|
|
60
|
+
def has?
|
|
61
|
+
def initialize
|
|
62
|
+
def int
|
|
63
|
+
def interrupt
|
|
64
|
+
def interrupt_decision
|
|
65
|
+
def invoke
|
|
66
|
+
def invoke_tool
|
|
67
|
+
def invoke_tools
|
|
68
|
+
def launch
|
|
69
|
+
def marshal
|
|
70
|
+
def memory_record
|
|
71
|
+
def message
|
|
72
|
+
def message_assistant
|
|
73
|
+
def message_text
|
|
74
|
+
def message_tool
|
|
75
|
+
def message_wire
|
|
76
|
+
def parse
|
|
77
|
+
def parse_input_json
|
|
78
|
+
def parse_json_call
|
|
79
|
+
def parse_manifest
|
|
80
|
+
def parse_plain
|
|
81
|
+
def parse_tag
|
|
82
|
+
def parse_toolcall
|
|
83
|
+
def parse_xml
|
|
84
|
+
def plus
|
|
85
|
+
def prepare_tool
|
|
86
|
+
def put
|
|
87
|
+
def redact
|
|
88
|
+
def redact_value
|
|
89
|
+
def register
|
|
90
|
+
def reject
|
|
91
|
+
def request
|
|
92
|
+
def resolve_path
|
|
93
|
+
def response
|
|
94
|
+
def retrieve
|
|
95
|
+
def run
|
|
96
|
+
def run_agent
|
|
97
|
+
def run_result
|
|
98
|
+
def search
|
|
99
|
+
def session
|
|
100
|
+
def set
|
|
101
|
+
def specs
|
|
102
|
+
def stream_part
|
|
103
|
+
def string
|
|
104
|
+
def stringify
|
|
105
|
+
def strip_markup
|
|
106
|
+
def structured_apply
|
|
107
|
+
def text_present
|
|
108
|
+
def timestamp
|
|
109
|
+
def to_wire
|
|
110
|
+
def tool_call
|
|
111
|
+
def tool_spec
|
|
112
|
+
def truncate_to_tokens
|
|
113
|
+
def unmarshal
|
|
114
|
+
def update
|
|
115
|
+
def usage
|
|
116
|
+
def validate
|
|
117
|
+
def visit
|
|
118
|
+
def visit_array
|
|
119
|
+
def visit_boolean
|
|
120
|
+
def visit_number
|
|
121
|
+
def visit_object
|
|
122
|
+
def visit_string
|
|
123
|
+
def wait
|
|
124
|
+
def within?
|
|
125
|
+
module Agent
|
|
126
|
+
module Delegation
|
|
127
|
+
module Json
|
|
128
|
+
module JsonSchema
|
|
129
|
+
module Middleware
|
|
130
|
+
module Models
|
|
131
|
+
module Plugin
|
|
132
|
+
module Praxo
|
|
133
|
+
module Runtime
|
|
134
|
+
module SSE
|
|
135
|
+
module Toolcall
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
require 'net/http'
|
|
2
|
+
require 'time'
|
|
3
|
+
require 'uri'
|
|
4
|
+
require_relative '../errors'
|
|
5
|
+
require_relative '../json'
|
|
6
|
+
|
|
7
|
+
module Praxo
|
|
8
|
+
module Adapters
|
|
9
|
+
class OtelSink
|
|
10
|
+
MAX_BODY = 512
|
|
11
|
+
|
|
12
|
+
def initialize(endpoint: 'http://127.0.0.1:4318/v1/traces',
|
|
13
|
+
service_name: 'praxo-core', transport: nil,
|
|
14
|
+
allowed_data_keys: [], timeout: 10)
|
|
15
|
+
@endpoint = endpoint.to_s.empty? ? 'http://127.0.0.1:4318/v1/traces' : endpoint
|
|
16
|
+
@service_name = service_name.to_s.empty? ? 'praxo-core' : service_name
|
|
17
|
+
@transport = transport
|
|
18
|
+
@allowed_data_keys = Array(allowed_data_keys).map(&:to_s)
|
|
19
|
+
@timeout = timeout
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def emit(event)
|
|
23
|
+
now = Time.now.utc
|
|
24
|
+
stamp = otel_stamp(event, now)
|
|
25
|
+
nanos = now.to_i * 1_000_000_000 + now.nsec
|
|
26
|
+
data = event.data || {}
|
|
27
|
+
key = [event.session_id, event.run_id, event.type,
|
|
28
|
+
Json.stringify(data)].join('|')
|
|
29
|
+
trace_id = [2166136261, 3307539480, 1540483477, 2807494644]
|
|
30
|
+
.map { |seed| hex32(fnv1a(key, seed)) }.join
|
|
31
|
+
span_key = "#{key}|span"
|
|
32
|
+
span_id = [2166136261, 3307539480]
|
|
33
|
+
.map { |seed| hex32(fnv1a(span_key, seed)) }.join
|
|
34
|
+
attributes = [attribute('praxo.event.type', event.type)]
|
|
35
|
+
if event.session_id && !event.session_id.empty?
|
|
36
|
+
attributes << attribute('praxo.session.id', event.session_id)
|
|
37
|
+
end
|
|
38
|
+
if event.run_id && !event.run_id.empty?
|
|
39
|
+
attributes << attribute('praxo.run.id', event.run_id)
|
|
40
|
+
end
|
|
41
|
+
attributes << attribute('praxo.event.at', stamp)
|
|
42
|
+
@allowed_data_keys.each do |name|
|
|
43
|
+
next unless data.key?(name)
|
|
44
|
+
|
|
45
|
+
attributes << attribute("praxo.event.data.#{name}", otel_text(data[name]))
|
|
46
|
+
end
|
|
47
|
+
payload = {
|
|
48
|
+
'resourceSpans' => [{
|
|
49
|
+
'resource' => {
|
|
50
|
+
'attributes' => [attribute('service.name', @service_name)]
|
|
51
|
+
},
|
|
52
|
+
'scopeSpans' => [{
|
|
53
|
+
'scope' => { 'name' => 'praxo-core' },
|
|
54
|
+
'spans' => [{
|
|
55
|
+
'traceId' => trace_id,
|
|
56
|
+
'spanId' => span_id,
|
|
57
|
+
'name' => "praxo.#{event.type}",
|
|
58
|
+
'kind' => 1,
|
|
59
|
+
'startTimeUnixNano' => nanos.to_s,
|
|
60
|
+
'endTimeUnixNano' => nanos.to_s,
|
|
61
|
+
'attributes' => attributes
|
|
62
|
+
}]
|
|
63
|
+
}]
|
|
64
|
+
}]
|
|
65
|
+
}
|
|
66
|
+
body = Json.stringify(payload)
|
|
67
|
+
headers = { 'content-type' => 'application/json' }
|
|
68
|
+
status, response_body = @transport ? @transport.call(@endpoint, body, headers) : post(body, headers)
|
|
69
|
+
return if status.to_i >= 200 && status.to_i < 300
|
|
70
|
+
|
|
71
|
+
bounded = response_body.to_s[0, MAX_BODY]
|
|
72
|
+
Praxo.error('OTEL_HTTP', "otel: HTTP #{status}: #{bounded}")
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
private
|
|
76
|
+
|
|
77
|
+
def otel_stamp(event, now)
|
|
78
|
+
if event.respond_to?(:at) && event.at
|
|
79
|
+
event.at.to_s
|
|
80
|
+
else
|
|
81
|
+
now.iso8601(9)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def attribute(key, value)
|
|
86
|
+
{ 'key' => key, 'value' => { 'stringValue' => value.to_s } }
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def otel_text(value)
|
|
90
|
+
value.is_a?(String) ? value : Json.stringify(value)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def fnv1a(text, seed)
|
|
94
|
+
value = seed & 0xFFFFFFFF
|
|
95
|
+
text.to_s.bytes.each do |byte|
|
|
96
|
+
value ^= byte
|
|
97
|
+
value = (value * 16_777_619) & 0xFFFFFFFF
|
|
98
|
+
end
|
|
99
|
+
value
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def hex32(value)
|
|
103
|
+
format('%08x', value & 0xFFFFFFFF)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def post(body, headers)
|
|
107
|
+
uri = URI.parse(@endpoint)
|
|
108
|
+
request = Net::HTTP::Post.new(uri)
|
|
109
|
+
headers.each { |key, value| request[key] = value }
|
|
110
|
+
request.body = body
|
|
111
|
+
response = Net::HTTP.start(
|
|
112
|
+
uri.host,
|
|
113
|
+
uri.port,
|
|
114
|
+
use_ssl: uri.scheme == 'https',
|
|
115
|
+
read_timeout: @timeout
|
|
116
|
+
) { |http| http.request(request) }
|
|
117
|
+
[response.code.to_i, response.body.to_s]
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
data/lib/praxo/agent.rb
CHANGED
|
@@ -36,7 +36,16 @@ module Praxo
|
|
|
36
36
|
|
|
37
37
|
def specs
|
|
38
38
|
@tools.values.map do |tool|
|
|
39
|
-
|
|
39
|
+
if tool.respond_to?(:spec)
|
|
40
|
+
tool.spec
|
|
41
|
+
else
|
|
42
|
+
Models.tool_spec(
|
|
43
|
+
name: tool.name,
|
|
44
|
+
description: tool.description,
|
|
45
|
+
parameters: tool.respond_to?(:parameters) ? tool.parameters : nil,
|
|
46
|
+
risk: tool.respond_to?(:risk) ? tool.risk : nil
|
|
47
|
+
)
|
|
48
|
+
end
|
|
40
49
|
end.sort_by(&:name)
|
|
41
50
|
end
|
|
42
51
|
end
|
|
@@ -67,7 +76,7 @@ module Praxo
|
|
|
67
76
|
:max_steps, :max_tokens, :tool_choice, :middleware,
|
|
68
77
|
:allowed_tools, :cancellation, :on_stream,
|
|
69
78
|
:max_parallel_tools, :interrupt_on, :on_interrupt_decision,
|
|
70
|
-
:on_interrupt
|
|
79
|
+
:on_interrupt, :require_policy, :require_tool_scope
|
|
71
80
|
|
|
72
81
|
def initialize(model)
|
|
73
82
|
@model = model
|
|
@@ -87,11 +96,21 @@ module Praxo
|
|
|
87
96
|
@interrupt_on = []
|
|
88
97
|
@on_interrupt_decision = nil
|
|
89
98
|
@on_interrupt = nil
|
|
99
|
+
@require_policy = false
|
|
100
|
+
@require_tool_scope = false
|
|
90
101
|
end
|
|
91
102
|
end
|
|
92
103
|
|
|
93
104
|
class Runner
|
|
94
105
|
def initialize(options)
|
|
106
|
+
if options.require_policy && options.policy.nil?
|
|
107
|
+
Praxo.error('AGENT_INVALID_OPTIONS',
|
|
108
|
+
'agent: require policy: policy is required')
|
|
109
|
+
end
|
|
110
|
+
if options.require_tool_scope && options.allowed_tools.empty?
|
|
111
|
+
Praxo.error('AGENT_INVALID_OPTIONS',
|
|
112
|
+
'agent: require tool scope: allowed_tools must not be empty')
|
|
113
|
+
end
|
|
95
114
|
@options = options
|
|
96
115
|
end
|
|
97
116
|
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
require_relative 'errors'
|
|
2
|
+
|
|
3
|
+
module Praxo
|
|
4
|
+
module Delegation
|
|
5
|
+
SubagentRequest = Struct.new(
|
|
6
|
+
:parent_session_id, :agent_id, :prompt, :context, :mode, :history,
|
|
7
|
+
keyword_init: true
|
|
8
|
+
)
|
|
9
|
+
SubagentResult = Struct.new(
|
|
10
|
+
:task_id, :agent_id, :output, :usage, keyword_init: true
|
|
11
|
+
)
|
|
12
|
+
SubagentTask = Struct.new(
|
|
13
|
+
:id, :parent_session_id, :agent_id, :mode, :status, :output, :error,
|
|
14
|
+
:created_at, :updated_at, keyword_init: true
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
class SubagentManager
|
|
18
|
+
TERMINAL = %w[completed failed canceled].freeze
|
|
19
|
+
|
|
20
|
+
def initialize(runner)
|
|
21
|
+
@runner = runner
|
|
22
|
+
@tasks = {}
|
|
23
|
+
@mutex = Mutex.new
|
|
24
|
+
@condition = ConditionVariable.new
|
|
25
|
+
@sequence = 0
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def launch(request)
|
|
29
|
+
raise Praxo::Error.new('SUBAGENT_INVALID', 'agent: subagent runner is required') if @runner.nil?
|
|
30
|
+
|
|
31
|
+
parent = request.parent_session_id.to_s
|
|
32
|
+
agent = request.agent_id.to_s
|
|
33
|
+
if parent.empty? || agent.empty?
|
|
34
|
+
raise Praxo::Error.new(
|
|
35
|
+
'SUBAGENT_INVALID',
|
|
36
|
+
'agent: subagent parent session and agent id are required'
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
id = @mutex.synchronize { @sequence += 1; "subagent-#{@sequence}" }
|
|
40
|
+
now = timestamp
|
|
41
|
+
task = SubagentTask.new(
|
|
42
|
+
id: id, parent_session_id: parent, agent_id: agent,
|
|
43
|
+
mode: request.mode || 'isolated', status: 'queued',
|
|
44
|
+
output: '', error: '', created_at: now, updated_at: now
|
|
45
|
+
)
|
|
46
|
+
@mutex.synchronize { @tasks[id] = { task: task, done: false } }
|
|
47
|
+
Thread.new { execute(id, request) }
|
|
48
|
+
copy(task)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def check(task_id)
|
|
52
|
+
@mutex.synchronize do
|
|
53
|
+
state = @tasks[task_id]
|
|
54
|
+
state.nil? ? nil : copy(state[:task])
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def wait(task_id, timeout = nil)
|
|
59
|
+
deadline = timeout.nil? ? nil : Time.now + timeout
|
|
60
|
+
@mutex.synchronize do
|
|
61
|
+
state = @tasks[task_id]
|
|
62
|
+
raise Praxo::Error.new('SUBAGENT_NOT_FOUND', "agent: unknown subagent task \"#{task_id}\"") if state.nil?
|
|
63
|
+
|
|
64
|
+
until state[:done]
|
|
65
|
+
if deadline.nil?
|
|
66
|
+
@condition.wait(@mutex)
|
|
67
|
+
else
|
|
68
|
+
remaining = deadline - Time.now
|
|
69
|
+
if remaining <= 0
|
|
70
|
+
raise Praxo::Error.new(
|
|
71
|
+
'SUBAGENT_TIMEOUT',
|
|
72
|
+
'agent: subagent wait timed out'
|
|
73
|
+
)
|
|
74
|
+
end
|
|
75
|
+
@condition.wait(@mutex, remaining)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
copy(state[:task])
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def update(task_id, prompt)
|
|
83
|
+
unless @runner.respond_to?(:update)
|
|
84
|
+
raise Praxo::Error.new(
|
|
85
|
+
'SUBAGENT_UPDATE_UNSUPPORTED',
|
|
86
|
+
'agent: subagent update unsupported'
|
|
87
|
+
)
|
|
88
|
+
end
|
|
89
|
+
@mutex.synchronize do
|
|
90
|
+
state = @tasks[task_id]
|
|
91
|
+
raise Praxo::Error.new('SUBAGENT_NOT_FOUND', "agent: unknown subagent task \"#{task_id}\"") if state.nil?
|
|
92
|
+
unless state[:task].status == 'running'
|
|
93
|
+
raise Praxo::Error.new(
|
|
94
|
+
'SUBAGENT_NOT_RUNNING',
|
|
95
|
+
"agent: subagent task \"#{task_id}\" is not running"
|
|
96
|
+
)
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
@runner.update(task_id, prompt)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def cancel(task_id)
|
|
103
|
+
@mutex.synchronize do
|
|
104
|
+
state = @tasks[task_id]
|
|
105
|
+
raise Praxo::Error.new('SUBAGENT_NOT_FOUND', "agent: unknown subagent task \"#{task_id}\"") if state.nil?
|
|
106
|
+
return if TERMINAL.include?(state[:task].status)
|
|
107
|
+
|
|
108
|
+
state[:task].status = 'canceled'
|
|
109
|
+
state[:task].updated_at = timestamp
|
|
110
|
+
state[:done] = true
|
|
111
|
+
@condition.broadcast
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
private
|
|
116
|
+
|
|
117
|
+
def execute(task_id, request)
|
|
118
|
+
set(task_id, 'running')
|
|
119
|
+
result = @runner.run(request)
|
|
120
|
+
set(task_id, 'completed', output: result.output.to_s)
|
|
121
|
+
rescue StandardError => error
|
|
122
|
+
set(task_id, 'failed', error: error.message)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def set(task_id, status, output: '', error: '')
|
|
126
|
+
@mutex.synchronize do
|
|
127
|
+
state = @tasks[task_id]
|
|
128
|
+
return if state.nil? || TERMINAL.include?(state[:task].status)
|
|
129
|
+
|
|
130
|
+
state[:task].status = status
|
|
131
|
+
state[:task].output = output
|
|
132
|
+
state[:task].error = error
|
|
133
|
+
state[:task].updated_at = timestamp
|
|
134
|
+
if TERMINAL.include?(status)
|
|
135
|
+
state[:done] = true
|
|
136
|
+
@condition.broadcast
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def copy(task)
|
|
142
|
+
SubagentTask.new(**task.to_h)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def timestamp
|
|
146
|
+
Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ')
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Praxo
|
|
2
|
+
Document = Struct.new(:id, :content, :metadata, :score, keyword_init: true) do
|
|
3
|
+
def to_wire
|
|
4
|
+
out = { 'id' => id, 'content' => content }
|
|
5
|
+
out['metadata'] = metadata if metadata && !metadata.empty?
|
|
6
|
+
out['score'] = score if score && score != 0
|
|
7
|
+
out
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class FuncRetriever
|
|
12
|
+
def initialize(&block)
|
|
13
|
+
raise ArgumentError, 'retriever: block is required' unless block
|
|
14
|
+
|
|
15
|
+
@block = block
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def retrieve(query, limit)
|
|
19
|
+
@block.call(query.to_s, limit.to_i)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/lib/praxo.rb
CHANGED
|
@@ -14,3 +14,6 @@ require_relative 'praxo/adapters/gemini'
|
|
|
14
14
|
require_relative 'praxo/adapters/mcp'
|
|
15
15
|
require_relative 'praxo/adapters/mcp_http'
|
|
16
16
|
require_relative 'praxo/adapters/harmovela_sink'
|
|
17
|
+
require_relative 'praxo/retriever'
|
|
18
|
+
require_relative 'praxo/delegation'
|
|
19
|
+
require_relative 'praxo/adapters/otel_sink'
|
data/llms.md
CHANGED
|
@@ -7,24 +7,41 @@
|
|
|
7
7
|
## Package
|
|
8
8
|
|
|
9
9
|
- package: `praxo-core`
|
|
10
|
-
- registry: [RubyGems](https://rubygems.org/gems/praxo-core/versions/0.
|
|
11
|
-
- source_version: `0.
|
|
12
|
-
- published_version: `0.
|
|
10
|
+
- registry: [RubyGems](https://rubygems.org/gems/praxo-core/versions/0.7.0)
|
|
11
|
+
- source_version: `0.8.0`
|
|
12
|
+
- published_version: `0.7.0`
|
|
13
13
|
- install_published: `gem install praxo-core`
|
|
14
14
|
- install_source: `gem install praxo-core`
|
|
15
|
-
- source_tag: `ruby/v0.
|
|
15
|
+
- source_tag: `ruby/v0.8.0`
|
|
16
16
|
- tier: Core
|
|
17
17
|
- contract: `SPEC_VERSION` `0.2.0`
|
|
18
18
|
- documentation: https://axisvela.github.io/praxo-core/languages/ruby/
|
|
19
19
|
|
|
20
|
+
## Capabilities and Status
|
|
21
|
+
|
|
22
|
+
- OpenAI-compatible model: native (`Praxo::Adapters::OpenAICompatible`)
|
|
23
|
+
- Anthropic model: native (`Praxo::Adapters::Anthropic`; injectable transport)
|
|
24
|
+
- Gemini model: native (`Praxo::Adapters::Gemini`; injectable transport)
|
|
25
|
+
- MCP client: native (`Praxo::Adapters::MCPClient`; stdio, plus `HttpMCPTransport` for Streamable HTTP 2025-03-26)
|
|
26
|
+
- Harmovela sink: native (`Praxo::Adapters::HarmovelaSink`)
|
|
27
|
+
- OpenTelemetry sink: native (transport seam) (`OtelSink`; caller supplies OTLP/HTTP transport)
|
|
28
|
+
- Subagent delegation: native (`Delegation::SubagentManager`)
|
|
29
|
+
- Retriever: native (`Document`, `FuncRetriever`)
|
|
30
|
+
|
|
20
31
|
## Start
|
|
21
32
|
|
|
22
33
|
- README: `README.md`
|
|
23
34
|
- Registry introduction: `REGISTRY.md`
|
|
24
35
|
- Markdown entry: `llms.md`
|
|
25
36
|
- Compact entry: `llms.txt`
|
|
37
|
+
- [Examples](https://github.com/axisvela/praxo-core/tree/main/language/ruby/examples): runnable language-specific examples.
|
|
26
38
|
- Coding-agent contract: ../../docs/getting-started/coding-agents.md
|
|
27
39
|
|
|
40
|
+
## Community
|
|
41
|
+
|
|
42
|
+
- X: <https://x.com/axisvela>
|
|
43
|
+
- Weibo: <https://weibo.com/u/1936025761>
|
|
44
|
+
|
|
28
45
|
## Boundaries
|
|
29
46
|
|
|
30
47
|
- In-process framework; not a model provider, hosted service, workflow engine,
|
data/llms.txt
CHANGED
|
@@ -7,24 +7,41 @@
|
|
|
7
7
|
# Package
|
|
8
8
|
|
|
9
9
|
- package: `praxo-core`
|
|
10
|
-
- registry: [RubyGems](https://rubygems.org/gems/praxo-core/versions/0.
|
|
11
|
-
- source_version: `0.
|
|
12
|
-
- published_version: `0.
|
|
10
|
+
- registry: [RubyGems](https://rubygems.org/gems/praxo-core/versions/0.7.0)
|
|
11
|
+
- source_version: `0.8.0`
|
|
12
|
+
- published_version: `0.7.0`
|
|
13
13
|
- install_published: `gem install praxo-core`
|
|
14
14
|
- install_source: `gem install praxo-core`
|
|
15
|
-
- source_tag: `ruby/v0.
|
|
15
|
+
- source_tag: `ruby/v0.8.0`
|
|
16
16
|
- tier: Core
|
|
17
17
|
- contract: `SPEC_VERSION` `0.2.0`
|
|
18
18
|
- documentation: https://axisvela.github.io/praxo-core/languages/ruby/
|
|
19
19
|
|
|
20
|
+
# Capabilities and Status
|
|
21
|
+
|
|
22
|
+
- OpenAI-compatible model: native (`Praxo::Adapters::OpenAICompatible`)
|
|
23
|
+
- Anthropic model: native (`Praxo::Adapters::Anthropic`; injectable transport)
|
|
24
|
+
- Gemini model: native (`Praxo::Adapters::Gemini`; injectable transport)
|
|
25
|
+
- MCP client: native (`Praxo::Adapters::MCPClient`; stdio, plus `HttpMCPTransport` for Streamable HTTP 2025-03-26)
|
|
26
|
+
- Harmovela sink: native (`Praxo::Adapters::HarmovelaSink`)
|
|
27
|
+
- OpenTelemetry sink: native (transport seam) (`OtelSink`; caller supplies OTLP/HTTP transport)
|
|
28
|
+
- Subagent delegation: native (`Delegation::SubagentManager`)
|
|
29
|
+
- Retriever: native (`Document`, `FuncRetriever`)
|
|
30
|
+
|
|
20
31
|
# Start
|
|
21
32
|
|
|
22
33
|
- README: `README.md`
|
|
23
34
|
- Registry introduction: `REGISTRY.md`
|
|
24
35
|
- Markdown entry: `llms.md`
|
|
25
36
|
- Compact entry: `llms.txt`
|
|
37
|
+
- [Examples](https://github.com/axisvela/praxo-core/tree/main/language/ruby/examples): runnable language-specific examples.
|
|
26
38
|
- Coding-agent contract: ../../docs/getting-started/coding-agents.md
|
|
27
39
|
|
|
40
|
+
# Community
|
|
41
|
+
|
|
42
|
+
- X: <https://x.com/axisvela>
|
|
43
|
+
- Weibo: <https://weibo.com/u/1936025761>
|
|
44
|
+
|
|
28
45
|
# Boundaries
|
|
29
46
|
|
|
30
47
|
- In-process framework; not a model provider, hosted service, workflow engine,
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: praxo-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- AxisVela
|
|
@@ -27,6 +27,8 @@ files:
|
|
|
27
27
|
- api/0.4.1.txt
|
|
28
28
|
- api/0.5.0.txt
|
|
29
29
|
- api/0.6.0.txt
|
|
30
|
+
- api/0.7.0.txt
|
|
31
|
+
- api/0.8.0.txt
|
|
30
32
|
- lib/praxo.rb
|
|
31
33
|
- lib/praxo/adapters/anthropic.rb
|
|
32
34
|
- lib/praxo/adapters/gemini.rb
|
|
@@ -34,13 +36,16 @@ files:
|
|
|
34
36
|
- lib/praxo/adapters/mcp.rb
|
|
35
37
|
- lib/praxo/adapters/mcp_http.rb
|
|
36
38
|
- lib/praxo/adapters/openai_compatible.rb
|
|
39
|
+
- lib/praxo/adapters/otel_sink.rb
|
|
37
40
|
- lib/praxo/agent.rb
|
|
41
|
+
- lib/praxo/delegation.rb
|
|
38
42
|
- lib/praxo/errors.rb
|
|
39
43
|
- lib/praxo/json.rb
|
|
40
44
|
- lib/praxo/jsonschema.rb
|
|
41
45
|
- lib/praxo/middleware.rb
|
|
42
46
|
- lib/praxo/models.rb
|
|
43
47
|
- lib/praxo/plugin.rb
|
|
48
|
+
- lib/praxo/retriever.rb
|
|
44
49
|
- lib/praxo/runtime.rb
|
|
45
50
|
- lib/praxo/sse.rb
|
|
46
51
|
- lib/praxo/toolcall.rb
|