prompt_objects 0.2.0 → 0.3.1

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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +80 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +2 -2
  5. data/exe/prompt_objects +548 -1
  6. data/frontend/src/App.tsx +11 -3
  7. data/frontend/src/components/ContextMenu.tsx +67 -0
  8. data/frontend/src/components/MessageBus.tsx +4 -3
  9. data/frontend/src/components/ModelSelector.tsx +5 -1
  10. data/frontend/src/components/ThreadsSidebar.tsx +46 -2
  11. data/frontend/src/components/UsagePanel.tsx +105 -0
  12. data/frontend/src/hooks/useWebSocket.ts +53 -0
  13. data/frontend/src/store/index.ts +10 -0
  14. data/frontend/src/types/index.ts +4 -1
  15. data/lib/prompt_objects/cli.rb +1 -0
  16. data/lib/prompt_objects/connectors/mcp.rb +1 -0
  17. data/lib/prompt_objects/environment.rb +24 -1
  18. data/lib/prompt_objects/llm/anthropic_adapter.rb +15 -1
  19. data/lib/prompt_objects/llm/factory.rb +93 -6
  20. data/lib/prompt_objects/llm/gemini_adapter.rb +13 -1
  21. data/lib/prompt_objects/llm/openai_adapter.rb +21 -4
  22. data/lib/prompt_objects/llm/pricing.rb +49 -0
  23. data/lib/prompt_objects/llm/response.rb +3 -2
  24. data/lib/prompt_objects/mcp/server.rb +1 -0
  25. data/lib/prompt_objects/message_bus.rb +27 -8
  26. data/lib/prompt_objects/prompt_object.rb +6 -4
  27. data/lib/prompt_objects/server/api/routes.rb +186 -29
  28. data/lib/prompt_objects/server/public/assets/index-Bkme6COu.css +1 -0
  29. data/lib/prompt_objects/server/public/assets/index-CQ7lVDF_.js +77 -0
  30. data/lib/prompt_objects/server/public/index.html +2 -2
  31. data/lib/prompt_objects/server/websocket_handler.rb +93 -9
  32. data/lib/prompt_objects/server.rb +54 -0
  33. data/lib/prompt_objects/session/store.rb +399 -4
  34. data/lib/prompt_objects.rb +1 -0
  35. data/prompt_objects.gemspec +1 -1
  36. data/templates/arc-agi-1/manifest.yml +22 -0
  37. data/templates/arc-agi-1/objects/data_manager.md +42 -0
  38. data/templates/arc-agi-1/objects/observer.md +100 -0
  39. data/templates/arc-agi-1/objects/solver.md +118 -0
  40. data/templates/arc-agi-1/objects/verifier.md +79 -0
  41. data/templates/arc-agi-1/primitives/check_arc_data.rb +53 -0
  42. data/templates/arc-agi-1/primitives/find_objects.rb +72 -0
  43. data/templates/arc-agi-1/primitives/grid_diff.rb +70 -0
  44. data/templates/arc-agi-1/primitives/grid_info.rb +42 -0
  45. data/templates/arc-agi-1/primitives/grid_transform.rb +50 -0
  46. data/templates/arc-agi-1/primitives/load_arc_task.rb +68 -0
  47. data/templates/arc-agi-1/primitives/render_grid.rb +78 -0
  48. data/templates/arc-agi-1/primitives/test_solution.rb +131 -0
  49. data/tools/thread-explorer.html +1043 -0
  50. metadata +21 -3
  51. data/lib/prompt_objects/server/public/assets/index-CeNJvqLG.js +0 -77
  52. data/lib/prompt_objects/server/public/assets/index-Vx4-uMOU.css +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fe57111f23be7238465e5a386d48d8d694cd4599e2113e6378150951efcd303
4
- data.tar.gz: '07192c4f47af2d7aa9530fdc61b65cb97fba77ae84133a30533d3f07314e0b79'
3
+ metadata.gz: 0a1ec32b66d34c2fe11c964759513487335794f9a8c336bd32f7ae9aeed5380c
4
+ data.tar.gz: 9a6650251228ab4dae25f16120e8ae8c1992e4458faf0c858894b6e4848ae80b
5
5
  SHA512:
6
- metadata.gz: 66d2e26018f49685968bccfd075b2e7cf74fb4bd0cbdf0730f4f3c68c3101be232235beb86a8a1cde73bdf2707c1a679b916d53c8b4c1fb2f9d455d965e4d246
7
- data.tar.gz: 5fb3e4b088aaf7a6a99e08e144f090c68e2a63b0b009fe43929d93daa8da7b9e6b0c330ae048c2d6bda9fbcdef385000c0f255695a539e922393fc3c84a59e84
6
+ metadata.gz: 867fc4cb49114ace4af4682feff5a062eb414f0ce84e4be4e48632609d68cec2ac201be2cb43fb995ac5e9cb4ec0480399aa6eaad7580da81fd5451905b0ddf5
7
+ data.tar.gz: 4b3d3c3d96d45a2573829345fd1f822fa3f8918c9d4088cccc46d82ba4fa797bb7c9838e74d443017069f7cd9b9d343d3bd92219930b12098f036d038e05ef83
data/CHANGELOG.md ADDED
@@ -0,0 +1,80 @@
1
+ # Changelog
2
+
3
+ All notable changes to PromptObjects are documented in this file.
4
+
5
+ ## [0.3.1] - 2025-02-08
6
+
7
+ ### Added
8
+
9
+ - **Thread Explorer** — Standalone HTML visualizer for exploring conversation thread exports. Three views: sequence diagram (swim lanes showing PO communication), timeline (flat chronological event list), and detail panel (full conversation with tool calls). Includes token cost bar, search, per-PO filtering, breadcrumb navigation, and structural event highlighting.
10
+ - **`explore` CLI command** — Open Thread Explorer from the command line. `prompt_objects explore <env>` lists root threads and opens the most recent; `--session ID` targets a specific thread. Data is embedded directly so it opens ready to go.
11
+
12
+ ### Fixed
13
+
14
+ - Delegation messages now correctly show the calling PO's name instead of "human". Previously `context.current_capability` resolved to the target PO (matching its own name), causing a fallback to "human". Now uses `context.calling_po`.
15
+ - CLI integration tests skip gracefully in CI when no LLM API key is available, instead of failing.
16
+
17
+ ## [0.3.0] - 2025-02-05
18
+
19
+ ### Added
20
+
21
+ - **Token usage & cost tracking** — Track input/output tokens and estimated costs per session and across delegation trees. Includes per-model pricing table and a Usage Panel in the web UI (right-click a thread to view).
22
+ - **Ollama & OpenRouter support** — Connect to local Ollama models or OpenRouter's model marketplace. Both reuse the OpenAI adapter with configurable base URLs. Ollama models are auto-discovered from the local API.
23
+ - **Thread export** — Export any conversation thread as Markdown or JSON, including full delegation chains. Delegation sub-threads render inline next to the tool call that triggered them, preserving the actual flow of work. Available via right-click context menu or REST API.
24
+ - **ARC-AGI-1 template** — A template for solving ARC-AGI challenges with a solver PO, data manager PO, and 7 custom grid primitives (load, render, diff, info, find objects, transform, test solution).
25
+ - **Persistent event log** — Message bus events are now persisted to SQLite for replay and debugging.
26
+ - **REST message endpoint & events API** — Send messages to POs and retrieve bus events via HTTP. Includes server discovery for CLI commands.
27
+ - **CLI `message` and `events` commands** — Interact with a running environment from the command line without opening the web UI.
28
+
29
+ ### Fixed
30
+
31
+ - Custom primitives (created by POs or from templates) now auto-load on environment startup. Previously they were saved to `env/primitives/` but never registered on restart.
32
+ - Message serialization bugs that caused crashes when tool calls contained non-string values.
33
+ - Frontend auto-rebuilds when running `prompt_objects serve` in development.
34
+ - Delegation sub-threads in exports now appear inline after the triggering tool call, not at the bottom of the document.
35
+ - Tool result truncation limit increased from 2,000 to 10,000 characters to preserve detail in exports.
36
+ - Full message content stored in bus; truncation applied only at display time.
37
+
38
+ ## [0.2.0] - 2025-01-23
39
+
40
+ ### Added
41
+
42
+ - **GitHub Actions CI** — Automated test suite running on Ruby 3.2, 3.3, and 3.4.
43
+ - **Conversation threads with delegation isolation** — Each PO-to-PO delegation runs in its own thread, keeping conversations clean.
44
+ - **Thread sidebar** — Navigate between threads with auto-naming and instant feedback on creation.
45
+ - **Real-time capability updates** — Adding/removing capabilities broadcasts changes to the web UI immediately.
46
+ - **PO prompt editing** — Edit a Prompt Object's system prompt directly in the web UI with auto-save back to the markdown file.
47
+ - **`modify_prompt` universal capability** — POs can rewrite their own system prompts at runtime.
48
+ - **Environment recovery tools** — `remove_capability` and `delete_primitive` for cleaning up broken state.
49
+ - **Streaming tool calls** — Tool call chains display in real-time as they execute, not just after completion.
50
+ - **Capabilities panel** — Visual display of each PO's available primitives and PO-to-PO capabilities.
51
+ - **Core PromptObject tests** — Unit test suite for the core framework.
52
+
53
+ ### Fixed
54
+
55
+ - Session store binding and Gemini model name resolution.
56
+ - Tool results missing function name for Gemini API compatibility.
57
+ - `tool_calls` Hash vs ToolCall object handling across all adapters.
58
+ - Claude API response parsing for new PO chat updates.
59
+ - Thread switching now immediately shows the new thread on creation.
60
+ - Session message counts and cross-session response routing.
61
+
62
+ ## [0.1.0] - 2025-01-15
63
+
64
+ ### Added
65
+
66
+ - **Core framework** — Markdown files with YAML frontmatter act as LLM-backed autonomous entities.
67
+ - **Unified capability interface** — Primitives (Ruby) and Prompt Objects (Markdown) share the same `receive(message, context:)` interface.
68
+ - **Built-in primitives** — `read_file`, `list_files`, `write_file`, `http_get`.
69
+ - **Universal capabilities** — `ask_human`, `think`, `request_capability`, `create_capability`, `add_capability`.
70
+ - **Multi-provider LLM support** — OpenAI, Anthropic, and Gemini adapters with model selection UI.
71
+ - **PO-to-PO communication** — Prompt Objects can call each other as capabilities through the message bus.
72
+ - **Self-modification** — POs can create new Prompt Objects and primitives at runtime (with human approval).
73
+ - **Web UI** — React frontend with real-time WebSocket updates, split-view layout, markdown rendering.
74
+ - **Notification system** — Non-blocking human-in-the-loop via `ask_human` with notification bell and dropdown.
75
+ - **Live filesystem watching** — Changes to `.md` files in the objects directory are reflected immediately.
76
+ - **SQLite session storage** — Persistent conversation history with WAL mode for concurrent access.
77
+ - **Environment management** — Create, list, and manage isolated environments with `prompt_objects env` commands.
78
+ - **Templates** — Bootstrap new environments from templates (`basic`, `pair`, `team`, and more).
79
+ - **MCP server mode** — Expose POs as tools via the Model Context Protocol for external client integration.
80
+ - **CLI** — `prompt_objects` command with subcommands for environment management, serving, and interaction.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- prompt_objects (0.1.0)
4
+ prompt_objects (0.3.1)
5
5
  anthropic (~> 1.0)
6
6
  async-websocket (~> 0.28)
7
7
  falcon (~> 0.50)
data/README.md CHANGED
@@ -45,8 +45,8 @@ gem install prompt_objects
45
45
  # Create an environment from a template
46
46
  prompt_objects env create my-project --template basic
47
47
 
48
- # Run the web interface
49
- prompt_objects --env my-project
48
+ # Run and open the web interface
49
+ prompt_objects serve my-project --open
50
50
  ```
51
51
 
52
52
  ### Environment Commands