scout-ai 2.1.0 → 2.2.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/.vimproject +133 -58
- data/README.md +2 -1
- data/VERSION +1 -1
- data/doc/Improvements.md +490 -148
- data/doc/Model.md +53 -10
- data/doc/StartHere.md +44 -19
- data/doc/developer/Architecture.md +25 -6
- data/doc/developer/Backends.md +207 -48
- data/doc/developer/ChatLifecycle.md +121 -20
- data/doc/developer/DelegationInternals.md +319 -33
- data/doc/developer/DesignPrinciples.md +205 -16
- data/doc/developer/PathEngine.md +628 -0
- data/doc/developer/PromptProcessing.md +332 -82
- data/doc/developer/Provenance.md +388 -40
- data/doc/developer/Sandbox.md +213 -0
- data/doc/user/BuildingAgents.md +130 -18
- data/doc/user/Cookbook.md +29 -8
- data/doc/user/CoreConcepts.md +7 -6
- data/doc/user/Delegation.md +166 -15
- data/doc/user/GettingStarted.md +20 -16
- data/doc/user/ManagingContext.md +155 -17
- data/doc/user/MultiAgentWorkflows.md +105 -15
- data/doc/user/Python.md +11 -1
- data/doc/user/RunningInference.md +90 -47
- data/doc/user/ToolCalling.md +134 -29
- data/doc/user/WritingChats.md +56 -27
- data/lib/scout/llm/agent/attach.rb +13 -17
- data/lib/scout/llm/agent/chat.rb +32 -0
- data/lib/scout/llm/agent/construction.rb +64 -0
- data/lib/scout/llm/agent/conversation.rb +304 -0
- data/lib/scout/llm/agent/delegate.rb +56 -238
- data/lib/scout/llm/agent/path/edit.rb +230 -0
- data/lib/scout/llm/agent/path/patch.rb +252 -0
- data/lib/scout/llm/agent/path/workflow_kinds.rb +175 -0
- data/lib/scout/llm/agent/path.rb +1777 -0
- data/lib/scout/llm/agent/save.rb +11 -9
- data/lib/scout/llm/agent/workflow.rb +77 -16
- data/lib/scout/llm/agent.rb +147 -31
- data/lib/scout/llm/ask.rb +28 -17
- data/lib/scout/llm/backends/anthropic.rb +1 -1
- data/lib/scout/llm/backends/bedrock.rb +3 -2
- data/lib/scout/llm/backends/default.rb +127 -34
- data/lib/scout/llm/backends/glm.rb +28 -1
- data/lib/scout/llm/backends/huggingface.rb +1 -1
- data/lib/scout/llm/backends/ollama.rb +1 -1
- data/lib/scout/llm/backends/openai.rb +7 -6
- data/lib/scout/llm/backends/openwebui.rb +14 -7
- data/lib/scout/llm/backends/relay.rb +8 -2
- data/lib/scout/llm/chat/agent_meta.rb +24 -60
- data/lib/scout/llm/chat/parse.rb +1 -1
- data/lib/scout/llm/chat/process/files.rb +10 -0
- data/lib/scout/llm/chat/process/meta.rb +5 -7
- data/lib/scout/llm/chat/process/tools.rb +104 -49
- data/lib/scout/llm/chat/prompt/epoch_tool_compactation.rb +355 -0
- data/lib/scout/llm/chat/prompt/inbox.rb +188 -0
- data/lib/scout/llm/chat/prompt/shorten_tools.rb +797 -13
- data/lib/scout/llm/chat/prompt/shorten_tools_epoch.rb +1 -365
- data/lib/scout/llm/chat/prompt/shorten_tools_epoch_increment.rb +1 -0
- data/lib/scout/llm/chat/prompt.rb +24 -10
- data/lib/scout/llm/chat/provenance/live.rb +1080 -0
- data/lib/scout/llm/chat/provenance/tokens.rb +386 -0
- data/lib/scout/llm/chat/provenance.rb +343 -676
- data/lib/scout/llm/chat.rb +8 -2
- data/lib/scout/llm/embed.rb +15 -3
- data/lib/scout/llm/image.rb +4 -1
- data/lib/scout/llm/mcp.rb +4 -2
- data/lib/scout/llm/request_context.rb +234 -0
- data/lib/scout/llm/sandbox.rb +263 -0
- data/lib/scout/llm/tools/call.rb +163 -42
- data/lib/scout/llm/tools/definition.rb +48 -0
- data/lib/scout/llm/tools/knowledge_base.rb +1 -0
- data/lib/scout/llm/tools/mcp.rb +50 -43
- data/lib/scout/llm/tools/workflow.rb +90 -20
- data/lib/scout/llm/tools.rb +14 -41
- data/lib/scout/model/decision/base.rb +43 -0
- data/lib/scout/model/decision/jev.rb +161 -0
- data/lib/scout/model/python/torch.rb +1 -1
- data/research/clear-tools-inherit.md +171 -0
- data/research/path-engine-dc1-dc2-dc3-fixes.md +279 -0
- data/research/path-kind-chat-role.md +96 -0
- data/research/path-kind-contract-fixes-engine.md +307 -0
- data/research/scout-ai-runtime-availability.md +65 -0
- data/research/subsys/README.md +127 -0
- data/research/subsys/agent-delegation.md +201 -0
- data/research/subsys/agent-society.md +275 -0
- data/research/subsys/agentworkflow.md +233 -0
- data/research/subsys/backends.md +221 -0
- data/research/subsys/chat.md +314 -0
- data/research/subsys/embed-image.md +244 -0
- data/research/subsys/entry-cli.md +253 -0
- data/research/subsys/model-ml.md +326 -0
- data/research/subsys/provenance.md +290 -0
- data/research/subsys/tools.md +334 -0
- data/scout-ai.gemspec +71 -27
- data/scout_commands/agent/ask +8 -7
- data/scout_commands/llm/abridged +40 -0
- data/scout_commands/llm/ask +9 -9
- data/scout_commands/llm/md +2 -0
- data/scout_commands/llm/prov +724 -59
- data/scout_commands/llm/word +4 -0
- data/share/word/reference.docx +0 -0
- data/test/integration/scout/model/decision/test_jev.rb +144 -0
- data/test/scout/llm/agent/test_attach.rb +117 -0
- data/test/scout/llm/agent/test_conversation.rb +407 -0
- data/test/scout/llm/agent/test_delegate.rb +209 -0
- data/test/scout/llm/agent/test_path.rb +1812 -0
- data/test/scout/llm/agent/test_path_edit.rb +908 -0
- data/test/scout/llm/agent/test_path_errors.rb +390 -0
- data/test/scout/llm/agent/test_path_filesystem.rb +532 -0
- data/test/scout/llm/agent/test_path_patch.rb +233 -0
- data/test/scout/llm/agent/test_path_promotion.rb +386 -0
- data/test/scout/llm/agent/test_path_workflow_integration.rb +665 -0
- data/test/scout/llm/agent/test_save.rb +70 -15
- data/test/scout/llm/agent/test_workflow.rb +130 -4
- data/test/scout/llm/backends/test_anthropic.rb +4 -4
- data/test/scout/llm/backends/test_bedrock.rb +4 -4
- data/test/scout/llm/backends/test_format_other.rb +43 -0
- data/test/scout/llm/backends/test_ollama.rb +2 -2
- data/test/scout/llm/backends/test_openwebui.rb +12 -8
- data/test/scout/llm/backends/test_reasoning.rb +114 -0
- data/test/scout/llm/chat/agent_meta_fixtures.rb +28 -27
- data/test/scout/llm/chat/prompt/test_epoch_tool_compactation.rb +612 -0
- data/test/scout/llm/chat/prov_plot_fixtures.rb +131 -0
- data/test/scout/llm/chat/test_agent_meta.rb +40 -80
- data/test/scout/llm/chat/test_agent_meta_provenance.rb +67 -28
- data/test/scout/llm/chat/test_agent_meta_tokens.rb +59 -8
- data/test/scout/llm/chat/test_agent_view.rb +178 -0
- data/test/scout/llm/chat/test_live_report.rb +282 -0
- data/test/scout/llm/chat/test_live_workload.rb +193 -0
- data/test/scout/llm/chat/test_parse.rb +32 -2
- data/test/scout/llm/chat/test_prompt.rb +411 -0
- data/test/scout/llm/chat/test_prov_cli.rb +310 -15
- data/test/scout/llm/chat/test_prov_cli_live.rb +152 -0
- data/test/scout/llm/chat/test_prov_plot.rb +213 -0
- data/test/scout/llm/chat/test_prov_timeline.rb +355 -0
- data/test/scout/llm/chat/test_provenance.rb +67 -22
- data/test/scout/llm/chat/test_provenance_index.rb +479 -0
- data/test/scout/llm/chat/test_society_view.rb +159 -0
- data/test/scout/llm/test_agent.rb +1 -1
- data/test/scout/llm/test_embed.rb +103 -1
- data/test/scout/llm/test_request_context.rb +299 -0
- data/test/scout/llm/test_sandbox.rb +249 -0
- data/test/scout/llm/tools/test_agent_pairing.rb +150 -0
- data/test/scout/llm/tools/test_call_delegation_conflict.rb +316 -0
- data/test/scout/llm/tools/test_definition.rb +332 -0
- data/test/scout/llm/tools/test_jobs_file.rb +211 -0
- data/test/scout/llm/tools/test_mcp.rb +37 -8
- data/test/scout/llm/tools/test_workflow.rb +45 -1
- data/test/scout/model/decision/test_jev.rb +453 -0
- data/test/scout/model/python/huggingface/causal/test_next_token.rb +7 -10
- data/test/scout/model/python/huggingface/test_causal.rb +11 -2
- data/test/scout/model/python/huggingface/test_classification.rb +5 -3
- data/test/scout/model/python/test_availability.rb +116 -0
- data/test/scout/model/python/test_torch.rb +54 -2
- data/test/support/availability.rb +72 -174
- data/test/support/fake_clients.rb +18 -9
- data/test/support/fixtures.rb +75 -6
- data/test/support/mock_backend.rb +9 -1
- data/test/support/test_fixtures.rb +156 -0
- data/test/test_helper.rb +14 -4
- metadata +70 -26
- data/research/ChatAnalyst-required-changes.md +0 -167
- data/research/agent-delegation-analysis.md +0 -810
- data/research/agent-meta-provenance-integration-plan.md +0 -622
- data/research/agent-workflow-analysis.md +0 -1120
- data/research/backends-analysis.md +0 -836
- data/research/chat-core-analysis.md +0 -946
- data/research/chatanalyst-provenance/00-baseline.md +0 -30
- data/research/chatanalyst-provenance/01-repo-map.md +0 -60
- data/research/chatanalyst-provenance/02-event-reconstruction.md +0 -55
- data/research/chatanalyst-provenance/03-duplication-evidence.md +0 -45
- data/research/chatanalyst-provenance/04-tooling-root-cause.md +0 -57
- data/research/chatanalyst-provenance/05-fix-plan.md +0 -46
- data/research/chatanalyst-provenance/07-critic-review.md +0 -25
- data/research/chatanalyst-provenance/final-report.md +0 -45
- data/research/chatanalyst-provenance/resumption.md +0 -37
- data/research/coding-philosophy-analysis.md +0 -928
- data/research/commands-analysis.md +0 -947
- data/research/multi-agent-patterns-analysis.md +0 -853
- data/research/prompt-strategies-analysis.md +0 -630
- data/research/prov-verbosity-fix-notes.md +0 -77
- data/research/provenance-analysis.md +0 -469
- data/research/provenance-continuation-accounting.md +0 -255
- data/research/synthesis-report.md +0 -487
- data/research/tools-system-analysis.md +0 -779
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
#
|
|
5
5
|
# Helpers provided:
|
|
6
6
|
# write_chat(dir, name, text) -> chat file path
|
|
7
|
-
# meta_receipt(
|
|
8
|
-
# receipt_output(call_id,
|
|
7
|
+
# meta_receipt(fields) -> meta entry Hash
|
|
8
|
+
# receipt_output(call_id, meta, ...) -> JSON envelope String
|
|
9
9
|
# receipt_chat_text(receipts, extra: nil) -> persisted chat text
|
|
10
10
|
# plain_delegation_chat(job_path) -> persisted chat text
|
|
11
11
|
# make_job(dir, ref, dependencies:, logs:) -> job path
|
|
12
12
|
# visit_signature(visits) -> comparable Array
|
|
13
13
|
# fixture_c(dir) -> C/D layout paths
|
|
14
|
-
# truncated_receipt_chat(call_id,
|
|
14
|
+
# truncated_receipt_chat(call_id, meta) -> fixture H text
|
|
15
15
|
require 'fileutils'
|
|
16
16
|
require 'json'
|
|
17
17
|
|
|
@@ -24,26 +24,25 @@ module AgentMetaFixtures
|
|
|
24
24
|
path
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
# One
|
|
27
|
+
# One meta receipt entry, already-deserialized field Hash form, e.g.
|
|
28
28
|
# meta_receipt('pt=10 ct=4 tt=14 inference_id=w1') or
|
|
29
29
|
# meta_receipt('job=Worker/ask/Default_w').
|
|
30
30
|
def meta_receipt(content)
|
|
31
|
-
|
|
31
|
+
Chat.parse_meta(content)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
# JSON payload of a function_call_output envelope carrying
|
|
35
|
-
# `envelope:`
|
|
36
|
-
#
|
|
37
|
-
# the dual-envelope reader landed (lib/scout/llm/tools/call.rb).
|
|
34
|
+
# JSON payload of a function_call_output envelope carrying a receipt
|
|
35
|
+
# under the `meta` key. `envelope:` remains so tests can force the legacy
|
|
36
|
+
# `agent_meta` key for the deliberate-breakage tests.
|
|
38
37
|
# `name` only decorates the envelope; the receipt lifting ignores it.
|
|
39
|
-
def receipt_output(call_id,
|
|
38
|
+
def receipt_output(call_id, meta, name: 'ask', content: 'child answer', envelope: :meta)
|
|
40
39
|
payload = {name: name, content: content, id: call_id}
|
|
41
|
-
payload[envelope] =
|
|
40
|
+
payload[envelope] = meta
|
|
42
41
|
payload.to_json
|
|
43
42
|
end
|
|
44
43
|
|
|
45
44
|
# Persisted chat text with one paired ask call per receipt entry. Hash keys
|
|
46
|
-
# are call ids, values are the
|
|
45
|
+
# are call ids, values are the meta payloads (Arrays, Strings, ...).
|
|
47
46
|
# `extra` lines are appended after the receipts (e.g. local meta lines).
|
|
48
47
|
#
|
|
49
48
|
# Message indexes produced by Chat.parse (single user turn, no leading
|
|
@@ -51,11 +50,11 @@ module AgentMetaFixtures
|
|
|
51
50
|
# 0 user, then per receipt: function_call, function_call_output.
|
|
52
51
|
# `tool` sets the function_call name; receipts are lifted from the output
|
|
53
52
|
# envelope regardless of it, so tests can pin that no tool name is special.
|
|
54
|
-
def receipt_chat_text(receipts, extra: nil, envelope: :
|
|
53
|
+
def receipt_chat_text(receipts, extra: nil, envelope: :meta, tool: 'ask')
|
|
55
54
|
lines = ['user: Run the worker']
|
|
56
|
-
receipts.each do |call_id,
|
|
55
|
+
receipts.each do |call_id, meta|
|
|
57
56
|
lines << 'function_call: ' + %({"name":"#{tool}","arguments":{},"id":"#{call_id}"})
|
|
58
|
-
lines << 'function_call_output: ' + receipt_output(call_id,
|
|
57
|
+
lines << 'function_call_output: ' + receipt_output(call_id, meta, envelope: envelope)
|
|
59
58
|
end
|
|
60
59
|
lines.concat(Array(extra)) if extra
|
|
61
60
|
lines << 'assistant: done'
|
|
@@ -70,16 +69,18 @@ module AgentMetaFixtures
|
|
|
70
69
|
|
|
71
70
|
# Create a job layout under `dir` for the relative reference `ref`
|
|
72
71
|
# (e.g. 'Worker/ask/Default_w'): the result file, a .info sidecar with
|
|
73
|
-
# `dependencies` (always written, matching scout-gear Step), and
|
|
74
|
-
# written under `<job>.files
|
|
75
|
-
#
|
|
76
|
-
|
|
72
|
+
# `dependencies` (always written, matching scout-gear Step), and agent chat
|
|
73
|
+
# logs written under `<job>.files/<name>` (Hash name -> chat text; the
|
|
74
|
+
# canonical agent-log layout, no `log/` component). `info` entries are
|
|
75
|
+
# merged over the sidecar JSON so tests can set workflow/task_name/
|
|
76
|
+
# clean_name exactly like a real run would. Returns the job path.
|
|
77
|
+
def make_job(dir, ref, result: 'answer', dependencies: [], logs: {}, info: {})
|
|
77
78
|
path = File.expand_path(File.join(dir, ref))
|
|
78
79
|
FileUtils.mkdir_p(File.dirname(path))
|
|
79
80
|
File.write(path, result)
|
|
80
|
-
File.write(path + '.info', {dependencies: dependencies}.to_json)
|
|
81
|
+
File.write(path + '.info', {dependencies: dependencies}.merge(info).to_json)
|
|
81
82
|
logs.each do |name, text|
|
|
82
|
-
log_path = File.join(path + '.files',
|
|
83
|
+
log_path = File.join(path + '.files', name)
|
|
83
84
|
FileUtils.mkdir_p(File.dirname(log_path))
|
|
84
85
|
File.write(log_path, text)
|
|
85
86
|
end
|
|
@@ -125,12 +126,12 @@ module AgentMetaFixtures
|
|
|
125
126
|
|
|
126
127
|
# Fixture H: the output content is the standard truncation exception JSON
|
|
127
128
|
# (error: :truncated) exactly as LLM.process_calls serializes it, while the
|
|
128
|
-
#
|
|
129
|
-
def truncated_receipt_chat(call_id,
|
|
129
|
+
# receipts survive in the same envelope.
|
|
130
|
+
def truncated_receipt_chat(call_id, meta, name: 'ask', characters: 90_000)
|
|
130
131
|
exception_msg = "Function #{name} #{call_id} was executed successfully, but it returned #{characters} characters, which is more than the maximum of 30000. To protect the model context window this result was not returned."
|
|
131
132
|
content = {exception: exception_msg, stack: ['a', 'b']}.to_json
|
|
132
133
|
payload = {name: name, content: content, id: call_id, error: :truncated,
|
|
133
|
-
|
|
134
|
+
meta: meta}.to_json
|
|
134
135
|
"user: Run\n" +
|
|
135
136
|
%({"name":"#{name}","arguments":{},"id":"#{call_id}"}).sub(/^/, 'function_call: ') + "\n" +
|
|
136
137
|
"function_call_output: #{payload}\n" +
|
|
@@ -171,7 +172,7 @@ module AgentMetaFixtures
|
|
|
171
172
|
File.write(a, (['user: start'] + a_metas + ["meta: job=#{a}"]) * "
|
|
172
173
|
" + "
|
|
173
174
|
")
|
|
174
|
-
File.write(File.join(a + '.files', '
|
|
175
|
+
File.write(File.join(a + '.files', 'agent.chat'), a_metas * "
|
|
175
176
|
" + "
|
|
176
177
|
")
|
|
177
178
|
|
|
@@ -180,7 +181,7 @@ module AgentMetaFixtures
|
|
|
180
181
|
File.write(b, (['user: continue B'] + b_metas + ["meta: job=#{b}"]) * "
|
|
181
182
|
" + "
|
|
182
183
|
")
|
|
183
|
-
File.write(File.join(b + '.files', '
|
|
184
|
+
File.write(File.join(b + '.files', 'agent.chat'),
|
|
184
185
|
(["meta: job=#{a}"] + a_metas + b_metas) * "
|
|
185
186
|
" + "
|
|
186
187
|
")
|
|
@@ -190,7 +191,7 @@ module AgentMetaFixtures
|
|
|
190
191
|
File.write(c, (['user: continue C'] + [c_meta, "meta: job=#{c}"]) * "
|
|
191
192
|
" + "
|
|
192
193
|
")
|
|
193
|
-
File.write(File.join(c + '.files', '
|
|
194
|
+
File.write(File.join(c + '.files', 'agent.chat'),
|
|
194
195
|
(["meta: job=#{b}"] + a_metas + b_metas + [c_meta]) * "
|
|
195
196
|
" + "
|
|
196
197
|
")
|