Class: PromptObjects::Universal::ListEnvData
- Inherits:
-
Primitive
show all
- Defined in:
- lib/prompt_objects/universal/list_env_data.rb
Overview
Universal capability to list all shared environment data keys and descriptions.
Returns a lightweight manifest without loading full values.
Instance Attribute Summary
Attributes inherited from Capability
#state
Instance Method Summary
collapse
Methods inherited from Primitive
#initialize
Methods inherited from Capability
#descriptor, execution_policy, execution_policy_definition, #execution_policy_definition, #execution_policy_signature, #initialize, #resolved_execution_policy
Instance Method Details
#description ⇒ Object
14
15
16
17
18
|
# File 'lib/prompt_objects/universal/list_env_data.rb', line 14
def description
"List all keys and descriptions in the shared environment data for this delegation chain. " \
"Returns keys and short descriptions only (no values). " \
"Use get_env_data to retrieve a specific key's full value."
end
|
#name ⇒ Object
10
11
12
|
# File 'lib/prompt_objects/universal/list_env_data.rb', line 10
def name
"list_env_data"
end
|
#parameters ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/prompt_objects/universal/list_env_data.rb', line 20
def parameters
{
type: "object",
properties: {},
required: []
}
end
|
#receive(message, context:) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/prompt_objects/universal/list_env_data.rb', line 28
def receive(message, context:)
root_thread_id = context.env_data_scope
return "Error: Could not resolve thread scope (no active session)" unless root_thread_id
store = context.env.session_store
return "Error: Session store not available" unless store
entries = if context.env.respond_to?(:list_environment_data)
context.env.list_environment_data(context: context).map do |entry|
{ key: entry[:key], short_description: entry[:short_description] }
end
else
store.list_env_data(root_thread_id: root_thread_id)
end
if entries.empty?
return "No environment data stored for this delegation chain."
end
context.bus.publish(
from: context.calling_po || "unknown",
to: "env_data",
message: { action: "list", count: entries.size }
)
JSON.generate(entries)
end
|