prompt_objects 0.4.0 → 0.6.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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/CLAUDE.md +113 -44
  4. data/README.md +140 -14
  5. data/frontend/index.html +5 -1
  6. data/frontend/src/App.tsx +72 -79
  7. data/frontend/src/canvas/CanvasView.tsx +5 -5
  8. data/frontend/src/canvas/constants.ts +31 -31
  9. data/frontend/src/canvas/inspector/InspectorPanel.tsx +4 -4
  10. data/frontend/src/canvas/inspector/POInspector.tsx +35 -35
  11. data/frontend/src/canvas/inspector/ToolCallInspector.tsx +13 -13
  12. data/frontend/src/canvas/nodes/PONode.ts +2 -2
  13. data/frontend/src/components/ContextMenu.tsx +5 -4
  14. data/frontend/src/components/EnvDataPane.tsx +69 -0
  15. data/frontend/src/components/Inspector.tsx +263 -0
  16. data/frontend/src/components/MarkdownMessage.tsx +22 -20
  17. data/frontend/src/components/MethodList.tsx +90 -0
  18. data/frontend/src/components/ModelSelector.tsx +13 -14
  19. data/frontend/src/components/NotificationPanel.tsx +29 -33
  20. data/frontend/src/components/ObjectList.tsx +78 -0
  21. data/frontend/src/components/PaneSlot.tsx +30 -0
  22. data/frontend/src/components/SourcePane.tsx +202 -0
  23. data/frontend/src/components/SystemBar.tsx +74 -0
  24. data/frontend/src/components/Transcript.tsx +76 -0
  25. data/frontend/src/components/UsagePanel.tsx +27 -27
  26. data/frontend/src/components/Workspace.tsx +260 -0
  27. data/frontend/src/components/index.ts +10 -9
  28. data/frontend/src/hooks/useResize.ts +55 -0
  29. data/frontend/src/hooks/useWebSocket.ts +70 -0
  30. data/frontend/src/index.css +27 -10
  31. data/frontend/src/store/index.ts +36 -0
  32. data/frontend/src/types/index.ts +13 -0
  33. data/frontend/tailwind.config.js +28 -9
  34. data/lib/prompt_objects/capability.rb +23 -1
  35. data/lib/prompt_objects/connectors/mcp.rb +2 -16
  36. data/lib/prompt_objects/environment.rb +15 -0
  37. data/lib/prompt_objects/llm/openai_adapter.rb +22 -0
  38. data/lib/prompt_objects/mcp/tools/inspect_po.rb +1 -31
  39. data/lib/prompt_objects/mcp/tools/list_prompt_objects.rb +1 -6
  40. data/lib/prompt_objects/prompt_object.rb +239 -7
  41. data/lib/prompt_objects/server/api/routes.rb +16 -48
  42. data/lib/prompt_objects/server/app.rb +14 -0
  43. data/lib/prompt_objects/server/public/assets/{index-xvyeb-5Z.js → index-DEPawnfZ.js} +206 -206
  44. data/lib/prompt_objects/server/public/assets/index-oMrRce1m.css +1 -0
  45. data/lib/prompt_objects/server/public/index.html +7 -3
  46. data/lib/prompt_objects/server/websocket_handler.rb +41 -98
  47. data/lib/prompt_objects/server.rb +6 -62
  48. data/lib/prompt_objects/session/store.rb +176 -4
  49. data/lib/prompt_objects/universal/delete_env_data.rb +70 -0
  50. data/lib/prompt_objects/universal/get_env_data.rb +64 -0
  51. data/lib/prompt_objects/universal/list_env_data.rb +61 -0
  52. data/lib/prompt_objects/universal/store_env_data.rb +87 -0
  53. data/lib/prompt_objects/universal/update_env_data.rb +88 -0
  54. data/lib/prompt_objects.rb +6 -1
  55. data/prompt_objects.gemspec +1 -1
  56. data/templates/arc-agi-1/objects/observer.md +4 -0
  57. data/templates/arc-agi-1/objects/solver.md +10 -1
  58. data/templates/arc-agi-1/objects/verifier.md +4 -0
  59. data/templates/arc-agi-1/primitives/find_objects.rb +1 -1
  60. data/templates/arc-agi-1/primitives/grid_diff.rb +2 -2
  61. data/templates/arc-agi-1/primitives/grid_info.rb +1 -1
  62. data/templates/arc-agi-1/primitives/grid_transform.rb +1 -1
  63. data/templates/arc-agi-1/primitives/render_grid.rb +1 -0
  64. data/templates/arc-agi-1/primitives/test_solution.rb +3 -0
  65. data/tools/thread-explorer.html +27 -0
  66. metadata +18 -16
  67. data/Gemfile.lock +0 -233
  68. data/IMPLEMENTATION_PLAN.md +0 -1073
  69. data/design-doc-v2.md +0 -1232
  70. data/frontend/src/components/CapabilitiesPanel.tsx +0 -141
  71. data/frontend/src/components/ChatPanel.tsx +0 -296
  72. data/frontend/src/components/Dashboard.tsx +0 -83
  73. data/frontend/src/components/Header.tsx +0 -153
  74. data/frontend/src/components/MessageBus.tsx +0 -56
  75. data/frontend/src/components/POCard.tsx +0 -56
  76. data/frontend/src/components/PODetail.tsx +0 -124
  77. data/frontend/src/components/PromptPanel.tsx +0 -156
  78. data/frontend/src/components/SessionsPanel.tsx +0 -174
  79. data/frontend/src/components/ThreadsSidebar.tsx +0 -163
  80. data/lib/prompt_objects/server/public/assets/index-6y64NXFy.css +0 -1
@@ -58,6 +58,8 @@ module PromptObjects
58
58
  get_prompt_object($1)
59
59
  when %r{^/events/session/([^/]+)$}
60
60
  get_session_events($1)
61
+ when %r{^/sessions/([^/]+)/env_data$}
62
+ get_session_env_data($1)
61
63
  when %r{^/sessions/([^/]+)/usage$}
62
64
  get_session_usage($1, _request)
63
65
  when %r{^/sessions/([^/]+)/export$}
@@ -192,13 +194,7 @@ module PromptObjects
192
194
  end
193
195
 
194
196
  sessions = po.list_sessions.map do |s|
195
- {
196
- id: s[:id],
197
- name: s[:name],
198
- message_count: s[:message_count] || 0,
199
- created_at: s[:created_at]&.iso8601,
200
- updated_at: s[:updated_at]&.iso8601
201
- }
197
+ PromptObject.serialize_session(s)
202
198
  end
203
199
 
204
200
  { sessions: sessions }
@@ -320,6 +316,17 @@ module PromptObjects
320
316
  }
321
317
  end
322
318
 
319
+ # === Env Data ===
320
+
321
+ def get_session_env_data(session_id)
322
+ return { error: "No session store" } unless @runtime.session_store
323
+
324
+ root_thread_id = @runtime.session_store.resolve_root_thread(session_id)
325
+ entries = @runtime.session_store.list_env_data_full(root_thread_id: root_thread_id)
326
+
327
+ { root_thread_id: root_thread_id, entries: entries }
328
+ end
329
+
323
330
  # === Usage ===
324
331
 
325
332
  def get_session_usage(session_id, request)
@@ -372,31 +379,11 @@ module PromptObjects
372
379
  # === Helpers ===
373
380
 
374
381
  def po_summary(po)
375
- {
376
- name: po.name,
377
- description: po.description,
378
- capabilities: po.config["capabilities"] || [],
379
- session_count: po.list_sessions.size
380
- }
382
+ po.to_summary_hash(registry: @runtime.registry)
381
383
  end
382
384
 
383
385
  def po_full(po)
384
- {
385
- name: po.name,
386
- description: po.description,
387
- capabilities: po.config["capabilities"] || [],
388
- body: po.body,
389
- config: po.config,
390
- sessions: po.list_sessions.map do |s|
391
- {
392
- id: s[:id],
393
- name: s[:name],
394
- message_count: s[:message_count] || 0
395
- }
396
- end,
397
- current_session: po.session_id,
398
- history: po.history.map { |m| format_history_message(m) }
399
- }
386
+ po.to_inspect_hash(registry: @runtime.registry)
400
387
  end
401
388
 
402
389
  def format_message(msg)
@@ -410,25 +397,6 @@ module PromptObjects
410
397
  }.compact
411
398
  end
412
399
 
413
- def format_history_message(msg)
414
- case msg[:role]
415
- when :user
416
- { role: "user", content: msg[:content], from: msg[:from] }
417
- when :assistant
418
- h = { role: "assistant", content: msg[:content] }
419
- if msg[:tool_calls]
420
- h[:tool_calls] = msg[:tool_calls].map do |tc|
421
- { id: tc.id, name: tc.name, arguments: tc.arguments }
422
- end
423
- end
424
- h
425
- when :tool
426
- { role: "tool", results: msg[:results] }
427
- else
428
- { role: msg[:role].to_s, content: msg[:content] }
429
- end
430
- end
431
-
432
400
  def path_param(path, index)
433
401
  # Extract path parameter from regex match
434
402
  # /prompt_objects/foo -> foo (index 1)
@@ -28,6 +28,20 @@ module PromptObjects
28
28
  payload: payload
29
29
  )
30
30
  }
31
+
32
+ @runtime.on_env_data_changed = ->(action:, root_thread_id:, key:, stored_by:) {
33
+ entries = @runtime.session_store&.list_env_data_full(root_thread_id: root_thread_id) || []
34
+ broadcast(
35
+ type: "env_data_changed",
36
+ payload: {
37
+ action: action,
38
+ root_thread_id: root_thread_id,
39
+ key: key,
40
+ stored_by: stored_by,
41
+ entries: entries
42
+ }
43
+ )
44
+ }
31
45
  end
32
46
 
33
47
  def call(env)