legionio 1.6.46 → 1.6.47
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/CHANGELOG.md +8 -0
- data/lib/legion/cli/chat/daemon_chat.rb +27 -5
- data/lib/legion/cli/chat/session.rb +1 -1
- data/lib/legion/cli/chat_command.rb +35 -0
- data/lib/legion/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6fdb142083ba9c7189a2c1d067d010b1ab0f39f22caa6c138d14fc1ebacd1589
|
|
4
|
+
data.tar.gz: 3f462e8d42971068e296464fd1911cd326fcce814cf37c41b4f0cd21c278247e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a0d8a882c72675d9b6b4aa9d31f5e7f51c2e7feea21f8bc71080b4f4ebabe95c20e3f51ef1c6bf77c9e87df41ba6dc46809d2081d1b70a7a468728aefa71943
|
|
7
|
+
data.tar.gz: be6c28ddffac2b02d22dd98b6133481bd724b26586853d58b8df0035cf1716e27dfedcdbfb53ffd1a9016fe7deff3bceb3755ac013b332f93552a606ca210d2c
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [1.6.47] - 2026-03-31
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- CLI chat identity wiring: `DaemonChat` generates stable `conversation_id` and resolves user identity into `caller_context` (Kerberos principal -> ENV['USER'] fallback)
|
|
9
|
+
- `DaemonChat` forwards `caller` and `conversation_id` to daemon inference endpoint
|
|
10
|
+
- GAIA observation hook in `chat_command.rb`: `setup_gaia_observation` registers an `:llm_complete` callback that ingests user messages into GAIA's observation pipeline
|
|
11
|
+
- `:llm_complete` session event now includes `user_message` in payload
|
|
12
|
+
|
|
5
13
|
## [1.6.46] - 2026-03-31
|
|
6
14
|
|
|
7
15
|
### Fixed
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'securerandom'
|
|
3
4
|
require 'legion/cli/chat_command'
|
|
4
5
|
|
|
5
6
|
begin
|
|
@@ -31,7 +32,7 @@ module Legion
|
|
|
31
32
|
end
|
|
32
33
|
end
|
|
33
34
|
|
|
34
|
-
attr_reader :model
|
|
35
|
+
attr_reader :model, :conversation_id, :caller_context
|
|
35
36
|
|
|
36
37
|
def initialize(model: nil, provider: nil)
|
|
37
38
|
@model = ModelInfo.new(id: model)
|
|
@@ -41,6 +42,8 @@ module Legion
|
|
|
41
42
|
@instructions = nil
|
|
42
43
|
@on_tool_call = nil
|
|
43
44
|
@on_tool_result = nil
|
|
45
|
+
@conversation_id = SecureRandom.uuid
|
|
46
|
+
@caller_context = build_caller
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
# Sets the system prompt. Returns self for chaining.
|
|
@@ -112,10 +115,12 @@ module Legion
|
|
|
112
115
|
|
|
113
116
|
def call_daemon_inference
|
|
114
117
|
Legion::LLM::DaemonClient.inference(
|
|
115
|
-
messages:
|
|
116
|
-
tools:
|
|
117
|
-
model:
|
|
118
|
-
provider:
|
|
118
|
+
messages: build_messages,
|
|
119
|
+
tools: build_tool_schemas,
|
|
120
|
+
model: @model.id,
|
|
121
|
+
provider: @provider,
|
|
122
|
+
caller: @caller_context,
|
|
123
|
+
conversation_id: @conversation_id
|
|
119
124
|
)
|
|
120
125
|
end
|
|
121
126
|
|
|
@@ -206,6 +211,23 @@ module Legion
|
|
|
206
211
|
"Tool error (#{name}): #{e.message}"
|
|
207
212
|
end
|
|
208
213
|
|
|
214
|
+
def build_caller
|
|
215
|
+
identity = resolve_identity
|
|
216
|
+
{ requested_by: { identity: identity, type: :human, credential: :local } }
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
def resolve_identity
|
|
220
|
+
if defined?(Legion::Crypt) && Legion::Crypt.respond_to?(:kerberos_principal)
|
|
221
|
+
principal = Legion::Crypt.kerberos_principal
|
|
222
|
+
return principal if principal
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
require 'etc'
|
|
226
|
+
Etc.getlogin || ENV.fetch('USER', 'unknown')
|
|
227
|
+
rescue StandardError
|
|
228
|
+
ENV.fetch('USER', 'unknown')
|
|
229
|
+
end
|
|
230
|
+
|
|
209
231
|
def build_response(data)
|
|
210
232
|
Response.new(
|
|
211
233
|
content: data[:content],
|
|
@@ -55,6 +55,7 @@ module Legion
|
|
|
55
55
|
load_custom_agents
|
|
56
56
|
|
|
57
57
|
setup_notification_bridge
|
|
58
|
+
setup_gaia_observation
|
|
58
59
|
setup_worktree(out) if options[:worktree]
|
|
59
60
|
|
|
60
61
|
chat_log.info "session started model=#{@session.model_id} incognito=#{incognito?}"
|
|
@@ -195,6 +196,40 @@ module Legion
|
|
|
195
196
|
@notification_bridge = nil
|
|
196
197
|
end
|
|
197
198
|
|
|
199
|
+
def setup_gaia_observation
|
|
200
|
+
return unless defined?(Legion::Gaia) && Legion::Gaia.respond_to?(:started?)
|
|
201
|
+
return unless Legion::Gaia.started?
|
|
202
|
+
return unless defined?(Legion::Gaia::InputFrame)
|
|
203
|
+
|
|
204
|
+
identity = chat_obj_identity
|
|
205
|
+
@session.on(:llm_complete) do |payload|
|
|
206
|
+
next unless Legion::Gaia.started?
|
|
207
|
+
|
|
208
|
+
content = payload[:user_message] || payload[:message] || ''
|
|
209
|
+
frame = Legion::Gaia::InputFrame.new(
|
|
210
|
+
content: content,
|
|
211
|
+
channel_id: :cli_chat,
|
|
212
|
+
auth_context: { identity: identity },
|
|
213
|
+
metadata: { source_type: :human_direct,
|
|
214
|
+
direct_address: content.to_s.match?(/\bgaia\b/i) }
|
|
215
|
+
)
|
|
216
|
+
Legion::Gaia.ingest(frame)
|
|
217
|
+
rescue StandardError => e
|
|
218
|
+
Legion::Logging.debug("GAIA observation error: #{e.message}") if defined?(Legion::Logging)
|
|
219
|
+
end
|
|
220
|
+
rescue StandardError => e
|
|
221
|
+
Legion::Logging.debug("setup_gaia_observation failed: #{e.message}") if defined?(Legion::Logging)
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
def chat_obj_identity
|
|
225
|
+
return @session.chat.caller_context.dig(:requested_by, :identity) if @session.chat.respond_to?(:caller_context)
|
|
226
|
+
|
|
227
|
+
require 'etc'
|
|
228
|
+
Etc.getlogin || ENV.fetch('USER', 'unknown')
|
|
229
|
+
rescue StandardError
|
|
230
|
+
ENV.fetch('USER', 'unknown')
|
|
231
|
+
end
|
|
232
|
+
|
|
198
233
|
def display_pending_notifications
|
|
199
234
|
return unless @notification_bridge&.has_urgent? || @notification_bridge
|
|
200
235
|
|
data/lib/legion/version.rb
CHANGED