prompt_objects 0.6.0 → 0.7.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/CHANGELOG.md +126 -0
- data/README.md +93 -22
- data/exe/poop +5 -0
- data/exe/prompt_objects +1 -1108
- data/exe/prompt_objects_mcp +5 -3
- data/lib/prompt_objects/capability.rb +33 -0
- data/lib/prompt_objects/cli/diagnostics_command.rb +69 -0
- data/lib/prompt_objects/cli/env_command.rb +435 -0
- data/lib/prompt_objects/cli/events_command.rb +145 -0
- data/lib/prompt_objects/cli/explore_command.rb +155 -0
- data/lib/prompt_objects/cli/helpers.rb +91 -0
- data/lib/prompt_objects/cli/message_command.rb +216 -0
- data/lib/prompt_objects/cli/repl_command.rb +366 -0
- data/lib/prompt_objects/cli/serve_command.rb +162 -0
- data/lib/prompt_objects/cli.rb +64 -422
- data/lib/prompt_objects/connectors/base.rb +16 -29
- data/lib/prompt_objects/connectors/mcp.rb +82 -98
- data/lib/prompt_objects/domain/records.rb +45 -0
- data/lib/prompt_objects/environment/exporter.rb +5 -4
- data/lib/prompt_objects/environment/git.rb +21 -1
- data/lib/prompt_objects/environment/importer.rb +5 -4
- data/lib/prompt_objects/environment/manager.rb +44 -6
- data/lib/prompt_objects/environment/manifest.rb +26 -4
- data/lib/prompt_objects/environment.rb +1337 -20
- data/lib/prompt_objects/execution/blocking_executor.rb +88 -0
- data/lib/prompt_objects/execution/context.rb +137 -0
- data/lib/prompt_objects/execution/contracts.rb +59 -0
- data/lib/prompt_objects/execution/permit_pool.rb +49 -0
- data/lib/prompt_objects/execution/policy.rb +47 -0
- data/lib/prompt_objects/execution/resource_lock_manager.rb +63 -0
- data/lib/prompt_objects/execution/runner.rb +498 -0
- data/lib/prompt_objects/execution/scheduler.rb +325 -0
- data/lib/prompt_objects/llm/factory.rb +4 -4
- data/lib/prompt_objects/llm/gemini_adapter.rb +25 -8
- data/lib/prompt_objects/llm/openai_adapter.rb +9 -1
- data/lib/prompt_objects/llm/pricing.rb +9 -2
- data/lib/prompt_objects/llm/response.rb +9 -4
- data/lib/prompt_objects/loader.rb +28 -1
- data/lib/prompt_objects/mcp/server.rb +6 -3
- data/lib/prompt_objects/mcp/tools/get_conversation.rb +15 -11
- data/lib/prompt_objects/mcp/tools/get_pending_requests.rb +2 -2
- data/lib/prompt_objects/mcp/tools/respond_to_request.rb +3 -3
- data/lib/prompt_objects/mcp/tools/send_message.rb +42 -32
- data/lib/prompt_objects/operations/diagnostics.rb +115 -0
- data/lib/prompt_objects/operations/retention.rb +75 -0
- data/lib/prompt_objects/operations/run_trace_builder.rb +152 -0
- data/lib/prompt_objects/primitives/http_get.rb +2 -0
- data/lib/prompt_objects/primitives/list_files.rb +2 -0
- data/lib/prompt_objects/primitives/read_file.rb +2 -0
- data/lib/prompt_objects/primitives/think.rb +36 -0
- data/lib/prompt_objects/primitives/write_file.rb +9 -0
- data/lib/prompt_objects/prompt_object.rb +171 -519
- data/lib/prompt_objects/repositories/artifact_repository.rb +109 -0
- data/lib/prompt_objects/repositories/base_repository.rb +37 -0
- data/lib/prompt_objects/repositories/definition_repository.rb +36 -0
- data/lib/prompt_objects/repositories/env_data_repository.rb +103 -0
- data/lib/prompt_objects/repositories/event_repository.rb +105 -0
- data/lib/prompt_objects/repositories/message_repository.rb +73 -0
- data/lib/prompt_objects/repositories/run_repository.rb +254 -0
- data/lib/prompt_objects/repositories/thread_repository.rb +87 -0
- data/lib/prompt_objects/repositories/tool_execution_repository.rb +88 -0
- data/lib/prompt_objects/repositories/workspace_session_repository.rb +61 -0
- data/lib/prompt_objects/server/api/routes.rb +549 -53
- data/lib/prompt_objects/server/app.rb +133 -14
- data/lib/prompt_objects/server/file_watcher.rb +9 -0
- data/lib/prompt_objects/server/public/assets/index-BjKlODDD.js +90 -0
- data/lib/prompt_objects/server/public/assets/index-w3fpIb5c.css +1 -0
- data/lib/prompt_objects/server/public/index.html +2 -2
- data/lib/prompt_objects/server/websocket_handler.rb +202 -227
- data/lib/prompt_objects/server.rb +170 -1
- data/lib/prompt_objects/service.rb +129 -0
- data/lib/prompt_objects/session/store.rb +600 -13
- data/lib/prompt_objects/universal/add_capability.rb +1 -1
- data/lib/prompt_objects/universal/create_capability.rb +4 -2
- data/lib/prompt_objects/universal/delete_env_data.rb +23 -15
- data/lib/prompt_objects/universal/delete_primitive.rb +1 -1
- data/lib/prompt_objects/universal/dispatch_po.rb +54 -0
- data/lib/prompt_objects/universal/get_env_data.rb +8 -14
- data/lib/prompt_objects/universal/get_run_status.rb +30 -0
- data/lib/prompt_objects/universal/join_runs.rb +35 -0
- data/lib/prompt_objects/universal/list_env_data.rb +10 -14
- data/lib/prompt_objects/universal/modify_primitive.rb +1 -1
- data/lib/prompt_objects/universal/render_artifact.rb +91 -0
- data/lib/prompt_objects/universal/request_primitive.rb +1 -1
- data/lib/prompt_objects/universal/{store_env_data.rb → set_env_data.rb} +34 -20
- data/lib/prompt_objects/version.rb +5 -0
- data/lib/prompt_objects.rb +33 -8
- data/objects/coordinator.md +8 -4
- data/templates/arc-agi-1/objects/data_manager.md +2 -2
- data/templates/arc-agi-1/objects/observer.md +2 -2
- data/templates/arc-agi-1/objects/solver.md +6 -5
- data/templates/arc-agi-1/objects/verifier.md +2 -2
- data/templates/arc-agi-3/manifest.yml +19 -0
- data/templates/arc-agi-3/objects/analyst.md +79 -0
- data/templates/arc-agi-3/objects/player.md +76 -0
- data/templates/arc-agi-3/objects/strategist.md +97 -0
- data/templates/arc-agi-3/primitives/action_log.rb +133 -0
- data/templates/arc-agi-3/primitives/arc3_api.rb +223 -0
- data/templates/arc-agi-3/primitives/arc3_scorecard.rb +131 -0
- data/templates/arc-agi-3/primitives/frame_diff.rb +143 -0
- data/templates/arc-agi-3/primitives/frame_info.rb +96 -0
- data/templates/arc-agi-3/primitives/render_frame.rb +140 -0
- data/templates/basic/objects/basic.md +11 -3
- data/templates/chiptune/extras/sonic_pi_boot.rb +220 -0
- data/templates/chiptune/manifest.yml +20 -0
- data/templates/chiptune/objects/conductor.md +184 -0
- data/templates/chiptune/objects/sonic_pi.md +65 -0
- data/templates/chiptune/objects/voice_bass.md +44 -0
- data/templates/chiptune/objects/voice_lead.md +44 -0
- data/templates/chiptune/objects/voice_pad.md +43 -0
- data/templates/chiptune/objects/voice_perc.md +45 -0
- data/templates/chiptune/primitives/play_note.rb +59 -0
- data/templates/chiptune/primitives/play_sequence.rb +55 -0
- data/templates/chiptune/primitives/query_sonic_pi.rb +141 -0
- data/templates/chiptune/primitives/set_synth.rb +57 -0
- data/templates/chiptune/primitives/set_tempo.rb +45 -0
- data/templates/chiptune/primitives/stop_voice.rb +46 -0
- data/templates/chiptune/primitives/support/osc_bridge.rb +33 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/LICENSE +19 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/lib/osc-ruby/address_pattern.rb +58 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/lib/osc-ruby/broadcast_client.rb +24 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/lib/osc-ruby/bundle.rb +46 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/lib/osc-ruby/client.rb +13 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/lib/osc-ruby/core_ext/time.rb +6 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/lib/osc-ruby/em_server.rb +63 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/lib/osc-ruby/message.rb +46 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/lib/osc-ruby/network_packet.rb +42 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/lib/osc-ruby/osc_argument.rb +26 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/lib/osc-ruby/osc_packet.rb +140 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/lib/osc-ruby/osc_types.rb +53 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/lib/osc-ruby/server.rb +91 -0
- data/templates/chiptune/vendor/osc-ruby-1.1.5/lib/osc-ruby.rb +18 -0
- data/templates/developer/objects/code_reviewer.md +1 -1
- data/templates/developer/objects/coordinator.md +16 -3
- data/templates/developer/objects/debugger.md +3 -3
- data/templates/empty/objects/assistant.md +10 -5
- data/templates/minimal/objects/assistant.md +10 -5
- data/templates/music/extras/sonic_pi_boot.rb +220 -0
- data/templates/music/manifest.yml +16 -0
- data/templates/music/objects/conductor.md +154 -0
- data/templates/music/objects/sonic_pi.md +65 -0
- data/templates/music/primitives/play_note.rb +55 -0
- data/templates/music/primitives/play_sequence.rb +51 -0
- data/templates/music/primitives/query_sonic_pi.rb +139 -0
- data/templates/music/primitives/set_synth.rb +53 -0
- data/templates/music/primitives/set_tempo.rb +43 -0
- data/templates/music/primitives/stop_voice.rb +44 -0
- data/templates/music/primitives/support/osc_bridge.rb +33 -0
- data/templates/music/vendor/osc-ruby-1.1.5/LICENSE +19 -0
- data/templates/music/vendor/osc-ruby-1.1.5/lib/osc-ruby/address_pattern.rb +58 -0
- data/templates/music/vendor/osc-ruby-1.1.5/lib/osc-ruby/broadcast_client.rb +24 -0
- data/templates/music/vendor/osc-ruby-1.1.5/lib/osc-ruby/bundle.rb +46 -0
- data/templates/music/vendor/osc-ruby-1.1.5/lib/osc-ruby/client.rb +13 -0
- data/templates/music/vendor/osc-ruby-1.1.5/lib/osc-ruby/core_ext/time.rb +6 -0
- data/templates/music/vendor/osc-ruby-1.1.5/lib/osc-ruby/em_server.rb +63 -0
- data/templates/music/vendor/osc-ruby-1.1.5/lib/osc-ruby/message.rb +46 -0
- data/templates/music/vendor/osc-ruby-1.1.5/lib/osc-ruby/network_packet.rb +42 -0
- data/templates/music/vendor/osc-ruby-1.1.5/lib/osc-ruby/osc_argument.rb +26 -0
- data/templates/music/vendor/osc-ruby-1.1.5/lib/osc-ruby/osc_packet.rb +140 -0
- data/templates/music/vendor/osc-ruby-1.1.5/lib/osc-ruby/osc_types.rb +53 -0
- data/templates/music/vendor/osc-ruby-1.1.5/lib/osc-ruby/server.rb +91 -0
- data/templates/music/vendor/osc-ruby-1.1.5/lib/osc-ruby.rb +18 -0
- data/templates/music-beginner/README.md +100 -0
- data/templates/music-beginner/extras/README.md +27 -0
- data/templates/music-beginner/extras/sonic_pi_boot.rb +297 -0
- data/templates/music-beginner/manifest.yml +25 -0
- data/templates/music-beginner/objects/conductor.md +222 -0
- data/templates/music-beginner/objects/engine_setup.md +54 -0
- data/templates/music-beginner/objects/voice_bass.md +43 -0
- data/templates/music-beginner/objects/voice_keys.md +48 -0
- data/templates/music-beginner/objects/voice_pad.md +46 -0
- data/templates/music-beginner/objects/voice_percussion.md +45 -0
- data/templates/music-beginner/objects/voice_texture.md +37 -0
- data/templates/music-beginner/primitives/play_pattern.rb +118 -0
- data/templates/music-beginner/primitives/query_music_engine.rb +94 -0
- data/templates/music-beginner/primitives/set_instrument.rb +47 -0
- data/templates/music-beginner/primitives/set_tempo.rb +43 -0
- data/templates/music-beginner/primitives/set_voice_level.rb +46 -0
- data/templates/music-beginner/primitives/stop_voice.rb +37 -0
- data/templates/music-beginner/primitives/support/osc_bridge.rb +25 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/LICENSE +19 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/lib/osc-ruby/address_pattern.rb +58 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/lib/osc-ruby/broadcast_client.rb +24 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/lib/osc-ruby/bundle.rb +46 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/lib/osc-ruby/client.rb +13 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/lib/osc-ruby/core_ext/time.rb +6 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/lib/osc-ruby/em_server.rb +63 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/lib/osc-ruby/message.rb +46 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/lib/osc-ruby/network_packet.rb +42 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/lib/osc-ruby/osc_argument.rb +26 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/lib/osc-ruby/osc_packet.rb +140 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/lib/osc-ruby/osc_types.rb +53 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/lib/osc-ruby/server.rb +91 -0
- data/templates/music-beginner/vendor/osc-ruby-1.1.5/lib/osc-ruby.rb +18 -0
- data/templates/music-pro/extras/AUDITION.md +100 -0
- data/templates/music-pro/extras/sonic_pi_boot.rb +546 -0
- data/templates/music-pro/manifest.yml +19 -0
- data/templates/music-pro/objects/conductor.md +126 -0
- data/templates/music-pro/objects/sonic_pi.md +35 -0
- data/templates/music-pro/objects/voice_harmony.md +48 -0
- data/templates/music-pro/objects/voice_rhythm.md +43 -0
- data/templates/music-pro/objects/voice_texture.md +42 -0
- data/templates/music-pro/primitives/define_patch.rb +46 -0
- data/templates/music-pro/primitives/query_music_engine.rb +69 -0
- data/templates/music-pro/primitives/set_live_pattern.rb +70 -0
- data/templates/music-pro/primitives/set_tempo.rb +31 -0
- data/templates/music-pro/primitives/stop_voice.rb +31 -0
- data/templates/music-pro/primitives/support/music_protocol.rb +136 -0
- data/templates/music-pro/primitives/support/osc_bridge.rb +33 -0
- data/templates/music-pro/primitives/trigger_event.rb +44 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/LICENSE +19 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/lib/osc-ruby/address_pattern.rb +58 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/lib/osc-ruby/broadcast_client.rb +24 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/lib/osc-ruby/bundle.rb +46 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/lib/osc-ruby/client.rb +13 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/lib/osc-ruby/core_ext/time.rb +6 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/lib/osc-ruby/em_server.rb +63 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/lib/osc-ruby/message.rb +46 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/lib/osc-ruby/network_packet.rb +42 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/lib/osc-ruby/osc_argument.rb +26 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/lib/osc-ruby/osc_packet.rb +140 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/lib/osc-ruby/osc_types.rb +53 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/lib/osc-ruby/server.rb +91 -0
- data/templates/music-pro/vendor/osc-ruby-1.1.5/lib/osc-ruby.rb +18 -0
- data/templates/writer/objects/coordinator.md +14 -3
- data/templates/writer/objects/editor.md +1 -1
- data/templates/writer/objects/researcher.md +2 -2
- data/tools/thread-explorer.html +1 -1
- metadata +172 -65
- data/CLAUDE.md +0 -177
- data/Gemfile +0 -10
- data/Rakefile +0 -27
- data/frontend/.gitignore +0 -3
- data/frontend/index.html +0 -17
- data/frontend/package-lock.json +0 -4540
- data/frontend/package.json +0 -36
- data/frontend/postcss.config.js +0 -6
- data/frontend/src/App.tsx +0 -104
- data/frontend/src/canvas/CanvasView.tsx +0 -113
- data/frontend/src/canvas/ForceLayout.ts +0 -115
- data/frontend/src/canvas/SceneManager.ts +0 -587
- data/frontend/src/canvas/canvasStore.ts +0 -47
- data/frontend/src/canvas/constants.ts +0 -95
- data/frontend/src/canvas/controls/CameraControls.ts +0 -98
- data/frontend/src/canvas/edges/MessageArc.ts +0 -149
- data/frontend/src/canvas/inspector/InspectorPanel.tsx +0 -31
- data/frontend/src/canvas/inspector/POInspector.tsx +0 -262
- data/frontend/src/canvas/inspector/ToolCallInspector.tsx +0 -67
- data/frontend/src/canvas/nodes/PONode.ts +0 -249
- data/frontend/src/canvas/nodes/ToolCallNode.ts +0 -116
- data/frontend/src/canvas/types.ts +0 -24
- data/frontend/src/components/ContextMenu.tsx +0 -68
- data/frontend/src/components/EnvDataPane.tsx +0 -69
- data/frontend/src/components/Inspector.tsx +0 -263
- data/frontend/src/components/MarkdownMessage.tsx +0 -155
- data/frontend/src/components/MethodList.tsx +0 -90
- data/frontend/src/components/ModelSelector.tsx +0 -115
- data/frontend/src/components/NotificationPanel.tsx +0 -130
- data/frontend/src/components/ObjectList.tsx +0 -78
- data/frontend/src/components/PaneSlot.tsx +0 -30
- data/frontend/src/components/SourcePane.tsx +0 -202
- data/frontend/src/components/SystemBar.tsx +0 -74
- data/frontend/src/components/Transcript.tsx +0 -76
- data/frontend/src/components/UsagePanel.tsx +0 -105
- data/frontend/src/components/Workspace.tsx +0 -260
- data/frontend/src/components/index.ts +0 -12
- data/frontend/src/hooks/useResize.ts +0 -55
- data/frontend/src/hooks/useWebSocket.ts +0 -559
- data/frontend/src/index.css +0 -102
- data/frontend/src/main.tsx +0 -10
- data/frontend/src/store/index.ts +0 -311
- data/frontend/src/types/index.ts +0 -176
- data/frontend/tailwind.config.js +0 -44
- data/frontend/tsconfig.json +0 -30
- data/frontend/vite.config.ts +0 -29
- data/lib/prompt_objects/server/public/assets/index-DEPawnfZ.js +0 -4345
- data/lib/prompt_objects/server/public/assets/index-oMrRce1m.css +0 -1
- data/lib/prompt_objects/universal/add_primitive.rb +0 -118
- data/lib/prompt_objects/universal/ask_human.rb +0 -109
- data/lib/prompt_objects/universal/create_primitive.rb +0 -174
- data/lib/prompt_objects/universal/list_primitives.rb +0 -145
- data/lib/prompt_objects/universal/think.rb +0 -41
- data/lib/prompt_objects/universal/update_env_data.rb +0 -88
- data/prompt_objects.gemspec +0 -50
- data/templates/basic/.gitignore +0 -2
- data/templates/developer/.gitignore +0 -5
- data/templates/empty/.gitignore +0 -5
- data/templates/empty/objects/.gitkeep +0 -0
- data/templates/minimal/.gitignore +0 -5
- data/templates/writer/.gitignore +0 -5
data/frontend/package.json
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "prompt-objects-frontend",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.1.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
8
|
-
"build": "tsc && vite build",
|
|
9
|
-
"preview": "vite preview",
|
|
10
|
-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@types/react-syntax-highlighter": "^15.5.13",
|
|
14
|
-
"clsx": "^2.1.1",
|
|
15
|
-
"d3-force": "^3.0.0",
|
|
16
|
-
"react": "^18.3.1",
|
|
17
|
-
"react-dom": "^18.3.1",
|
|
18
|
-
"react-markdown": "^10.1.0",
|
|
19
|
-
"react-syntax-highlighter": "^16.1.0",
|
|
20
|
-
"remark-gfm": "^4.0.1",
|
|
21
|
-
"three": "^0.182.0",
|
|
22
|
-
"zustand": "^5.0.0"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@types/d3-force": "^3.0.10",
|
|
26
|
-
"@types/react": "^18.3.12",
|
|
27
|
-
"@types/react-dom": "^18.3.1",
|
|
28
|
-
"@types/three": "^0.182.0",
|
|
29
|
-
"@vitejs/plugin-react": "^4.3.4",
|
|
30
|
-
"autoprefixer": "^10.4.20",
|
|
31
|
-
"postcss": "^8.4.49",
|
|
32
|
-
"tailwindcss": "^3.4.16",
|
|
33
|
-
"typescript": "^5.6.3",
|
|
34
|
-
"vite": "^6.0.3"
|
|
35
|
-
}
|
|
36
|
-
}
|
data/frontend/postcss.config.js
DELETED
data/frontend/src/App.tsx
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { useWebSocket } from './hooks/useWebSocket'
|
|
2
|
-
import { useStore, useSelectedPO } from './store'
|
|
3
|
-
import { useResize } from './hooks/useResize'
|
|
4
|
-
import { SystemBar } from './components/SystemBar'
|
|
5
|
-
import { ObjectList } from './components/ObjectList'
|
|
6
|
-
import { Inspector } from './components/Inspector'
|
|
7
|
-
import { Transcript } from './components/Transcript'
|
|
8
|
-
import { NotificationPanel } from './components/NotificationPanel'
|
|
9
|
-
import { UsagePanel } from './components/UsagePanel'
|
|
10
|
-
import { CanvasView } from './canvas/CanvasView'
|
|
11
|
-
|
|
12
|
-
export default function App() {
|
|
13
|
-
const { sendMessage, respondToNotification, createSession, switchSession, switchLLM, createThread, updatePrompt, requestUsage, exportThread, requestEnvData } =
|
|
14
|
-
useWebSocket()
|
|
15
|
-
const { selectedPO, busOpen, notifications, usageData, clearUsageData, currentView } = useStore()
|
|
16
|
-
const selectedPOData = useSelectedPO()
|
|
17
|
-
|
|
18
|
-
const objectListResize = useResize({
|
|
19
|
-
direction: 'horizontal',
|
|
20
|
-
initialSize: 192,
|
|
21
|
-
minSize: 120,
|
|
22
|
-
maxSize: 320,
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
const transcriptResize = useResize({
|
|
26
|
-
direction: 'vertical',
|
|
27
|
-
initialSize: 180,
|
|
28
|
-
minSize: 80,
|
|
29
|
-
maxSize: 400,
|
|
30
|
-
inverted: true,
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<div className="h-screen flex flex-col bg-po-bg">
|
|
35
|
-
<SystemBar switchLLM={switchLLM} />
|
|
36
|
-
|
|
37
|
-
<div className="flex-1 flex flex-col overflow-hidden">
|
|
38
|
-
{/* Main view area */}
|
|
39
|
-
<div className="flex-1 flex overflow-hidden">
|
|
40
|
-
{currentView === 'canvas' ? (
|
|
41
|
-
<CanvasView />
|
|
42
|
-
) : (
|
|
43
|
-
<>
|
|
44
|
-
{/* Object List - resizable */}
|
|
45
|
-
<div style={{ width: objectListResize.size }} className="flex-shrink-0">
|
|
46
|
-
<ObjectList />
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
{/* Resize handle */}
|
|
50
|
-
<div
|
|
51
|
-
className="resize-handle"
|
|
52
|
-
onMouseDown={objectListResize.onMouseDown}
|
|
53
|
-
/>
|
|
54
|
-
|
|
55
|
-
{/* Main content */}
|
|
56
|
-
<main className="flex-1 overflow-hidden flex flex-col">
|
|
57
|
-
{selectedPO && selectedPOData ? (
|
|
58
|
-
<Inspector
|
|
59
|
-
po={selectedPOData}
|
|
60
|
-
sendMessage={sendMessage}
|
|
61
|
-
createSession={createSession}
|
|
62
|
-
switchSession={switchSession}
|
|
63
|
-
createThread={createThread}
|
|
64
|
-
updatePrompt={updatePrompt}
|
|
65
|
-
requestUsage={requestUsage}
|
|
66
|
-
exportThread={exportThread}
|
|
67
|
-
requestEnvData={requestEnvData}
|
|
68
|
-
/>
|
|
69
|
-
) : (
|
|
70
|
-
<div className="h-full flex items-center justify-center text-po-text-ghost">
|
|
71
|
-
<span className="font-mono text-xs">Select an object</span>
|
|
72
|
-
</div>
|
|
73
|
-
)}
|
|
74
|
-
</main>
|
|
75
|
-
</>
|
|
76
|
-
)}
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
{/* Transcript - resizable bottom pane, visible in both views */}
|
|
80
|
-
{busOpen && (
|
|
81
|
-
<>
|
|
82
|
-
<div
|
|
83
|
-
className="resize-handle-h"
|
|
84
|
-
onMouseDown={transcriptResize.onMouseDown}
|
|
85
|
-
/>
|
|
86
|
-
<div style={{ height: transcriptResize.size }} className="flex-shrink-0">
|
|
87
|
-
<Transcript />
|
|
88
|
-
</div>
|
|
89
|
-
</>
|
|
90
|
-
)}
|
|
91
|
-
</div>
|
|
92
|
-
|
|
93
|
-
{/* Notification panel - floating */}
|
|
94
|
-
{notifications.length > 0 && (
|
|
95
|
-
<NotificationPanel respondToNotification={respondToNotification} />
|
|
96
|
-
)}
|
|
97
|
-
|
|
98
|
-
{/* Usage panel modal */}
|
|
99
|
-
{usageData && (
|
|
100
|
-
<UsagePanel usage={usageData as any} onClose={clearUsageData} />
|
|
101
|
-
)}
|
|
102
|
-
</div>
|
|
103
|
-
)
|
|
104
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useCallback } from 'react'
|
|
2
|
-
import { useStore } from '../store'
|
|
3
|
-
import { useCanvasStore } from './canvasStore'
|
|
4
|
-
import { SceneManager } from './SceneManager'
|
|
5
|
-
import { InspectorPanel } from './inspector/InspectorPanel'
|
|
6
|
-
|
|
7
|
-
export function CanvasView() {
|
|
8
|
-
const containerRef = useRef<HTMLDivElement>(null)
|
|
9
|
-
const sceneRef = useRef<SceneManager | null>(null)
|
|
10
|
-
const syncScheduled = useRef(false)
|
|
11
|
-
|
|
12
|
-
// Schedule a throttled sync via requestAnimationFrame
|
|
13
|
-
const scheduleSync = useCallback(() => {
|
|
14
|
-
if (syncScheduled.current) return
|
|
15
|
-
syncScheduled.current = true
|
|
16
|
-
requestAnimationFrame(() => {
|
|
17
|
-
syncScheduled.current = false
|
|
18
|
-
const scene = sceneRef.current
|
|
19
|
-
if (!scene) return
|
|
20
|
-
const state = useStore.getState()
|
|
21
|
-
scene.syncPromptObjects(state.promptObjects)
|
|
22
|
-
scene.syncBusMessages(state.busMessages)
|
|
23
|
-
scene.syncNotifications(state.notifications)
|
|
24
|
-
})
|
|
25
|
-
}, [])
|
|
26
|
-
|
|
27
|
-
// Mount/unmount SceneManager
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
const container = containerRef.current
|
|
30
|
-
if (!container) return
|
|
31
|
-
|
|
32
|
-
const scene = new SceneManager(container)
|
|
33
|
-
sceneRef.current = scene
|
|
34
|
-
|
|
35
|
-
// Initial sync
|
|
36
|
-
const state = useStore.getState()
|
|
37
|
-
scene.syncPromptObjects(state.promptObjects)
|
|
38
|
-
scene.syncBusMessages(state.busMessages)
|
|
39
|
-
scene.syncNotifications(state.notifications)
|
|
40
|
-
scene.start()
|
|
41
|
-
|
|
42
|
-
// Fit all after a short delay to let force layout settle
|
|
43
|
-
const fitTimer = setTimeout(() => scene.fitAll(), 500)
|
|
44
|
-
|
|
45
|
-
return () => {
|
|
46
|
-
clearTimeout(fitTimer)
|
|
47
|
-
scene.dispose()
|
|
48
|
-
sceneRef.current = null
|
|
49
|
-
}
|
|
50
|
-
}, [])
|
|
51
|
-
|
|
52
|
-
// Subscribe to store changes (non-React API to avoid re-renders)
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
const unsub = useStore.subscribe(scheduleSync)
|
|
55
|
-
return unsub
|
|
56
|
-
}, [scheduleSync])
|
|
57
|
-
|
|
58
|
-
// Keyboard shortcuts
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
const handler = (e: KeyboardEvent) => {
|
|
61
|
-
if (e.key === 'f' && !e.ctrlKey && !e.metaKey) {
|
|
62
|
-
// Don't intercept when typing in an input
|
|
63
|
-
if ((e.target as HTMLElement).tagName === 'INPUT' || (e.target as HTMLElement).tagName === 'TEXTAREA') return
|
|
64
|
-
sceneRef.current?.fitAll()
|
|
65
|
-
}
|
|
66
|
-
if (e.key === 'Escape') {
|
|
67
|
-
useCanvasStore.getState().selectNode(null)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
window.addEventListener('keydown', handler)
|
|
71
|
-
return () => window.removeEventListener('keydown', handler)
|
|
72
|
-
}, [])
|
|
73
|
-
|
|
74
|
-
const showLabels = useCanvasStore((s) => s.showLabels)
|
|
75
|
-
const toggleLabels = useCanvasStore((s) => s.toggleLabels)
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<div className="flex-1 flex overflow-hidden relative">
|
|
79
|
-
{/* Three.js container */}
|
|
80
|
-
<div ref={containerRef} className="flex-1 relative" />
|
|
81
|
-
|
|
82
|
-
{/* Toolbar overlay */}
|
|
83
|
-
<div className="absolute top-3 left-3 flex gap-2 z-10">
|
|
84
|
-
<button
|
|
85
|
-
onClick={() => sceneRef.current?.fitAll()}
|
|
86
|
-
className="px-2.5 py-1 text-xs bg-po-surface-2/80 backdrop-blur border border-po-border rounded hover:border-po-accent transition-colors duration-150 text-po-text-secondary hover:text-po-text-primary"
|
|
87
|
-
title="Fit all nodes (F)"
|
|
88
|
-
>
|
|
89
|
-
Fit All
|
|
90
|
-
</button>
|
|
91
|
-
<button
|
|
92
|
-
onClick={toggleLabels}
|
|
93
|
-
className={`px-2.5 py-1 text-xs backdrop-blur border rounded transition-colors duration-150 ${
|
|
94
|
-
showLabels
|
|
95
|
-
? 'bg-po-accent-wash border-po-accent text-po-accent'
|
|
96
|
-
: 'bg-po-surface-2/80 border-po-border text-po-text-secondary hover:text-po-text-primary'
|
|
97
|
-
}`}
|
|
98
|
-
title="Toggle labels"
|
|
99
|
-
>
|
|
100
|
-
Labels
|
|
101
|
-
</button>
|
|
102
|
-
</div>
|
|
103
|
-
|
|
104
|
-
{/* Help hint */}
|
|
105
|
-
<div className="absolute bottom-3 left-3 text-2xs text-po-text-ghost z-10 font-mono">
|
|
106
|
-
Scroll to zoom · Shift+drag to pan · F to fit · Click node to inspect
|
|
107
|
-
</div>
|
|
108
|
-
|
|
109
|
-
{/* Inspector panel */}
|
|
110
|
-
<InspectorPanel />
|
|
111
|
-
</div>
|
|
112
|
-
)
|
|
113
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
forceSimulation,
|
|
3
|
-
forceManyBody,
|
|
4
|
-
forceCenter,
|
|
5
|
-
forceCollide,
|
|
6
|
-
forceLink,
|
|
7
|
-
type Simulation,
|
|
8
|
-
type SimulationNodeDatum,
|
|
9
|
-
type SimulationLinkDatum,
|
|
10
|
-
} from 'd3-force'
|
|
11
|
-
import { FORCE } from './constants'
|
|
12
|
-
|
|
13
|
-
export interface ForceNode extends SimulationNodeDatum {
|
|
14
|
-
id: string
|
|
15
|
-
type: 'po' | 'toolcall'
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface ForceLink extends SimulationLinkDatum<ForceNode> {
|
|
19
|
-
id: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export class ForceLayout {
|
|
23
|
-
private simulation: Simulation<ForceNode, ForceLink>
|
|
24
|
-
private nodes: ForceNode[] = []
|
|
25
|
-
private links: ForceLink[] = []
|
|
26
|
-
private dirty = false
|
|
27
|
-
|
|
28
|
-
constructor() {
|
|
29
|
-
this.simulation = forceSimulation<ForceNode, ForceLink>()
|
|
30
|
-
.alphaDecay(FORCE.alphaDecay)
|
|
31
|
-
.velocityDecay(FORCE.velocityDecay)
|
|
32
|
-
.force('charge', forceManyBody<ForceNode>().strength(FORCE.chargeStrength))
|
|
33
|
-
.force('center', forceCenter<ForceNode>(0, 0).strength(FORCE.centerStrength))
|
|
34
|
-
.force(
|
|
35
|
-
'collision',
|
|
36
|
-
forceCollide<ForceNode>().radius(FORCE.collisionRadius)
|
|
37
|
-
)
|
|
38
|
-
.force(
|
|
39
|
-
'link',
|
|
40
|
-
forceLink<ForceNode, ForceLink>()
|
|
41
|
-
.id((d) => d.id)
|
|
42
|
-
.distance(FORCE.linkDistance)
|
|
43
|
-
)
|
|
44
|
-
.stop() // Manual tick mode — we call tick() from animation loop
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
addNode(id: string, type: 'po' | 'toolcall'): void {
|
|
48
|
-
if (this.nodes.find((n) => n.id === id)) return
|
|
49
|
-
this.nodes.push({ id, type })
|
|
50
|
-
this.dirty = true
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
removeNode(id: string): void {
|
|
54
|
-
const idx = this.nodes.findIndex((n) => n.id === id)
|
|
55
|
-
if (idx === -1) return
|
|
56
|
-
this.nodes.splice(idx, 1)
|
|
57
|
-
// Also remove any links referencing this node
|
|
58
|
-
this.links = this.links.filter((l) => {
|
|
59
|
-
const src = typeof l.source === 'object' ? (l.source as ForceNode).id : l.source
|
|
60
|
-
const tgt = typeof l.target === 'object' ? (l.target as ForceNode).id : l.target
|
|
61
|
-
return src !== id && tgt !== id
|
|
62
|
-
})
|
|
63
|
-
this.dirty = true
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
addLink(id: string, sourceId: string, targetId: string): void {
|
|
67
|
-
if (this.links.find((l) => l.id === id)) return
|
|
68
|
-
this.links.push({ id, source: sourceId, target: targetId })
|
|
69
|
-
this.dirty = true
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
removeLink(id: string): void {
|
|
73
|
-
const idx = this.links.findIndex((l) => l.id === id)
|
|
74
|
-
if (idx === -1) return
|
|
75
|
-
this.links.splice(idx, 1)
|
|
76
|
-
this.dirty = true
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
tick(): void {
|
|
80
|
-
if (this.dirty) {
|
|
81
|
-
this.rebuild()
|
|
82
|
-
this.dirty = false
|
|
83
|
-
}
|
|
84
|
-
this.simulation.tick()
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
getPositions(): Map<string, { x: number; y: number }> {
|
|
88
|
-
const positions = new Map<string, { x: number; y: number }>()
|
|
89
|
-
for (const node of this.nodes) {
|
|
90
|
-
positions.set(node.id, { x: node.x ?? 0, y: node.y ?? 0 })
|
|
91
|
-
}
|
|
92
|
-
return positions
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
reheat(): void {
|
|
96
|
-
this.simulation.alpha(0.8).restart().stop()
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
private rebuild(): void {
|
|
100
|
-
this.simulation.nodes(this.nodes)
|
|
101
|
-
const linkForce = this.simulation.force('link') as ReturnType<
|
|
102
|
-
typeof forceLink<ForceNode, ForceLink>
|
|
103
|
-
>
|
|
104
|
-
if (linkForce) {
|
|
105
|
-
linkForce.links(this.links)
|
|
106
|
-
}
|
|
107
|
-
this.reheat()
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
dispose(): void {
|
|
111
|
-
this.simulation.stop()
|
|
112
|
-
this.nodes = []
|
|
113
|
-
this.links = []
|
|
114
|
-
}
|
|
115
|
-
}
|