crca 1.4.0__py3-none-any.whl
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.
- .github/ISSUE_TEMPLATE/bug_report.md +65 -0
- .github/ISSUE_TEMPLATE/feature_request.md +41 -0
- .github/PULL_REQUEST_TEMPLATE.md +20 -0
- .github/workflows/publish-manual.yml +61 -0
- .github/workflows/publish.yml +64 -0
- .gitignore +214 -0
- CRCA.py +4156 -0
- LICENSE +201 -0
- MANIFEST.in +43 -0
- PKG-INFO +5035 -0
- README.md +4959 -0
- __init__.py +17 -0
- branches/CRCA-Q.py +2728 -0
- branches/crca_cg/corposwarm.py +9065 -0
- branches/crca_cg/fix_rancher_docker_creds.ps1 +155 -0
- branches/crca_cg/package.json +5 -0
- branches/crca_cg/test_bolt_integration.py +446 -0
- branches/crca_cg/test_corposwarm_comprehensive.py +773 -0
- branches/crca_cg/test_new_features.py +163 -0
- branches/crca_sd/__init__.py +149 -0
- branches/crca_sd/crca_sd_core.py +770 -0
- branches/crca_sd/crca_sd_governance.py +1325 -0
- branches/crca_sd/crca_sd_mpc.py +1130 -0
- branches/crca_sd/crca_sd_realtime.py +1844 -0
- branches/crca_sd/crca_sd_tui.py +1133 -0
- crca-1.4.0.dist-info/METADATA +5035 -0
- crca-1.4.0.dist-info/RECORD +501 -0
- crca-1.4.0.dist-info/WHEEL +4 -0
- crca-1.4.0.dist-info/licenses/LICENSE +201 -0
- docs/CRCA-Q.md +2333 -0
- examples/config.yaml.example +25 -0
- examples/crca_sd_example.py +513 -0
- examples/data_broker_example.py +294 -0
- examples/logistics_corporation.py +861 -0
- examples/palantir_example.py +299 -0
- examples/policy_bench.py +934 -0
- examples/pridnestrovia-sd.py +705 -0
- examples/pridnestrovia_realtime.py +1902 -0
- prompts/__init__.py +10 -0
- prompts/default_crca.py +101 -0
- pyproject.toml +151 -0
- requirements.txt +76 -0
- schemas/__init__.py +43 -0
- schemas/mcpSchemas.py +51 -0
- schemas/policy.py +458 -0
- templates/__init__.py +38 -0
- templates/base_specialized_agent.py +195 -0
- templates/drift_detection.py +325 -0
- templates/examples/causal_agent_template.py +309 -0
- templates/examples/drag_drop_example.py +213 -0
- templates/examples/logistics_agent_template.py +207 -0
- templates/examples/trading_agent_template.py +206 -0
- templates/feature_mixins.py +253 -0
- templates/graph_management.py +442 -0
- templates/llm_integration.py +194 -0
- templates/module_registry.py +276 -0
- templates/mpc_planner.py +280 -0
- templates/policy_loop.py +1168 -0
- templates/prediction_framework.py +448 -0
- templates/statistical_methods.py +778 -0
- tests/sanity.yml +31 -0
- tests/sanity_check +406 -0
- tests/test_core.py +47 -0
- tests/test_crca_excel.py +166 -0
- tests/test_crca_sd.py +780 -0
- tests/test_data_broker.py +424 -0
- tests/test_palantir.py +349 -0
- tools/__init__.py +38 -0
- tools/actuators.py +437 -0
- tools/bolt.diy/Dockerfile +103 -0
- tools/bolt.diy/app/components/@settings/core/AvatarDropdown.tsx +175 -0
- tools/bolt.diy/app/components/@settings/core/ControlPanel.tsx +345 -0
- tools/bolt.diy/app/components/@settings/core/constants.tsx +108 -0
- tools/bolt.diy/app/components/@settings/core/types.ts +114 -0
- tools/bolt.diy/app/components/@settings/index.ts +12 -0
- tools/bolt.diy/app/components/@settings/shared/components/TabTile.tsx +151 -0
- tools/bolt.diy/app/components/@settings/shared/service-integration/ConnectionForm.tsx +193 -0
- tools/bolt.diy/app/components/@settings/shared/service-integration/ConnectionTestIndicator.tsx +60 -0
- tools/bolt.diy/app/components/@settings/shared/service-integration/ErrorState.tsx +102 -0
- tools/bolt.diy/app/components/@settings/shared/service-integration/LoadingState.tsx +94 -0
- tools/bolt.diy/app/components/@settings/shared/service-integration/ServiceHeader.tsx +72 -0
- tools/bolt.diy/app/components/@settings/shared/service-integration/index.ts +6 -0
- tools/bolt.diy/app/components/@settings/tabs/data/DataTab.tsx +721 -0
- tools/bolt.diy/app/components/@settings/tabs/data/DataVisualization.tsx +384 -0
- tools/bolt.diy/app/components/@settings/tabs/event-logs/EventLogsTab.tsx +1013 -0
- tools/bolt.diy/app/components/@settings/tabs/features/FeaturesTab.tsx +295 -0
- tools/bolt.diy/app/components/@settings/tabs/github/GitHubTab.tsx +281 -0
- tools/bolt.diy/app/components/@settings/tabs/github/components/GitHubAuthDialog.tsx +173 -0
- tools/bolt.diy/app/components/@settings/tabs/github/components/GitHubCacheManager.tsx +367 -0
- tools/bolt.diy/app/components/@settings/tabs/github/components/GitHubConnection.tsx +233 -0
- tools/bolt.diy/app/components/@settings/tabs/github/components/GitHubErrorBoundary.tsx +105 -0
- tools/bolt.diy/app/components/@settings/tabs/github/components/GitHubProgressiveLoader.tsx +266 -0
- tools/bolt.diy/app/components/@settings/tabs/github/components/GitHubRepositoryCard.tsx +121 -0
- tools/bolt.diy/app/components/@settings/tabs/github/components/GitHubRepositorySelector.tsx +312 -0
- tools/bolt.diy/app/components/@settings/tabs/github/components/GitHubStats.tsx +291 -0
- tools/bolt.diy/app/components/@settings/tabs/github/components/GitHubUserProfile.tsx +46 -0
- tools/bolt.diy/app/components/@settings/tabs/github/components/shared/GitHubStateIndicators.tsx +264 -0
- tools/bolt.diy/app/components/@settings/tabs/github/components/shared/RepositoryCard.tsx +361 -0
- tools/bolt.diy/app/components/@settings/tabs/github/components/shared/index.ts +11 -0
- tools/bolt.diy/app/components/@settings/tabs/gitlab/GitLabTab.tsx +305 -0
- tools/bolt.diy/app/components/@settings/tabs/gitlab/components/GitLabAuthDialog.tsx +186 -0
- tools/bolt.diy/app/components/@settings/tabs/gitlab/components/GitLabConnection.tsx +253 -0
- tools/bolt.diy/app/components/@settings/tabs/gitlab/components/GitLabRepositorySelector.tsx +358 -0
- tools/bolt.diy/app/components/@settings/tabs/gitlab/components/RepositoryCard.tsx +79 -0
- tools/bolt.diy/app/components/@settings/tabs/gitlab/components/RepositoryList.tsx +142 -0
- tools/bolt.diy/app/components/@settings/tabs/gitlab/components/StatsDisplay.tsx +91 -0
- tools/bolt.diy/app/components/@settings/tabs/gitlab/components/index.ts +4 -0
- tools/bolt.diy/app/components/@settings/tabs/mcp/McpServerList.tsx +99 -0
- tools/bolt.diy/app/components/@settings/tabs/mcp/McpServerListItem.tsx +70 -0
- tools/bolt.diy/app/components/@settings/tabs/mcp/McpStatusBadge.tsx +37 -0
- tools/bolt.diy/app/components/@settings/tabs/mcp/McpTab.tsx +239 -0
- tools/bolt.diy/app/components/@settings/tabs/netlify/NetlifyTab.tsx +1393 -0
- tools/bolt.diy/app/components/@settings/tabs/netlify/components/NetlifyConnection.tsx +990 -0
- tools/bolt.diy/app/components/@settings/tabs/netlify/components/index.ts +1 -0
- tools/bolt.diy/app/components/@settings/tabs/notifications/NotificationsTab.tsx +300 -0
- tools/bolt.diy/app/components/@settings/tabs/profile/ProfileTab.tsx +181 -0
- tools/bolt.diy/app/components/@settings/tabs/providers/cloud/CloudProvidersTab.tsx +308 -0
- tools/bolt.diy/app/components/@settings/tabs/providers/local/ErrorBoundary.tsx +68 -0
- tools/bolt.diy/app/components/@settings/tabs/providers/local/HealthStatusBadge.tsx +64 -0
- tools/bolt.diy/app/components/@settings/tabs/providers/local/LoadingSkeleton.tsx +107 -0
- tools/bolt.diy/app/components/@settings/tabs/providers/local/LocalProvidersTab.tsx +556 -0
- tools/bolt.diy/app/components/@settings/tabs/providers/local/ModelCard.tsx +106 -0
- tools/bolt.diy/app/components/@settings/tabs/providers/local/ProviderCard.tsx +120 -0
- tools/bolt.diy/app/components/@settings/tabs/providers/local/SetupGuide.tsx +671 -0
- tools/bolt.diy/app/components/@settings/tabs/providers/local/StatusDashboard.tsx +91 -0
- tools/bolt.diy/app/components/@settings/tabs/providers/local/types.ts +44 -0
- tools/bolt.diy/app/components/@settings/tabs/settings/SettingsTab.tsx +215 -0
- tools/bolt.diy/app/components/@settings/tabs/supabase/SupabaseTab.tsx +1089 -0
- tools/bolt.diy/app/components/@settings/tabs/vercel/VercelTab.tsx +909 -0
- tools/bolt.diy/app/components/@settings/tabs/vercel/components/VercelConnection.tsx +368 -0
- tools/bolt.diy/app/components/@settings/tabs/vercel/components/index.ts +1 -0
- tools/bolt.diy/app/components/@settings/utils/tab-helpers.ts +54 -0
- tools/bolt.diy/app/components/chat/APIKeyManager.tsx +169 -0
- tools/bolt.diy/app/components/chat/Artifact.tsx +296 -0
- tools/bolt.diy/app/components/chat/AssistantMessage.tsx +192 -0
- tools/bolt.diy/app/components/chat/BaseChat.module.scss +47 -0
- tools/bolt.diy/app/components/chat/BaseChat.tsx +522 -0
- tools/bolt.diy/app/components/chat/Chat.client.tsx +670 -0
- tools/bolt.diy/app/components/chat/ChatAlert.tsx +108 -0
- tools/bolt.diy/app/components/chat/ChatBox.tsx +334 -0
- tools/bolt.diy/app/components/chat/CodeBlock.module.scss +10 -0
- tools/bolt.diy/app/components/chat/CodeBlock.tsx +85 -0
- tools/bolt.diy/app/components/chat/DicussMode.tsx +17 -0
- tools/bolt.diy/app/components/chat/ExamplePrompts.tsx +37 -0
- tools/bolt.diy/app/components/chat/FilePreview.tsx +38 -0
- tools/bolt.diy/app/components/chat/GitCloneButton.tsx +327 -0
- tools/bolt.diy/app/components/chat/ImportFolderButton.tsx +141 -0
- tools/bolt.diy/app/components/chat/LLMApiAlert.tsx +109 -0
- tools/bolt.diy/app/components/chat/MCPTools.tsx +129 -0
- tools/bolt.diy/app/components/chat/Markdown.module.scss +171 -0
- tools/bolt.diy/app/components/chat/Markdown.spec.ts +48 -0
- tools/bolt.diy/app/components/chat/Markdown.tsx +252 -0
- tools/bolt.diy/app/components/chat/Messages.client.tsx +102 -0
- tools/bolt.diy/app/components/chat/ModelSelector.tsx +797 -0
- tools/bolt.diy/app/components/chat/NetlifyDeploymentLink.client.tsx +51 -0
- tools/bolt.diy/app/components/chat/ProgressCompilation.tsx +110 -0
- tools/bolt.diy/app/components/chat/ScreenshotStateManager.tsx +33 -0
- tools/bolt.diy/app/components/chat/SendButton.client.tsx +39 -0
- tools/bolt.diy/app/components/chat/SpeechRecognition.tsx +28 -0
- tools/bolt.diy/app/components/chat/StarterTemplates.tsx +38 -0
- tools/bolt.diy/app/components/chat/SupabaseAlert.tsx +199 -0
- tools/bolt.diy/app/components/chat/SupabaseConnection.tsx +339 -0
- tools/bolt.diy/app/components/chat/ThoughtBox.tsx +43 -0
- tools/bolt.diy/app/components/chat/ToolInvocations.tsx +409 -0
- tools/bolt.diy/app/components/chat/UserMessage.tsx +101 -0
- tools/bolt.diy/app/components/chat/VercelDeploymentLink.client.tsx +158 -0
- tools/bolt.diy/app/components/chat/chatExportAndImport/ExportChatButton.tsx +49 -0
- tools/bolt.diy/app/components/chat/chatExportAndImport/ImportButtons.tsx +96 -0
- tools/bolt.diy/app/components/deploy/DeployAlert.tsx +197 -0
- tools/bolt.diy/app/components/deploy/DeployButton.tsx +277 -0
- tools/bolt.diy/app/components/deploy/GitHubDeploy.client.tsx +171 -0
- tools/bolt.diy/app/components/deploy/GitHubDeploymentDialog.tsx +1041 -0
- tools/bolt.diy/app/components/deploy/GitLabDeploy.client.tsx +171 -0
- tools/bolt.diy/app/components/deploy/GitLabDeploymentDialog.tsx +764 -0
- tools/bolt.diy/app/components/deploy/NetlifyDeploy.client.tsx +246 -0
- tools/bolt.diy/app/components/deploy/VercelDeploy.client.tsx +235 -0
- tools/bolt.diy/app/components/editor/codemirror/BinaryContent.tsx +7 -0
- tools/bolt.diy/app/components/editor/codemirror/CodeMirrorEditor.tsx +555 -0
- tools/bolt.diy/app/components/editor/codemirror/EnvMasking.ts +80 -0
- tools/bolt.diy/app/components/editor/codemirror/cm-theme.ts +192 -0
- tools/bolt.diy/app/components/editor/codemirror/indent.ts +68 -0
- tools/bolt.diy/app/components/editor/codemirror/languages.ts +112 -0
- tools/bolt.diy/app/components/git/GitUrlImport.client.tsx +147 -0
- tools/bolt.diy/app/components/header/Header.tsx +42 -0
- tools/bolt.diy/app/components/header/HeaderActionButtons.client.tsx +54 -0
- tools/bolt.diy/app/components/mandate/MandateSubmission.tsx +167 -0
- tools/bolt.diy/app/components/observability/DeploymentStatus.tsx +168 -0
- tools/bolt.diy/app/components/observability/EventTimeline.tsx +119 -0
- tools/bolt.diy/app/components/observability/FileDiffViewer.tsx +121 -0
- tools/bolt.diy/app/components/observability/GovernanceStatus.tsx +197 -0
- tools/bolt.diy/app/components/observability/GovernorMetrics.tsx +246 -0
- tools/bolt.diy/app/components/observability/LogStream.tsx +244 -0
- tools/bolt.diy/app/components/observability/MandateDetails.tsx +201 -0
- tools/bolt.diy/app/components/observability/ObservabilityDashboard.tsx +200 -0
- tools/bolt.diy/app/components/sidebar/HistoryItem.tsx +187 -0
- tools/bolt.diy/app/components/sidebar/Menu.client.tsx +536 -0
- tools/bolt.diy/app/components/sidebar/date-binning.ts +59 -0
- tools/bolt.diy/app/components/txt +1 -0
- tools/bolt.diy/app/components/ui/BackgroundRays/index.tsx +18 -0
- tools/bolt.diy/app/components/ui/BackgroundRays/styles.module.scss +246 -0
- tools/bolt.diy/app/components/ui/Badge.tsx +53 -0
- tools/bolt.diy/app/components/ui/BranchSelector.tsx +270 -0
- tools/bolt.diy/app/components/ui/Breadcrumbs.tsx +101 -0
- tools/bolt.diy/app/components/ui/Button.tsx +46 -0
- tools/bolt.diy/app/components/ui/Card.tsx +55 -0
- tools/bolt.diy/app/components/ui/Checkbox.tsx +32 -0
- tools/bolt.diy/app/components/ui/CloseButton.tsx +49 -0
- tools/bolt.diy/app/components/ui/CodeBlock.tsx +103 -0
- tools/bolt.diy/app/components/ui/Collapsible.tsx +9 -0
- tools/bolt.diy/app/components/ui/ColorSchemeDialog.tsx +378 -0
- tools/bolt.diy/app/components/ui/Dialog.tsx +449 -0
- tools/bolt.diy/app/components/ui/Dropdown.tsx +63 -0
- tools/bolt.diy/app/components/ui/EmptyState.tsx +154 -0
- tools/bolt.diy/app/components/ui/FileIcon.tsx +346 -0
- tools/bolt.diy/app/components/ui/FilterChip.tsx +92 -0
- tools/bolt.diy/app/components/ui/GlowingEffect.tsx +192 -0
- tools/bolt.diy/app/components/ui/GradientCard.tsx +100 -0
- tools/bolt.diy/app/components/ui/IconButton.tsx +84 -0
- tools/bolt.diy/app/components/ui/Input.tsx +22 -0
- tools/bolt.diy/app/components/ui/Label.tsx +20 -0
- tools/bolt.diy/app/components/ui/LoadingDots.tsx +27 -0
- tools/bolt.diy/app/components/ui/LoadingOverlay.tsx +32 -0
- tools/bolt.diy/app/components/ui/PanelHeader.tsx +20 -0
- tools/bolt.diy/app/components/ui/PanelHeaderButton.tsx +36 -0
- tools/bolt.diy/app/components/ui/Popover.tsx +29 -0
- tools/bolt.diy/app/components/ui/Progress.tsx +22 -0
- tools/bolt.diy/app/components/ui/RepositoryStats.tsx +87 -0
- tools/bolt.diy/app/components/ui/ScrollArea.tsx +41 -0
- tools/bolt.diy/app/components/ui/SearchInput.tsx +80 -0
- tools/bolt.diy/app/components/ui/SearchResultItem.tsx +134 -0
- tools/bolt.diy/app/components/ui/Separator.tsx +22 -0
- tools/bolt.diy/app/components/ui/SettingsButton.tsx +35 -0
- tools/bolt.diy/app/components/ui/Slider.tsx +73 -0
- tools/bolt.diy/app/components/ui/StatusIndicator.tsx +90 -0
- tools/bolt.diy/app/components/ui/Switch.tsx +37 -0
- tools/bolt.diy/app/components/ui/Tabs.tsx +52 -0
- tools/bolt.diy/app/components/ui/TabsWithSlider.tsx +112 -0
- tools/bolt.diy/app/components/ui/ThemeSwitch.tsx +29 -0
- tools/bolt.diy/app/components/ui/Tooltip.tsx +122 -0
- tools/bolt.diy/app/components/ui/index.ts +38 -0
- tools/bolt.diy/app/components/ui/use-toast.ts +66 -0
- tools/bolt.diy/app/components/workbench/DiffView.tsx +796 -0
- tools/bolt.diy/app/components/workbench/EditorPanel.tsx +174 -0
- tools/bolt.diy/app/components/workbench/ExpoQrModal.tsx +55 -0
- tools/bolt.diy/app/components/workbench/FileBreadcrumb.tsx +150 -0
- tools/bolt.diy/app/components/workbench/FileTree.tsx +565 -0
- tools/bolt.diy/app/components/workbench/Inspector.tsx +126 -0
- tools/bolt.diy/app/components/workbench/InspectorPanel.tsx +146 -0
- tools/bolt.diy/app/components/workbench/LockManager.tsx +262 -0
- tools/bolt.diy/app/components/workbench/PortDropdown.tsx +91 -0
- tools/bolt.diy/app/components/workbench/Preview.tsx +1049 -0
- tools/bolt.diy/app/components/workbench/ScreenshotSelector.tsx +293 -0
- tools/bolt.diy/app/components/workbench/Search.tsx +257 -0
- tools/bolt.diy/app/components/workbench/Workbench.client.tsx +506 -0
- tools/bolt.diy/app/components/workbench/terminal/Terminal.tsx +131 -0
- tools/bolt.diy/app/components/workbench/terminal/TerminalManager.tsx +68 -0
- tools/bolt.diy/app/components/workbench/terminal/TerminalTabs.tsx +277 -0
- tools/bolt.diy/app/components/workbench/terminal/theme.ts +36 -0
- tools/bolt.diy/app/components/workflow/WorkflowPhase.tsx +109 -0
- tools/bolt.diy/app/components/workflow/WorkflowStatus.tsx +60 -0
- tools/bolt.diy/app/components/workflow/WorkflowTimeline.tsx +150 -0
- tools/bolt.diy/app/entry.client.tsx +7 -0
- tools/bolt.diy/app/entry.server.tsx +80 -0
- tools/bolt.diy/app/root.tsx +156 -0
- tools/bolt.diy/app/routes/_index.tsx +175 -0
- tools/bolt.diy/app/routes/api.bug-report.ts +254 -0
- tools/bolt.diy/app/routes/api.chat.ts +463 -0
- tools/bolt.diy/app/routes/api.check-env-key.ts +41 -0
- tools/bolt.diy/app/routes/api.configured-providers.ts +110 -0
- tools/bolt.diy/app/routes/api.corporate-swarm-status.ts +55 -0
- tools/bolt.diy/app/routes/api.enhancer.ts +137 -0
- tools/bolt.diy/app/routes/api.export-api-keys.ts +44 -0
- tools/bolt.diy/app/routes/api.git-info.ts +69 -0
- tools/bolt.diy/app/routes/api.git-proxy.$.ts +178 -0
- tools/bolt.diy/app/routes/api.github-branches.ts +166 -0
- tools/bolt.diy/app/routes/api.github-deploy.ts +67 -0
- tools/bolt.diy/app/routes/api.github-stats.ts +198 -0
- tools/bolt.diy/app/routes/api.github-template.ts +242 -0
- tools/bolt.diy/app/routes/api.github-user.ts +287 -0
- tools/bolt.diy/app/routes/api.gitlab-branches.ts +143 -0
- tools/bolt.diy/app/routes/api.gitlab-deploy.ts +67 -0
- tools/bolt.diy/app/routes/api.gitlab-projects.ts +105 -0
- tools/bolt.diy/app/routes/api.health.ts +8 -0
- tools/bolt.diy/app/routes/api.llmcall.ts +298 -0
- tools/bolt.diy/app/routes/api.mandate.ts +351 -0
- tools/bolt.diy/app/routes/api.mcp-check.ts +16 -0
- tools/bolt.diy/app/routes/api.mcp-update-config.ts +23 -0
- tools/bolt.diy/app/routes/api.models.$provider.ts +2 -0
- tools/bolt.diy/app/routes/api.models.ts +90 -0
- tools/bolt.diy/app/routes/api.netlify-deploy.ts +240 -0
- tools/bolt.diy/app/routes/api.netlify-user.ts +142 -0
- tools/bolt.diy/app/routes/api.supabase-user.ts +199 -0
- tools/bolt.diy/app/routes/api.supabase.query.ts +92 -0
- tools/bolt.diy/app/routes/api.supabase.ts +56 -0
- tools/bolt.diy/app/routes/api.supabase.variables.ts +32 -0
- tools/bolt.diy/app/routes/api.system.diagnostics.ts +142 -0
- tools/bolt.diy/app/routes/api.system.disk-info.ts +311 -0
- tools/bolt.diy/app/routes/api.system.git-info.ts +332 -0
- tools/bolt.diy/app/routes/api.update.ts +21 -0
- tools/bolt.diy/app/routes/api.vercel-deploy.ts +497 -0
- tools/bolt.diy/app/routes/api.vercel-user.ts +161 -0
- tools/bolt.diy/app/routes/api.workflow-status.$proposalId.ts +309 -0
- tools/bolt.diy/app/routes/chat.$id.tsx +8 -0
- tools/bolt.diy/app/routes/execute.$mandateId.tsx +432 -0
- tools/bolt.diy/app/routes/git.tsx +25 -0
- tools/bolt.diy/app/routes/observability.$mandateId.tsx +50 -0
- tools/bolt.diy/app/routes/webcontainer.connect.$id.tsx +32 -0
- tools/bolt.diy/app/routes/webcontainer.preview.$id.tsx +97 -0
- tools/bolt.diy/app/routes/workflow.$proposalId.tsx +170 -0
- tools/bolt.diy/app/styles/animations.scss +49 -0
- tools/bolt.diy/app/styles/components/code.scss +9 -0
- tools/bolt.diy/app/styles/components/editor.scss +135 -0
- tools/bolt.diy/app/styles/components/resize-handle.scss +30 -0
- tools/bolt.diy/app/styles/components/terminal.scss +3 -0
- tools/bolt.diy/app/styles/components/toast.scss +23 -0
- tools/bolt.diy/app/styles/diff-view.css +72 -0
- tools/bolt.diy/app/styles/index.scss +73 -0
- tools/bolt.diy/app/styles/variables.scss +255 -0
- tools/bolt.diy/app/styles/z-index.scss +37 -0
- tools/bolt.diy/app/types/GitHub.ts +182 -0
- tools/bolt.diy/app/types/GitLab.ts +103 -0
- tools/bolt.diy/app/types/actions.ts +85 -0
- tools/bolt.diy/app/types/artifact.ts +5 -0
- tools/bolt.diy/app/types/context.ts +26 -0
- tools/bolt.diy/app/types/design-scheme.ts +93 -0
- tools/bolt.diy/app/types/global.d.ts +13 -0
- tools/bolt.diy/app/types/mandate.ts +333 -0
- tools/bolt.diy/app/types/model.ts +25 -0
- tools/bolt.diy/app/types/netlify.ts +94 -0
- tools/bolt.diy/app/types/supabase.ts +54 -0
- tools/bolt.diy/app/types/template.ts +8 -0
- tools/bolt.diy/app/types/terminal.ts +9 -0
- tools/bolt.diy/app/types/theme.ts +1 -0
- tools/bolt.diy/app/types/vercel.ts +67 -0
- tools/bolt.diy/app/utils/buffer.ts +29 -0
- tools/bolt.diy/app/utils/classNames.ts +65 -0
- tools/bolt.diy/app/utils/constants.ts +147 -0
- tools/bolt.diy/app/utils/debounce.ts +13 -0
- tools/bolt.diy/app/utils/debugLogger.ts +1284 -0
- tools/bolt.diy/app/utils/diff.spec.ts +11 -0
- tools/bolt.diy/app/utils/diff.ts +117 -0
- tools/bolt.diy/app/utils/easings.ts +3 -0
- tools/bolt.diy/app/utils/fileLocks.ts +96 -0
- tools/bolt.diy/app/utils/fileUtils.ts +121 -0
- tools/bolt.diy/app/utils/folderImport.ts +73 -0
- tools/bolt.diy/app/utils/formatSize.ts +12 -0
- tools/bolt.diy/app/utils/getLanguageFromExtension.ts +24 -0
- tools/bolt.diy/app/utils/githubStats.ts +9 -0
- tools/bolt.diy/app/utils/gitlabStats.ts +54 -0
- tools/bolt.diy/app/utils/logger.ts +162 -0
- tools/bolt.diy/app/utils/markdown.ts +155 -0
- tools/bolt.diy/app/utils/mobile.ts +4 -0
- tools/bolt.diy/app/utils/os.ts +4 -0
- tools/bolt.diy/app/utils/path.ts +19 -0
- tools/bolt.diy/app/utils/projectCommands.ts +197 -0
- tools/bolt.diy/app/utils/promises.ts +19 -0
- tools/bolt.diy/app/utils/react.ts +6 -0
- tools/bolt.diy/app/utils/sampler.ts +49 -0
- tools/bolt.diy/app/utils/selectStarterTemplate.ts +255 -0
- tools/bolt.diy/app/utils/shell.ts +384 -0
- tools/bolt.diy/app/utils/stacktrace.ts +27 -0
- tools/bolt.diy/app/utils/stripIndent.ts +23 -0
- tools/bolt.diy/app/utils/terminal.ts +11 -0
- tools/bolt.diy/app/utils/unreachable.ts +3 -0
- tools/bolt.diy/app/vite-env.d.ts +2 -0
- tools/bolt.diy/assets/entitlements.mac.plist +25 -0
- tools/bolt.diy/assets/icons/icon.icns +0 -0
- tools/bolt.diy/assets/icons/icon.ico +0 -0
- tools/bolt.diy/assets/icons/icon.png +0 -0
- tools/bolt.diy/bindings.js +78 -0
- tools/bolt.diy/bindings.sh +33 -0
- tools/bolt.diy/docker-compose.yaml +145 -0
- tools/bolt.diy/electron/main/index.ts +201 -0
- tools/bolt.diy/electron/main/tsconfig.json +30 -0
- tools/bolt.diy/electron/main/ui/menu.ts +29 -0
- tools/bolt.diy/electron/main/ui/window.ts +54 -0
- tools/bolt.diy/electron/main/utils/auto-update.ts +110 -0
- tools/bolt.diy/electron/main/utils/constants.ts +4 -0
- tools/bolt.diy/electron/main/utils/cookie.ts +40 -0
- tools/bolt.diy/electron/main/utils/reload.ts +35 -0
- tools/bolt.diy/electron/main/utils/serve.ts +71 -0
- tools/bolt.diy/electron/main/utils/store.ts +3 -0
- tools/bolt.diy/electron/main/utils/vite-server.ts +44 -0
- tools/bolt.diy/electron/main/vite.config.ts +44 -0
- tools/bolt.diy/electron/preload/index.ts +22 -0
- tools/bolt.diy/electron/preload/tsconfig.json +7 -0
- tools/bolt.diy/electron/preload/vite.config.ts +31 -0
- tools/bolt.diy/electron-builder.yml +64 -0
- tools/bolt.diy/electron-update.yml +4 -0
- tools/bolt.diy/eslint.config.mjs +57 -0
- tools/bolt.diy/functions/[[path]].ts +12 -0
- tools/bolt.diy/icons/angular.svg +1 -0
- tools/bolt.diy/icons/astro.svg +8 -0
- tools/bolt.diy/icons/chat.svg +1 -0
- tools/bolt.diy/icons/expo-brand.svg +1 -0
- tools/bolt.diy/icons/expo.svg +4 -0
- tools/bolt.diy/icons/logo-text.svg +1 -0
- tools/bolt.diy/icons/logo.svg +4 -0
- tools/bolt.diy/icons/mcp.svg +1 -0
- tools/bolt.diy/icons/nativescript.svg +1 -0
- tools/bolt.diy/icons/netlify.svg +10 -0
- tools/bolt.diy/icons/nextjs.svg +1 -0
- tools/bolt.diy/icons/nuxt.svg +1 -0
- tools/bolt.diy/icons/qwik.svg +1 -0
- tools/bolt.diy/icons/react.svg +1 -0
- tools/bolt.diy/icons/remix.svg +24 -0
- tools/bolt.diy/icons/remotion.svg +1 -0
- tools/bolt.diy/icons/shadcn.svg +21 -0
- tools/bolt.diy/icons/slidev.svg +60 -0
- tools/bolt.diy/icons/solidjs.svg +1 -0
- tools/bolt.diy/icons/stars.svg +1 -0
- tools/bolt.diy/icons/svelte.svg +1 -0
- tools/bolt.diy/icons/typescript.svg +1 -0
- tools/bolt.diy/icons/vite.svg +1 -0
- tools/bolt.diy/icons/vue.svg +1 -0
- tools/bolt.diy/load-context.ts +9 -0
- tools/bolt.diy/notarize.cjs +31 -0
- tools/bolt.diy/package.json +218 -0
- tools/bolt.diy/playwright.config.preview.ts +35 -0
- tools/bolt.diy/pre-start.cjs +26 -0
- tools/bolt.diy/public/apple-touch-icon-precomposed.png +0 -0
- tools/bolt.diy/public/apple-touch-icon.png +0 -0
- tools/bolt.diy/public/favicon.ico +0 -0
- tools/bolt.diy/public/favicon.svg +4 -0
- tools/bolt.diy/public/icons/AmazonBedrock.svg +1 -0
- tools/bolt.diy/public/icons/Anthropic.svg +4 -0
- tools/bolt.diy/public/icons/Cohere.svg +4 -0
- tools/bolt.diy/public/icons/Deepseek.svg +5 -0
- tools/bolt.diy/public/icons/Default.svg +4 -0
- tools/bolt.diy/public/icons/Google.svg +4 -0
- tools/bolt.diy/public/icons/Groq.svg +4 -0
- tools/bolt.diy/public/icons/HuggingFace.svg +4 -0
- tools/bolt.diy/public/icons/Hyperbolic.svg +3 -0
- tools/bolt.diy/public/icons/LMStudio.svg +5 -0
- tools/bolt.diy/public/icons/Mistral.svg +4 -0
- tools/bolt.diy/public/icons/Ollama.svg +4 -0
- tools/bolt.diy/public/icons/OpenAI.svg +4 -0
- tools/bolt.diy/public/icons/OpenAILike.svg +4 -0
- tools/bolt.diy/public/icons/OpenRouter.svg +4 -0
- tools/bolt.diy/public/icons/Perplexity.svg +4 -0
- tools/bolt.diy/public/icons/Together.svg +4 -0
- tools/bolt.diy/public/icons/xAI.svg +5 -0
- tools/bolt.diy/public/inspector-script.js +292 -0
- tools/bolt.diy/public/logo-dark-styled.png +0 -0
- tools/bolt.diy/public/logo-dark.png +0 -0
- tools/bolt.diy/public/logo-light-styled.png +0 -0
- tools/bolt.diy/public/logo-light.png +0 -0
- tools/bolt.diy/public/logo.svg +15 -0
- tools/bolt.diy/public/social_preview_index.jpg +0 -0
- tools/bolt.diy/scripts/clean.js +45 -0
- tools/bolt.diy/scripts/electron-dev.mjs +181 -0
- tools/bolt.diy/scripts/setup-env.sh +41 -0
- tools/bolt.diy/scripts/update-imports.sh +7 -0
- tools/bolt.diy/scripts/update.sh +52 -0
- tools/bolt.diy/services/execution-governor/Dockerfile +41 -0
- tools/bolt.diy/services/execution-governor/config.ts +42 -0
- tools/bolt.diy/services/execution-governor/index.ts +683 -0
- tools/bolt.diy/services/execution-governor/metrics.ts +141 -0
- tools/bolt.diy/services/execution-governor/package.json +31 -0
- tools/bolt.diy/services/execution-governor/priority-queue.ts +139 -0
- tools/bolt.diy/services/execution-governor/tsconfig.json +21 -0
- tools/bolt.diy/services/execution-governor/types.ts +145 -0
- tools/bolt.diy/services/headless-executor/Dockerfile +43 -0
- tools/bolt.diy/services/headless-executor/executor.ts +210 -0
- tools/bolt.diy/services/headless-executor/index.ts +323 -0
- tools/bolt.diy/services/headless-executor/package.json +27 -0
- tools/bolt.diy/services/headless-executor/tsconfig.json +21 -0
- tools/bolt.diy/services/headless-executor/types.ts +38 -0
- tools/bolt.diy/test-workflows.sh +240 -0
- tools/bolt.diy/tests/integration/corporate-swarm.test.ts +208 -0
- tools/bolt.diy/tests/mandates/budget-limited.json +34 -0
- tools/bolt.diy/tests/mandates/complex.json +53 -0
- tools/bolt.diy/tests/mandates/constraint-enforced.json +36 -0
- tools/bolt.diy/tests/mandates/simple.json +35 -0
- tools/bolt.diy/tsconfig.json +37 -0
- tools/bolt.diy/types/istextorbinary.d.ts +15 -0
- tools/bolt.diy/uno.config.ts +279 -0
- tools/bolt.diy/vite-electron.config.ts +76 -0
- tools/bolt.diy/vite.config.ts +112 -0
- tools/bolt.diy/worker-configuration.d.ts +22 -0
- tools/bolt.diy/wrangler.toml +6 -0
- tools/code_generator.py +461 -0
- tools/file_operations.py +465 -0
- tools/mandate_generator.py +337 -0
- tools/mcpClientUtils.py +1216 -0
- tools/sensors.py +285 -0
- utils/Agent_types.py +15 -0
- utils/AnyToStr.py +0 -0
- utils/HHCS.py +277 -0
- utils/__init__.py +30 -0
- utils/agent.py +3627 -0
- utils/aop.py +2948 -0
- utils/canonical.py +143 -0
- utils/conversation.py +1195 -0
- utils/doctrine_versioning +230 -0
- utils/formatter.py +474 -0
- utils/ledger.py +311 -0
- utils/out_types.py +16 -0
- utils/rollback.py +339 -0
- utils/router.py +929 -0
- utils/tui.py +1908 -0
|
@@ -0,0 +1,861 @@
|
|
|
1
|
+
"""
|
|
2
|
+
UAB Leiliona - Comprehensive Autonomous Logistics Corporation
|
|
3
|
+
|
|
4
|
+
A complete example of a fully autonomous logistics company using CorporateSwarm.
|
|
5
|
+
|
|
6
|
+
This example demonstrates:
|
|
7
|
+
- Complete corporate governance structure for logistics operations
|
|
8
|
+
- Board of directors with logistics expertise
|
|
9
|
+
- Executive team managing operations, finance, technology
|
|
10
|
+
- Department structure (Operations, Finance, Technology, Legal, HR)
|
|
11
|
+
- Proposal system for strategic decisions
|
|
12
|
+
- Democratic voting on major initiatives
|
|
13
|
+
- Risk management for logistics operations
|
|
14
|
+
- ESG compliance and sustainability
|
|
15
|
+
- AOP integration for agent deployment
|
|
16
|
+
- Interactive TUI for management
|
|
17
|
+
- Real-world logistics tools and operations
|
|
18
|
+
|
|
19
|
+
Company: UAB Leiliona
|
|
20
|
+
Industry: Logistics and Supply Chain Management
|
|
21
|
+
Operations: Freight forwarding, warehousing, last-mile delivery, customs clearance
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
import os
|
|
25
|
+
import sys
|
|
26
|
+
import time
|
|
27
|
+
from typing import Dict, List, Optional, Any
|
|
28
|
+
from datetime import datetime, timedelta
|
|
29
|
+
from loguru import logger
|
|
30
|
+
|
|
31
|
+
# Add parent directory to path
|
|
32
|
+
_script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
33
|
+
_parent_dir = os.path.dirname(_script_dir)
|
|
34
|
+
if _parent_dir not in sys.path:
|
|
35
|
+
sys.path.insert(0, _parent_dir)
|
|
36
|
+
|
|
37
|
+
# Import CorporateSwarm
|
|
38
|
+
from crca_cg.corposwarm import (
|
|
39
|
+
CorporateSwarm,
|
|
40
|
+
CorporateRole,
|
|
41
|
+
DepartmentType,
|
|
42
|
+
ProposalType,
|
|
43
|
+
BoardCommitteeType,
|
|
44
|
+
MeetingType,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
# Import utilities
|
|
48
|
+
try:
|
|
49
|
+
from utils.tui import CorporateSwarmTUI
|
|
50
|
+
TUI_AVAILABLE = True
|
|
51
|
+
except ImportError:
|
|
52
|
+
TUI_AVAILABLE = False
|
|
53
|
+
logger.warning("TUI not available - install rich: pip install rich")
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class LogisticsTools:
|
|
57
|
+
"""
|
|
58
|
+
Tools for logistics operations.
|
|
59
|
+
|
|
60
|
+
These would typically integrate with:
|
|
61
|
+
- Transportation Management Systems (TMS)
|
|
62
|
+
- Warehouse Management Systems (WMS)
|
|
63
|
+
- Customs clearance APIs
|
|
64
|
+
- Carrier APIs (FedEx, UPS, DHL, etc.)
|
|
65
|
+
- Payment systems (including x402)
|
|
66
|
+
- Tracking systems
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
@staticmethod
|
|
70
|
+
def create_shipment(
|
|
71
|
+
origin: str,
|
|
72
|
+
destination: str,
|
|
73
|
+
weight: float,
|
|
74
|
+
dimensions: Dict[str, float],
|
|
75
|
+
service_type: str = "standard"
|
|
76
|
+
) -> Dict[str, Any]:
|
|
77
|
+
"""
|
|
78
|
+
Create a new shipment.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
origin: Origin address
|
|
82
|
+
destination: Destination address
|
|
83
|
+
weight: Weight in kg
|
|
84
|
+
dimensions: Dict with length, width, height in cm
|
|
85
|
+
service_type: Service type (standard, express, overnight)
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
Dict with shipment_id, tracking_number, estimated_cost, estimated_delivery
|
|
89
|
+
"""
|
|
90
|
+
shipment_id = f"SH{int(time.time())}"
|
|
91
|
+
tracking_number = f"LEI{shipment_id}"
|
|
92
|
+
|
|
93
|
+
# Simplified cost calculation
|
|
94
|
+
base_cost = 10.0
|
|
95
|
+
weight_cost = weight * 2.0
|
|
96
|
+
distance_cost = 0.5 # Simplified
|
|
97
|
+
service_multiplier = {"standard": 1.0, "express": 1.5, "overnight": 2.0}.get(service_type, 1.0)
|
|
98
|
+
|
|
99
|
+
estimated_cost = (base_cost + weight_cost + distance_cost) * service_multiplier
|
|
100
|
+
estimated_delivery = datetime.now() + timedelta(days={"standard": 5, "express": 2, "overnight": 1}.get(service_type, 5))
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
"shipment_id": shipment_id,
|
|
104
|
+
"tracking_number": tracking_number,
|
|
105
|
+
"origin": origin,
|
|
106
|
+
"destination": destination,
|
|
107
|
+
"weight": weight,
|
|
108
|
+
"dimensions": dimensions,
|
|
109
|
+
"service_type": service_type,
|
|
110
|
+
"estimated_cost": estimated_cost,
|
|
111
|
+
"estimated_delivery": estimated_delivery.isoformat(),
|
|
112
|
+
"status": "created",
|
|
113
|
+
"created_at": datetime.now().isoformat()
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@staticmethod
|
|
117
|
+
def track_shipment(tracking_number: str) -> Dict[str, Any]:
|
|
118
|
+
"""
|
|
119
|
+
Track a shipment by tracking number.
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
tracking_number: Tracking number
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
Dict with current status, location, estimated_delivery
|
|
126
|
+
"""
|
|
127
|
+
# Simulated tracking data
|
|
128
|
+
statuses = ["in_transit", "at_warehouse", "out_for_delivery", "delivered"]
|
|
129
|
+
current_status = statuses[int(time.time()) % len(statuses)]
|
|
130
|
+
|
|
131
|
+
locations = {
|
|
132
|
+
"in_transit": "In Transit - Route A",
|
|
133
|
+
"at_warehouse": "Warehouse A",
|
|
134
|
+
"out_for_delivery": "Out for Delivery",
|
|
135
|
+
"delivered": "Delivered - Final Destination"
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
"tracking_number": tracking_number,
|
|
140
|
+
"status": current_status,
|
|
141
|
+
"current_location": locations.get(current_status, "Unknown"),
|
|
142
|
+
"estimated_delivery": (datetime.now() + timedelta(days=2)).isoformat(),
|
|
143
|
+
"last_update": datetime.now().isoformat()
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@staticmethod
|
|
147
|
+
def process_customs_clearance(
|
|
148
|
+
shipment_id: str,
|
|
149
|
+
customs_value: float,
|
|
150
|
+
commodity_code: str,
|
|
151
|
+
origin_country: str,
|
|
152
|
+
destination_country: str
|
|
153
|
+
) -> Dict[str, Any]:
|
|
154
|
+
"""
|
|
155
|
+
Process customs clearance for international shipment.
|
|
156
|
+
|
|
157
|
+
Args:
|
|
158
|
+
shipment_id: Shipment ID
|
|
159
|
+
customs_value: Declared value
|
|
160
|
+
commodity_code: HS code
|
|
161
|
+
origin_country: Origin country code
|
|
162
|
+
destination_country: Destination country code
|
|
163
|
+
|
|
164
|
+
Returns:
|
|
165
|
+
Dict with clearance_status, duties, taxes, clearance_number
|
|
166
|
+
"""
|
|
167
|
+
clearance_number = f"CUS{int(time.time())}"
|
|
168
|
+
|
|
169
|
+
# Simplified duty calculation
|
|
170
|
+
duty_rate = 0.05 if destination_country != origin_country else 0.0
|
|
171
|
+
duties = customs_value * duty_rate
|
|
172
|
+
taxes = customs_value * 0.20 # VAT
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
"clearance_number": clearance_number,
|
|
176
|
+
"shipment_id": shipment_id,
|
|
177
|
+
"status": "cleared",
|
|
178
|
+
"duties": duties,
|
|
179
|
+
"taxes": taxes,
|
|
180
|
+
"total_fees": duties + taxes,
|
|
181
|
+
"cleared_at": datetime.now().isoformat()
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
@staticmethod
|
|
185
|
+
def optimize_route(
|
|
186
|
+
stops: List[Dict[str, Any]],
|
|
187
|
+
vehicle_capacity: float,
|
|
188
|
+
time_windows: Optional[Dict[str, tuple]] = None
|
|
189
|
+
) -> Dict[str, Any]:
|
|
190
|
+
"""
|
|
191
|
+
Optimize delivery route.
|
|
192
|
+
|
|
193
|
+
Args:
|
|
194
|
+
stops: List of stops with address, weight, priority
|
|
195
|
+
vehicle_capacity: Maximum vehicle capacity
|
|
196
|
+
time_windows: Optional time windows for deliveries
|
|
197
|
+
|
|
198
|
+
Returns:
|
|
199
|
+
Dict with optimized_route, total_distance, estimated_time, cost
|
|
200
|
+
"""
|
|
201
|
+
# Simplified route optimization
|
|
202
|
+
optimized_route = sorted(stops, key=lambda x: x.get("priority", 0), reverse=True)
|
|
203
|
+
total_distance = len(stops) * 15.0 # km per stop
|
|
204
|
+
estimated_time = total_distance / 50.0 # hours at 50 km/h
|
|
205
|
+
cost = total_distance * 0.5 # cost per km
|
|
206
|
+
|
|
207
|
+
return {
|
|
208
|
+
"optimized_route": [s["address"] for s in optimized_route],
|
|
209
|
+
"total_stops": len(stops),
|
|
210
|
+
"total_distance_km": total_distance,
|
|
211
|
+
"estimated_time_hours": estimated_time,
|
|
212
|
+
"estimated_cost": cost,
|
|
213
|
+
"vehicle_utilization": sum(s.get("weight", 0) for s in stops) / vehicle_capacity
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
@staticmethod
|
|
217
|
+
def manage_inventory(
|
|
218
|
+
warehouse_id: str,
|
|
219
|
+
sku: str,
|
|
220
|
+
quantity: int,
|
|
221
|
+
operation: str = "check"
|
|
222
|
+
) -> Dict[str, Any]:
|
|
223
|
+
"""
|
|
224
|
+
Manage warehouse inventory.
|
|
225
|
+
|
|
226
|
+
Args:
|
|
227
|
+
warehouse_id: Warehouse identifier
|
|
228
|
+
sku: Stock keeping unit
|
|
229
|
+
quantity: Quantity for operation
|
|
230
|
+
operation: Operation type (check, add, remove, reserve)
|
|
231
|
+
|
|
232
|
+
Returns:
|
|
233
|
+
Dict with current_stock, operation_result, location
|
|
234
|
+
"""
|
|
235
|
+
# Simulated inventory
|
|
236
|
+
base_stock = 100
|
|
237
|
+
current_stock = base_stock - (int(time.time()) % 50)
|
|
238
|
+
|
|
239
|
+
if operation == "add":
|
|
240
|
+
current_stock += quantity
|
|
241
|
+
elif operation == "remove":
|
|
242
|
+
current_stock = max(0, current_stock - quantity)
|
|
243
|
+
elif operation == "reserve":
|
|
244
|
+
current_stock = max(0, current_stock - quantity)
|
|
245
|
+
|
|
246
|
+
return {
|
|
247
|
+
"warehouse_id": warehouse_id,
|
|
248
|
+
"sku": sku,
|
|
249
|
+
"operation": operation,
|
|
250
|
+
"current_stock": current_stock,
|
|
251
|
+
"available_stock": current_stock,
|
|
252
|
+
"location": f"Aisle {int(time.time()) % 10}, Shelf {int(time.time()) % 5}",
|
|
253
|
+
"last_updated": datetime.now().isoformat()
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
@staticmethod
|
|
257
|
+
def calculate_shipping_cost(
|
|
258
|
+
origin: str,
|
|
259
|
+
destination: str,
|
|
260
|
+
weight: float,
|
|
261
|
+
volume: float,
|
|
262
|
+
service_type: str = "standard"
|
|
263
|
+
) -> Dict[str, Any]:
|
|
264
|
+
"""
|
|
265
|
+
Calculate shipping cost.
|
|
266
|
+
|
|
267
|
+
Args:
|
|
268
|
+
origin: Origin location
|
|
269
|
+
destination: Destination location
|
|
270
|
+
weight: Weight in kg
|
|
271
|
+
volume: Volume in cubic meters
|
|
272
|
+
service_type: Service type
|
|
273
|
+
|
|
274
|
+
Returns:
|
|
275
|
+
Dict with base_cost, fuel_surcharge, total_cost, currency
|
|
276
|
+
"""
|
|
277
|
+
base_cost = 10.0
|
|
278
|
+
weight_cost = weight * 1.5
|
|
279
|
+
volume_cost = volume * 50.0
|
|
280
|
+
fuel_surcharge = (base_cost + weight_cost) * 0.15
|
|
281
|
+
|
|
282
|
+
service_multipliers = {
|
|
283
|
+
"standard": 1.0,
|
|
284
|
+
"express": 1.5,
|
|
285
|
+
"overnight": 2.0,
|
|
286
|
+
"economy": 0.8
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
subtotal = (base_cost + weight_cost + volume_cost) * service_multipliers.get(service_type, 1.0)
|
|
290
|
+
total_cost = subtotal + fuel_surcharge
|
|
291
|
+
|
|
292
|
+
return {
|
|
293
|
+
"base_cost": base_cost,
|
|
294
|
+
"weight_cost": weight_cost,
|
|
295
|
+
"volume_cost": volume_cost,
|
|
296
|
+
"fuel_surcharge": fuel_surcharge,
|
|
297
|
+
"subtotal": subtotal,
|
|
298
|
+
"total_cost": total_cost,
|
|
299
|
+
"currency": "EUR",
|
|
300
|
+
"service_type": service_type
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def create_logistics_corporation() -> CorporateSwarm:
|
|
305
|
+
"""
|
|
306
|
+
Create UAB Leiliona - a comprehensive autonomous logistics corporation.
|
|
307
|
+
|
|
308
|
+
Returns:
|
|
309
|
+
CorporateSwarm instance configured for logistics operations
|
|
310
|
+
"""
|
|
311
|
+
logger.info("Creating UAB Leiliona - Autonomous Logistics Corporation")
|
|
312
|
+
|
|
313
|
+
# Create corporation with all advanced features enabled
|
|
314
|
+
corporation = CorporateSwarm(
|
|
315
|
+
name="UAB Leiliona",
|
|
316
|
+
description="Autonomous logistics and supply chain management corporation",
|
|
317
|
+
max_loops=3,
|
|
318
|
+
corporate_model_name="gpt-4o-mini",
|
|
319
|
+
verbose=True,
|
|
320
|
+
config_data={
|
|
321
|
+
"enable_causal_reasoning": True,
|
|
322
|
+
"enable_quant_analysis": True,
|
|
323
|
+
"enable_crca_sd_governance": True,
|
|
324
|
+
"enable_aop": True,
|
|
325
|
+
"enable_queue_execution": True,
|
|
326
|
+
"enable_democratic_discussion": True,
|
|
327
|
+
"enable_financial_oversight": True,
|
|
328
|
+
"budget_limit": 1000000.0, # 1M EUR budget
|
|
329
|
+
"decision_threshold": 0.65,
|
|
330
|
+
"default_board_size": 7,
|
|
331
|
+
"default_executive_team_size": 5,
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
# Add specialized logistics executives
|
|
336
|
+
logger.info("Adding executive team...")
|
|
337
|
+
|
|
338
|
+
# CEO - Strategic leadership
|
|
339
|
+
ceo_id = corporation.add_member(
|
|
340
|
+
name="Elena Vasiljeva",
|
|
341
|
+
role=CorporateRole.CEO,
|
|
342
|
+
department=DepartmentType.OPERATIONS,
|
|
343
|
+
expertise_areas=["strategic_planning", "logistics", "supply_chain", "business_development"],
|
|
344
|
+
voting_weight=3.0
|
|
345
|
+
)
|
|
346
|
+
|
|
347
|
+
# CFO - Financial management
|
|
348
|
+
cfo_id = corporation.add_member(
|
|
349
|
+
name="Marius Kazlauskas",
|
|
350
|
+
role=CorporateRole.CFO,
|
|
351
|
+
department=DepartmentType.FINANCE,
|
|
352
|
+
expertise_areas=["finance", "accounting", "cost_optimization", "financial_analysis"],
|
|
353
|
+
voting_weight=2.5
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
# CTO - Technology and automation
|
|
357
|
+
cto_id = corporation.add_member(
|
|
358
|
+
name="Tomas Petras",
|
|
359
|
+
role=CorporateRole.CTO,
|
|
360
|
+
department=DepartmentType.TECHNOLOGY,
|
|
361
|
+
expertise_areas=["technology", "automation", "systems_integration", "digital_transformation"],
|
|
362
|
+
voting_weight=2.5
|
|
363
|
+
)
|
|
364
|
+
|
|
365
|
+
# COO - Operations management
|
|
366
|
+
coo_id = corporation.add_member(
|
|
367
|
+
name="Inga Jankauskiene",
|
|
368
|
+
role=CorporateRole.COO,
|
|
369
|
+
department=DepartmentType.OPERATIONS,
|
|
370
|
+
expertise_areas=["operations", "warehousing", "transportation", "process_optimization"],
|
|
371
|
+
voting_weight=2.5
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
# Chief Logistics Officer
|
|
375
|
+
clo_id = corporation.add_member(
|
|
376
|
+
name="Rokas Stankevicius",
|
|
377
|
+
role=CorporateRole.DEPARTMENT_HEAD,
|
|
378
|
+
department=DepartmentType.OPERATIONS,
|
|
379
|
+
expertise_areas=["logistics", "route_optimization", "fleet_management", "last_mile_delivery"],
|
|
380
|
+
voting_weight=2.0
|
|
381
|
+
)
|
|
382
|
+
|
|
383
|
+
# Add specialized board members
|
|
384
|
+
logger.info("Adding board of directors...")
|
|
385
|
+
|
|
386
|
+
# Board Chair - Logistics industry expert
|
|
387
|
+
board_chair_id = corporation.add_member(
|
|
388
|
+
name="Dr. Viktoras Zukauskas",
|
|
389
|
+
role=CorporateRole.BOARD_CHAIR,
|
|
390
|
+
department=DepartmentType.OPERATIONS,
|
|
391
|
+
expertise_areas=["governance", "logistics", "supply_chain", "international_trade"],
|
|
392
|
+
voting_weight=3.5,
|
|
393
|
+
independence_status=True
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
# Independent directors
|
|
397
|
+
corporation.add_member(
|
|
398
|
+
name="Prof. Ruta Navickiene",
|
|
399
|
+
role=CorporateRole.INDEPENDENT_DIRECTOR,
|
|
400
|
+
department=DepartmentType.FINANCE,
|
|
401
|
+
expertise_areas=["finance", "audit", "risk_management", "compliance"],
|
|
402
|
+
voting_weight=3.0,
|
|
403
|
+
independence_status=True
|
|
404
|
+
)
|
|
405
|
+
|
|
406
|
+
corporation.add_member(
|
|
407
|
+
name="Dr. Andrius Balciunas",
|
|
408
|
+
role=CorporateRole.INDEPENDENT_DIRECTOR,
|
|
409
|
+
department=DepartmentType.TECHNOLOGY,
|
|
410
|
+
expertise_areas=["technology", "innovation", "digital_transformation", "ai"],
|
|
411
|
+
voting_weight=3.0,
|
|
412
|
+
independence_status=True
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
corporation.add_member(
|
|
416
|
+
name="Jurate Rimkute",
|
|
417
|
+
role=CorporateRole.INDEPENDENT_DIRECTOR,
|
|
418
|
+
department=DepartmentType.LEGAL,
|
|
419
|
+
expertise_areas=["legal", "compliance", "international_law", "regulatory_affairs"],
|
|
420
|
+
voting_weight=3.0,
|
|
421
|
+
independence_status=True
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
corporation.add_member(
|
|
425
|
+
name="Kestutis Vaitkus",
|
|
426
|
+
role=CorporateRole.INDEPENDENT_DIRECTOR,
|
|
427
|
+
department=DepartmentType.OPERATIONS,
|
|
428
|
+
expertise_areas=["sustainability", "environmental_compliance", "esg", "green_logistics"],
|
|
429
|
+
voting_weight=3.0,
|
|
430
|
+
independence_status=True
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
corporation.add_member(
|
|
434
|
+
name="Dalia Stasiuliene",
|
|
435
|
+
role=CorporateRole.INDEPENDENT_DIRECTOR,
|
|
436
|
+
department=DepartmentType.HUMAN_RESOURCES,
|
|
437
|
+
expertise_areas=["hr", "talent_management", "organizational_development", "workplace_safety"],
|
|
438
|
+
voting_weight=3.0,
|
|
439
|
+
independence_status=True
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
# Add department heads
|
|
443
|
+
logger.info("Adding department heads...")
|
|
444
|
+
|
|
445
|
+
# Finance Department Head
|
|
446
|
+
finance_head_id = corporation.add_member(
|
|
447
|
+
name="Giedre Matuliene",
|
|
448
|
+
role=CorporateRole.DEPARTMENT_HEAD,
|
|
449
|
+
department=DepartmentType.FINANCE,
|
|
450
|
+
expertise_areas=["finance", "accounting", "budgeting", "financial_reporting"],
|
|
451
|
+
voting_weight=2.0
|
|
452
|
+
)
|
|
453
|
+
|
|
454
|
+
# Technology Department Head
|
|
455
|
+
tech_head_id = corporation.add_member(
|
|
456
|
+
name="Mindaugas Juska",
|
|
457
|
+
role=CorporateRole.DEPARTMENT_HEAD,
|
|
458
|
+
department=DepartmentType.TECHNOLOGY,
|
|
459
|
+
expertise_areas=["technology", "software_development", "infrastructure", "cybersecurity"],
|
|
460
|
+
voting_weight=2.0
|
|
461
|
+
)
|
|
462
|
+
|
|
463
|
+
# Legal Department Head
|
|
464
|
+
legal_head_id = corporation.add_member(
|
|
465
|
+
name="Asta Kazlauskiene",
|
|
466
|
+
role=CorporateRole.DEPARTMENT_HEAD,
|
|
467
|
+
department=DepartmentType.LEGAL,
|
|
468
|
+
expertise_areas=["legal", "contracts", "compliance", "regulatory"],
|
|
469
|
+
voting_weight=2.0
|
|
470
|
+
)
|
|
471
|
+
|
|
472
|
+
# HR Department Head
|
|
473
|
+
hr_head_id = corporation.add_member(
|
|
474
|
+
name="Rasa Didžiuliene",
|
|
475
|
+
role=CorporateRole.DEPARTMENT_HEAD,
|
|
476
|
+
department=DepartmentType.HUMAN_RESOURCES,
|
|
477
|
+
expertise_areas=["hr", "recruitment", "training", "employee_relations"],
|
|
478
|
+
voting_weight=2.0
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
# Operations Department Head (already added as CLO)
|
|
482
|
+
|
|
483
|
+
# Update department budgets
|
|
484
|
+
logger.info("Configuring department budgets...")
|
|
485
|
+
for dept_id, dept in corporation.departments.items():
|
|
486
|
+
if dept.department_type == DepartmentType.OPERATIONS:
|
|
487
|
+
dept.budget = 400000.0 # 40% of budget for operations
|
|
488
|
+
elif dept.department_type == DepartmentType.FINANCE:
|
|
489
|
+
dept.budget = 150000.0 # 15% for finance
|
|
490
|
+
elif dept.department_type == DepartmentType.TECHNOLOGY:
|
|
491
|
+
dept.budget = 200000.0 # 20% for technology
|
|
492
|
+
elif dept.department_type == DepartmentType.LEGAL:
|
|
493
|
+
dept.budget = 100000.0 # 10% for legal
|
|
494
|
+
elif dept.department_type == DepartmentType.HUMAN_RESOURCES:
|
|
495
|
+
dept.budget = 100000.0 # 10% for HR
|
|
496
|
+
else:
|
|
497
|
+
dept.budget = 50000.0 # 5% for others
|
|
498
|
+
|
|
499
|
+
# Add logistics tools to member agents
|
|
500
|
+
logger.info("Adding logistics tools to agents...")
|
|
501
|
+
tools = LogisticsTools()
|
|
502
|
+
|
|
503
|
+
for member_id, member in corporation.members.items():
|
|
504
|
+
if member.agent:
|
|
505
|
+
# Initialize tools list if needed
|
|
506
|
+
if not hasattr(member.agent, 'tools') or member.agent.tools is None:
|
|
507
|
+
member.agent.tools = []
|
|
508
|
+
|
|
509
|
+
# Add logistics tools based on role using add_tools method
|
|
510
|
+
if member.role in [CorporateRole.CEO, CorporateRole.COO, CorporateRole.DEPARTMENT_HEAD]:
|
|
511
|
+
if member.department == DepartmentType.OPERATIONS:
|
|
512
|
+
# Add operational tools
|
|
513
|
+
try:
|
|
514
|
+
if hasattr(member.agent, 'add_tools'):
|
|
515
|
+
member.agent.add_tools([
|
|
516
|
+
tools.create_shipment,
|
|
517
|
+
tools.track_shipment,
|
|
518
|
+
tools.optimize_route,
|
|
519
|
+
tools.manage_inventory,
|
|
520
|
+
])
|
|
521
|
+
else:
|
|
522
|
+
member.agent.tools.extend([
|
|
523
|
+
tools.create_shipment,
|
|
524
|
+
tools.track_shipment,
|
|
525
|
+
tools.optimize_route,
|
|
526
|
+
tools.manage_inventory,
|
|
527
|
+
])
|
|
528
|
+
except Exception as e:
|
|
529
|
+
logger.warning(f"Failed to add operational tools to {member.name}: {e}")
|
|
530
|
+
|
|
531
|
+
if member.role == CorporateRole.CFO or member.department == DepartmentType.FINANCE:
|
|
532
|
+
# Add financial tools
|
|
533
|
+
try:
|
|
534
|
+
if hasattr(member.agent, 'add_tools'):
|
|
535
|
+
member.agent.add_tools([tools.calculate_shipping_cost])
|
|
536
|
+
else:
|
|
537
|
+
member.agent.tools.append(tools.calculate_shipping_cost)
|
|
538
|
+
except Exception as e:
|
|
539
|
+
logger.warning(f"Failed to add financial tools to {member.name}: {e}")
|
|
540
|
+
|
|
541
|
+
if member.department == DepartmentType.LEGAL:
|
|
542
|
+
# Add legal/compliance tools
|
|
543
|
+
try:
|
|
544
|
+
if hasattr(member.agent, 'add_tools'):
|
|
545
|
+
member.agent.add_tools([tools.process_customs_clearance])
|
|
546
|
+
else:
|
|
547
|
+
member.agent.tools.append(tools.process_customs_clearance)
|
|
548
|
+
except Exception as e:
|
|
549
|
+
logger.warning(f"Failed to add legal tools to {member.name}: {e}")
|
|
550
|
+
|
|
551
|
+
logger.info(f"Created UAB Leiliona with {len(corporation.members)} members")
|
|
552
|
+
logger.info(f"Board members: {len(corporation.board_members)}")
|
|
553
|
+
logger.info(f"Executive team: {len(corporation.executive_team)}")
|
|
554
|
+
logger.info(f"Departments: {len(corporation.departments)}")
|
|
555
|
+
logger.info(f"Committees: {len(corporation.board_committees)}")
|
|
556
|
+
|
|
557
|
+
return corporation
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
def demonstrate_logistics_operations(corporation: CorporateSwarm) -> None:
|
|
561
|
+
"""
|
|
562
|
+
Demonstrate various logistics operations and corporate decisions.
|
|
563
|
+
|
|
564
|
+
Args:
|
|
565
|
+
corporation: CorporateSwarm instance
|
|
566
|
+
"""
|
|
567
|
+
logger.info("=== Demonstrating Logistics Operations ===")
|
|
568
|
+
|
|
569
|
+
# 1. Create a strategic proposal for fleet expansion
|
|
570
|
+
logger.info("\n1. Creating proposal for fleet expansion...")
|
|
571
|
+
proposal_id = corporation.create_proposal(
|
|
572
|
+
title="Fleet Expansion: Add 10 Electric Delivery Vehicles",
|
|
573
|
+
description=(
|
|
574
|
+
"Proposal to expand our delivery fleet with 10 electric vehicles "
|
|
575
|
+
"to support growing demand and improve sustainability metrics. "
|
|
576
|
+
"Total investment: EUR 350,000. Expected ROI: 18% over 3 years. "
|
|
577
|
+
"Reduces carbon footprint by 25% for last-mile deliveries."
|
|
578
|
+
),
|
|
579
|
+
proposal_type=ProposalType.INVESTMENT,
|
|
580
|
+
sponsor_id=corporation.executive_team[0], # CEO
|
|
581
|
+
department=DepartmentType.OPERATIONS,
|
|
582
|
+
budget_impact=350000.0,
|
|
583
|
+
timeline="6 months for procurement and deployment"
|
|
584
|
+
)
|
|
585
|
+
|
|
586
|
+
logger.info(f"Created proposal: {proposal_id}")
|
|
587
|
+
|
|
588
|
+
# 2. Conduct vote on the proposal
|
|
589
|
+
logger.info("\n2. Conducting corporate vote on fleet expansion...")
|
|
590
|
+
vote = corporation.conduct_corporate_vote(proposal_id)
|
|
591
|
+
logger.info(f"Vote result: {vote.result.value}")
|
|
592
|
+
logger.info(f"Participants: {len(vote.participants)}")
|
|
593
|
+
logger.info(f"Governance consensus: {vote.governance_consensus:.1%}")
|
|
594
|
+
|
|
595
|
+
if vote.causal_reasoning_summary:
|
|
596
|
+
logger.info(f"Causal reasoning: {vote.causal_reasoning_summary[:200]}...")
|
|
597
|
+
|
|
598
|
+
if vote.quant_signals:
|
|
599
|
+
logger.info(f"Quantitative signals: {vote.quant_signals}")
|
|
600
|
+
|
|
601
|
+
# 3. Create proposal for warehouse automation
|
|
602
|
+
logger.info("\n3. Creating proposal for warehouse automation...")
|
|
603
|
+
automation_proposal_id = corporation.create_proposal(
|
|
604
|
+
title="Warehouse Automation System Implementation",
|
|
605
|
+
description=(
|
|
606
|
+
"Implement automated sorting and inventory management system "
|
|
607
|
+
"in main warehouse. Investment: EUR 500,000. "
|
|
608
|
+
"Improves efficiency by 40%, reduces errors by 90%. "
|
|
609
|
+
"Payback period: 2.5 years."
|
|
610
|
+
),
|
|
611
|
+
proposal_type=ProposalType.INVESTMENT,
|
|
612
|
+
sponsor_id=corporation.executive_team[2], # CTO
|
|
613
|
+
department=DepartmentType.TECHNOLOGY,
|
|
614
|
+
budget_impact=500000.0,
|
|
615
|
+
timeline="12 months for implementation and training"
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
# 4. Schedule board meeting
|
|
619
|
+
logger.info("\n4. Scheduling board meeting...")
|
|
620
|
+
meeting_id = corporation.schedule_board_meeting(
|
|
621
|
+
meeting_type=MeetingType.REGULAR_BOARD,
|
|
622
|
+
agenda=[
|
|
623
|
+
"Q4 Financial Review",
|
|
624
|
+
"Fleet Expansion Proposal Discussion",
|
|
625
|
+
"Warehouse Automation Update",
|
|
626
|
+
"ESG Compliance Review",
|
|
627
|
+
"Risk Assessment Update"
|
|
628
|
+
]
|
|
629
|
+
)
|
|
630
|
+
logger.info(f"Scheduled meeting: {meeting_id}")
|
|
631
|
+
|
|
632
|
+
# 5. Conduct risk assessment
|
|
633
|
+
logger.info("\n5. Conducting comprehensive risk assessment...")
|
|
634
|
+
risk_assessments = corporation.conduct_risk_assessment("comprehensive")
|
|
635
|
+
logger.info(f"Assessed {len(risk_assessments)} risk categories")
|
|
636
|
+
|
|
637
|
+
for category, assessment in list(risk_assessments.items())[:5]:
|
|
638
|
+
logger.info(f" {category}: {assessment.risk_level} (score: {assessment.risk_score:.2%})")
|
|
639
|
+
|
|
640
|
+
# 6. Calculate ESG score
|
|
641
|
+
logger.info("\n6. Calculating ESG score...")
|
|
642
|
+
esg_score = corporation.calculate_esg_score()
|
|
643
|
+
logger.info(f"Overall ESG: {esg_score.overall_score:.1f}%")
|
|
644
|
+
logger.info(f" Environmental: {esg_score.environmental_score:.1f}%")
|
|
645
|
+
logger.info(f" Social: {esg_score.social_score:.1f}%")
|
|
646
|
+
logger.info(f" Governance: {esg_score.governance_score:.1f}%")
|
|
647
|
+
logger.info(f" Carbon Footprint: {esg_score.carbon_footprint:.2f} tons CO2")
|
|
648
|
+
|
|
649
|
+
# 7. Establish compliance framework
|
|
650
|
+
logger.info("\n7. Establishing compliance frameworks...")
|
|
651
|
+
compliance_frameworks = corporation.establish_compliance_framework("comprehensive")
|
|
652
|
+
logger.info(f"Established {len(compliance_frameworks)} compliance frameworks")
|
|
653
|
+
|
|
654
|
+
for name, framework in compliance_frameworks.items():
|
|
655
|
+
logger.info(f" {name}: {framework.compliance_status} (score: {framework.compliance_score:.1f}%)")
|
|
656
|
+
|
|
657
|
+
# 8. Manage stakeholder engagement
|
|
658
|
+
logger.info("\n8. Managing stakeholder engagement...")
|
|
659
|
+
stakeholder_engagements = corporation.manage_stakeholder_engagement("all")
|
|
660
|
+
logger.info(f"Engaged with {len(stakeholder_engagements)} stakeholder groups")
|
|
661
|
+
|
|
662
|
+
for stype, engagement in stakeholder_engagements.items():
|
|
663
|
+
logger.info(f" {stype}: Satisfaction {engagement.satisfaction_score:.1f}%")
|
|
664
|
+
|
|
665
|
+
# 9. Demonstrate logistics operations using tools
|
|
666
|
+
logger.info("\n9. Demonstrating logistics operations...")
|
|
667
|
+
tools = LogisticsTools()
|
|
668
|
+
|
|
669
|
+
# Create a shipment
|
|
670
|
+
shipment = tools.create_shipment(
|
|
671
|
+
origin="Vilnius, Lithuania",
|
|
672
|
+
destination="Riga, Latvia",
|
|
673
|
+
weight=150.0,
|
|
674
|
+
dimensions={"length": 120, "width": 80, "height": 60},
|
|
675
|
+
service_type="express"
|
|
676
|
+
)
|
|
677
|
+
logger.info(f"Created shipment: {shipment['tracking_number']}")
|
|
678
|
+
logger.info(f" Cost: EUR {shipment['estimated_cost']:.2f}")
|
|
679
|
+
logger.info(f" ETA: {shipment['estimated_delivery']}")
|
|
680
|
+
|
|
681
|
+
# Track shipment
|
|
682
|
+
tracking = tools.track_shipment(shipment['tracking_number'])
|
|
683
|
+
logger.info(f"Tracking: {tracking['status']} at {tracking['current_location']}")
|
|
684
|
+
|
|
685
|
+
# Process customs clearance
|
|
686
|
+
customs = tools.process_customs_clearance(
|
|
687
|
+
shipment_id=shipment['shipment_id'],
|
|
688
|
+
customs_value=5000.0,
|
|
689
|
+
commodity_code="8708.29",
|
|
690
|
+
origin_country="LT",
|
|
691
|
+
destination_country="LV"
|
|
692
|
+
)
|
|
693
|
+
logger.info(f"Customs cleared: {customs['clearance_number']}")
|
|
694
|
+
logger.info(f" Duties: EUR {customs['duties']:.2f}, Taxes: EUR {customs['taxes']:.2f}")
|
|
695
|
+
|
|
696
|
+
# Optimize route
|
|
697
|
+
stops = [
|
|
698
|
+
{"address": "Stop 1", "weight": 50, "priority": 1},
|
|
699
|
+
{"address": "Stop 2", "weight": 30, "priority": 2},
|
|
700
|
+
{"address": "Stop 3", "weight": 40, "priority": 1},
|
|
701
|
+
]
|
|
702
|
+
route = tools.optimize_route(stops, vehicle_capacity=200.0)
|
|
703
|
+
logger.info(f"Optimized route: {route['total_distance_km']:.1f} km, {route['estimated_time_hours']:.1f} hours")
|
|
704
|
+
|
|
705
|
+
# 10. Get corporate status
|
|
706
|
+
logger.info("\n10. Corporate Status Summary...")
|
|
707
|
+
status = corporation.get_corporate_status()
|
|
708
|
+
logger.info(f"Total Members: {status['total_members']}")
|
|
709
|
+
logger.info(f"Active Proposals: {status['active_proposals']}")
|
|
710
|
+
logger.info(f"Total Votes: {status['total_votes']}")
|
|
711
|
+
logger.info(f"Board Meetings: {status['board_meetings']}")
|
|
712
|
+
|
|
713
|
+
logger.info("\n=== Demonstration Complete ===")
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
def run_logistics_corporation_interactive() -> None:
|
|
717
|
+
"""
|
|
718
|
+
Run the logistics corporation with interactive TUI.
|
|
719
|
+
"""
|
|
720
|
+
logger.info("Starting UAB Leiliona - Interactive Mode")
|
|
721
|
+
|
|
722
|
+
# Create corporation
|
|
723
|
+
corporation = create_logistics_corporation()
|
|
724
|
+
|
|
725
|
+
# Run demonstration
|
|
726
|
+
demonstrate_logistics_operations(corporation)
|
|
727
|
+
|
|
728
|
+
# Launch TUI if available
|
|
729
|
+
if TUI_AVAILABLE:
|
|
730
|
+
logger.info("\nLaunching Interactive TUI...")
|
|
731
|
+
logger.info("Use the TUI to:")
|
|
732
|
+
logger.info(" - View corporate status and metrics")
|
|
733
|
+
logger.info(" - Create proposals and conduct votes")
|
|
734
|
+
logger.info(" - Schedule and manage board meetings")
|
|
735
|
+
logger.info(" - Monitor ESG scores and risk assessments")
|
|
736
|
+
logger.info(" - Manage stakeholders and compliance")
|
|
737
|
+
logger.info(" - View AOP integration status")
|
|
738
|
+
logger.info("\nPress Q to quit the TUI")
|
|
739
|
+
|
|
740
|
+
try:
|
|
741
|
+
corporation.launch_tui(refresh_rate=1.0)
|
|
742
|
+
except KeyboardInterrupt:
|
|
743
|
+
logger.info("TUI closed by user")
|
|
744
|
+
else:
|
|
745
|
+
logger.warning("TUI not available. Install rich: pip install rich")
|
|
746
|
+
logger.info("Running in non-interactive mode")
|
|
747
|
+
|
|
748
|
+
# Show status
|
|
749
|
+
status = corporation.get_corporate_status()
|
|
750
|
+
logger.info("\n=== Corporate Status ===")
|
|
751
|
+
logger.info(f"Name: {status['name']}")
|
|
752
|
+
logger.info(f"Members: {status['total_members']}")
|
|
753
|
+
logger.info(f"Board: {status['board_members']}")
|
|
754
|
+
logger.info(f"Executives: {status['executive_team']}")
|
|
755
|
+
logger.info(f"Departments: {status['departments']}")
|
|
756
|
+
logger.info(f"Committees: {status['board_committees']}")
|
|
757
|
+
logger.info(f"Proposals: {status['active_proposals']}")
|
|
758
|
+
logger.info(f"Votes: {status['total_votes']}")
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
def run_logistics_corporation_headless() -> None:
|
|
762
|
+
"""
|
|
763
|
+
Run the logistics corporation in headless mode (no TUI).
|
|
764
|
+
|
|
765
|
+
Useful for automated operations, testing, or integration with other systems.
|
|
766
|
+
"""
|
|
767
|
+
logger.info("Starting UAB Leiliona - Headless Mode")
|
|
768
|
+
|
|
769
|
+
# Create corporation
|
|
770
|
+
corporation = create_logistics_corporation()
|
|
771
|
+
|
|
772
|
+
# Run demonstration
|
|
773
|
+
demonstrate_logistics_operations(corporation)
|
|
774
|
+
|
|
775
|
+
# Example: Automated decision-making loop
|
|
776
|
+
logger.info("\n=== Running Automated Decision Loop ===")
|
|
777
|
+
|
|
778
|
+
# Create a proposal for operational improvement
|
|
779
|
+
proposal_id = corporation.create_proposal(
|
|
780
|
+
title="Implement Real-Time Tracking System",
|
|
781
|
+
description=(
|
|
782
|
+
"Deploy real-time GPS tracking for all delivery vehicles. "
|
|
783
|
+
"Improves customer satisfaction and operational efficiency. "
|
|
784
|
+
"Investment: EUR 75,000."
|
|
785
|
+
),
|
|
786
|
+
proposal_type=ProposalType.OPERATIONAL_CHANGE,
|
|
787
|
+
sponsor_id=corporation.executive_team[2], # CTO
|
|
788
|
+
department=DepartmentType.TECHNOLOGY,
|
|
789
|
+
budget_impact=75000.0,
|
|
790
|
+
timeline="3 months"
|
|
791
|
+
)
|
|
792
|
+
|
|
793
|
+
# Conduct vote
|
|
794
|
+
vote = corporation.conduct_corporate_vote(proposal_id)
|
|
795
|
+
|
|
796
|
+
if vote.result.value == "approved":
|
|
797
|
+
logger.info("Proposal approved! Implementing tracking system...")
|
|
798
|
+
# Here you would execute the actual implementation
|
|
799
|
+
else:
|
|
800
|
+
logger.info(f"Proposal {vote.result.value}, will be reconsidered")
|
|
801
|
+
|
|
802
|
+
# Get final status
|
|
803
|
+
status = corporation.get_corporate_status()
|
|
804
|
+
logger.info("\n=== Final Corporate Status ===")
|
|
805
|
+
logger.info(f"Total Decisions Made: {status['total_votes']}")
|
|
806
|
+
logger.info(f"Active Proposals: {status['active_proposals']}")
|
|
807
|
+
logger.info(f"ESG Score: {status['esg_governance']['overall_score']:.1f}%")
|
|
808
|
+
|
|
809
|
+
return corporation
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
def main():
|
|
813
|
+
"""
|
|
814
|
+
Main entry point for the logistics corporation example.
|
|
815
|
+
"""
|
|
816
|
+
import argparse
|
|
817
|
+
|
|
818
|
+
parser = argparse.ArgumentParser(
|
|
819
|
+
description="UAB Leiliona - Autonomous Logistics Corporation Example"
|
|
820
|
+
)
|
|
821
|
+
parser.add_argument(
|
|
822
|
+
"--mode",
|
|
823
|
+
choices=["interactive", "headless", "demo"],
|
|
824
|
+
default="interactive",
|
|
825
|
+
help="Run mode: interactive (with TUI), headless (no TUI), or demo (quick demonstration)"
|
|
826
|
+
)
|
|
827
|
+
parser.add_argument(
|
|
828
|
+
"--verbose",
|
|
829
|
+
action="store_true",
|
|
830
|
+
help="Enable verbose logging"
|
|
831
|
+
)
|
|
832
|
+
|
|
833
|
+
args = parser.parse_args()
|
|
834
|
+
|
|
835
|
+
if args.verbose:
|
|
836
|
+
logger.add(
|
|
837
|
+
sys.stderr,
|
|
838
|
+
level="DEBUG",
|
|
839
|
+
format="{time} | {level} | {message}"
|
|
840
|
+
)
|
|
841
|
+
|
|
842
|
+
try:
|
|
843
|
+
if args.mode == "interactive":
|
|
844
|
+
run_logistics_corporation_interactive()
|
|
845
|
+
elif args.mode == "headless":
|
|
846
|
+
run_logistics_corporation_headless()
|
|
847
|
+
elif args.mode == "demo":
|
|
848
|
+
# Quick demonstration
|
|
849
|
+
corporation = create_logistics_corporation()
|
|
850
|
+
demonstrate_logistics_operations(corporation)
|
|
851
|
+
logger.info("\nDemo complete. Use --mode interactive for full TUI experience.")
|
|
852
|
+
except KeyboardInterrupt:
|
|
853
|
+
logger.info("\nShutting down UAB Leiliona...")
|
|
854
|
+
except Exception as e:
|
|
855
|
+
logger.error(f"Error running logistics corporation: {e}")
|
|
856
|
+
raise
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
if __name__ == "__main__":
|
|
860
|
+
main()
|
|
861
|
+
|