collavre 0.2.5 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/app/channels/collavre/comments_presence_channel.rb +6 -3
  3. data/app/controllers/collavre/admin/orchestration_controller.rb +177 -0
  4. data/app/controllers/collavre/comments_controller.rb +10 -1
  5. data/app/javascript/controllers/comments/presence_controller.js +5 -1
  6. data/app/jobs/collavre/ai_agent_job.rb +55 -4
  7. data/app/jobs/collavre/cron_action_job.rb +53 -0
  8. data/app/jobs/collavre/stuck_detector_job.rb +34 -0
  9. data/app/models/collavre/comment.rb +15 -15
  10. data/app/models/collavre/creative.rb +1 -1
  11. data/app/models/collavre/orchestrator_policy.rb +124 -0
  12. data/app/models/collavre/task.rb +3 -0
  13. data/app/models/collavre/user.rb +1 -1
  14. data/app/services/collavre/ai_agent_service.rb +32 -1
  15. data/app/services/collavre/ai_client.rb +4 -3
  16. data/app/services/collavre/comments/command_processor.rb +4 -1
  17. data/app/services/collavre/comments/topic_command.rb +101 -0
  18. data/app/services/collavre/orchestration/agent_context_builder.rb +201 -0
  19. data/app/services/collavre/orchestration/agent_orchestrator.rb +142 -0
  20. data/app/services/collavre/orchestration/arbiter.rb +257 -0
  21. data/app/services/collavre/orchestration/loop_breaker.rb +294 -0
  22. data/app/services/collavre/orchestration/matcher.rb +98 -0
  23. data/app/services/collavre/orchestration/policy_resolver.rb +170 -0
  24. data/app/services/collavre/orchestration/resource_tracker.rb +135 -0
  25. data/app/services/collavre/orchestration/scheduler.rb +145 -0
  26. data/app/services/collavre/orchestration/self_reflection_evaluator.rb +231 -0
  27. data/app/services/collavre/orchestration/stuck_detector.rb +303 -0
  28. data/app/services/collavre/system_events/context_builder.rb +34 -7
  29. data/app/services/collavre/system_events/dispatcher.rb +2 -7
  30. data/app/services/collavre/tools/cron_cancel_service.rb +49 -0
  31. data/app/services/collavre/tools/cron_create_service.rb +73 -0
  32. data/app/services/collavre/tools/cron_list_service.rb +65 -0
  33. data/app/services/collavre/tools/cron_update_service.rb +82 -0
  34. data/app/views/admin/shared/_tabs.html.erb +1 -0
  35. data/app/views/collavre/admin/orchestration/show.html.erb +66 -0
  36. data/app/views/collavre/creatives/index.html.erb +1 -1
  37. data/config/locales/ai_agent.en.yml +21 -0
  38. data/config/locales/ai_agent.ko.yml +21 -0
  39. data/config/locales/comments.en.yml +8 -0
  40. data/config/locales/comments.ko.yml +8 -0
  41. data/config/routes.rb +5 -1
  42. data/db/migrate/20260206005035_create_orchestrator_policies.rb +32 -0
  43. data/db/migrate/20260206094509_add_retry_count_to_tasks.rb +5 -0
  44. data/db/migrate/20260206100000_add_topic_id_to_tasks.rb +6 -0
  45. data/lib/collavre/version.rb +1 -1
  46. metadata +24 -13
  47. data/app/controllers/collavre/github_auth_controller.rb +0 -25
  48. data/app/models/collavre/github_account.rb +0 -10
  49. data/app/models/collavre/github_repository_link.rb +0 -19
  50. data/app/services/collavre/github/client.rb +0 -112
  51. data/app/services/collavre/github/pull_request_analyzer.rb +0 -280
  52. data/app/services/collavre/github/pull_request_processor.rb +0 -181
  53. data/app/services/collavre/github/webhook_provisioner.rb +0 -130
  54. data/app/services/collavre/system_events/router.rb +0 -96
  55. data/app/views/collavre/creatives/_github_integration_modal.html.erb +0 -77
  56. data/db/migrate/20250925000000_create_github_integrations.rb +0 -26
  57. data/db/migrate/20250927000000_add_webhook_secret_to_github_repository_links.rb +0 -29
  58. data/db/migrate/20250928105957_add_github_gemini_prompt_to_creatives.rb +0 -5
@@ -1,77 +0,0 @@
1
- <div id="github-integration-modal"
2
- data-success-message="<%= t('collavre.creatives.index.github_integration_saved', default: 'Github integration saved successfully.') %>"
3
- data-login-required="<%= t('collavre.creatives.index.github_integration_login_required', default: 'Sign in with your Github account to start the integration.') %>"
4
- data-no-creative="<%= t('collavre.creatives.index.github_integration_missing_creative', default: 'No Creative selected for integration.') %>"
5
- data-webhook-url-label="<%= t('collavre.creatives.index.github_integration_webhook_url_label', default: 'Webhook URL') %>"
6
- data-webhook-secret-label="<%= t('collavre.creatives.index.github_integration_webhook_secret_label', default: 'Webhook secret') %>"
7
- data-existing-message="<%= t('collavre.creatives.index.github_integration_existing_message', default: 'You\'re already connected to the repositories below.') %>"
8
- data-delete-confirm="<%= t('collavre.creatives.index.github_integration_delete_confirm', default: 'Do you want to remove the Github integration?') %>"
9
- data-delete-success="<%= t('collavre.creatives.index.github_integration_delete_success', default: 'Github integration removed successfully.') %>"
10
- data-delete-error="<%= t('collavre.creatives.index.github_integration_delete_error', default: 'Failed to remove the Github integration.') %>"
11
- data-delete-button-label="<%= t('collavre.creatives.index.github_integration_delete_button', default: 'Remove integration') %>"
12
- data-delete-select-warning="<%= t('collavre.creatives.index.github_integration_delete_select_warning', default: '삭제할 Repository를 선택하세요.') %>"
13
- style="display:none;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:10000;align-items:center;justify-content:center;">
14
- <div class="popup-box" style="min-width:360px;max-width:90vw;">
15
- <button type="button" id="close-github-modal" class="popup-close-btn">&times;</button>
16
- <h2><%= t('collavre.creatives.index.github_integration_title', default: 'Configure Github integration') %></h2>
17
- <p id="github-integration-status" class="github-modal-status"></p>
18
-
19
- <div class="github-wizard-step" id="github-step-connect">
20
- <p id="github-connect-message" class="github-modal-subtext"><%= t('collavre.creatives.index.github_integration_connect', default: 'Sign in with your Github account to start linking.') %></p>
21
- <form id="github-login-form" action="/auth/github" method="post" target="github-auth-window" style="display:none;">
22
- <input type="hidden" name="authenticity_token" value="<%= form_authenticity_token %>">
23
- </form>
24
- <button type="button" id="github-login-btn" class="btn btn-primary" data-window-width="620" data-window-height="720">
25
- <%= t('collavre.creatives.index.github_login_button', default: 'Sign in with Github') %>
26
- </button>
27
- <div id="github-existing-connections" style="display:none;margin-top:1.25em;">
28
- <p style="margin-bottom:0.5em;"><%= t('collavre.creatives.index.github_integration_existing_intro', default: '이미 연동된 Repository 목록입니다:') %></p>
29
- <ul id="github-existing-repo-list" style="padding-left:1.2em;margin-bottom:0.75em;color:var(--color-text);"></ul>
30
- <button type="button" id="github-delete-btn" class="btn btn-danger" style="display:none;">
31
- <%= t('collavre.creatives.index.github_integration_delete_button', default: '연동 삭제') %>
32
- </button>
33
- </div>
34
- </div>
35
-
36
- <div class="github-wizard-step" id="github-step-organization" style="display:none;">
37
- <p class="github-modal-subtext"><%= t('collavre.creatives.index.github_integration_choose_org', default: 'Select the organization that owns the repositories.') %></p>
38
- <div id="github-organization-list" class="github-list github-modal-list-box" style="max-height:200px;overflow:auto;"></div>
39
- </div>
40
-
41
- <div class="github-wizard-step" id="github-step-repositories" style="display:none;">
42
- <p class="github-modal-subtext"><%= t('collavre.creatives.index.github_integration_choose_repo', default: 'Select repositories to link. You can choose multiple.') %></p>
43
- <div id="github-repository-list" class="github-list github-modal-list-box" style="max-height:240px;overflow:auto;"></div>
44
- </div>
45
-
46
- <div class="github-wizard-step" id="github-step-summary" style="display:none;">
47
- <p class="github-modal-subtext"><%= t('collavre.creatives.index.github_integration_summary', default: 'The following repositories will be linked to this Creative:') %></p>
48
- <p id="github-webhook-instructions" class="github-modal-subtext" style="display:none;margin-bottom:0.5em;"><%= t('collavre.creatives.index.github_integration_webhook_instructions', default: 'Configure each repository with the webhook details below.') %></p>
49
- <ul id="github-selected-repos" style="padding-left:1.2em;color:var(--color-text);"></ul>
50
- <p id="github-summary-empty" class="github-modal-empty" style="display:none;"><%= t('collavre.creatives.index.github_integration_summary_empty', default: 'No repositories selected.') %></p>
51
- </div>
52
-
53
- <div class="github-wizard-step" id="github-step-prompt" style="display:none;">
54
- <p class="github-modal-subtext"><%= t('collavre.creatives.index.github_integration_prompt_title', default: 'Review the Gemini analysis prompt and edit it if needed.') %></p>
55
- <textarea id="github-gemini-prompt" style="width:100%;min-height:220px;padding:0.75em;border:1px solid var(--color-border);border-radius:4px;font-family:monospace;font-size:0.95em;"></textarea>
56
- <p class="github-modal-subtext" style="margin-top:0.75em;font-size:0.9em;">
57
- <%= t('collavre.creatives.index.github_integration_prompt_help', default: 'Use the placeholders below to inject runtime details as needed:') %>
58
- <code>#{pr_title}</code>,
59
- <code>#{pr_body}</code>,
60
- <code>#{commit_messages}</code>,
61
- <code>#{diff}</code>,
62
- <code>#{creative_tree}</code>,
63
- <code>#{language_instructions}</code>
64
- </p>
65
- </div>
66
-
67
- <div id="github-wizard-error" style="display:none;margin:0.5em 0;color:#c0392b;font-weight:bold;"></div>
68
-
69
- <div class="github-wizard-footer" style="display:flex;justify-content:space-between;gap:0.5em;margin-top:1.5em;">
70
- <button type="button" id="github-prev-btn" class="btn btn-secondary" style="display:none;"><%= t('app.previous', default: 'Previous') %></button>
71
- <div style="margin-left:auto;display:flex;gap:0.5em;">
72
- <button type="button" id="github-next-btn" class="btn btn-primary" style="display:none;"><%= t('app.next', default: 'Next') %></button>
73
- <button type="button" id="github-finish-btn" class="btn btn-primary" style="display:none;"><%= t('app.finish', default: 'Finish') %></button>
74
- </div>
75
- </div>
76
- </div>
77
- </div>
@@ -1,26 +0,0 @@
1
- class CreateGithubIntegrations < ActiveRecord::Migration[8.0]
2
- def change
3
- create_table :github_accounts do |t|
4
- t.references :user, null: false, foreign_key: true, index: { unique: true }
5
- t.string :github_uid, null: false
6
- t.string :login, null: false
7
- t.string :name
8
- t.string :avatar_url
9
- t.string :token, null: false
10
- t.datetime :token_expires_at
11
- t.timestamps
12
- end
13
-
14
- create_table :github_repository_links do |t|
15
- t.references :creative, null: false, foreign_key: true
16
- t.references :github_account, null: false, foreign_key: true
17
- t.bigint :repository_id
18
- t.string :repository_full_name, null: false
19
- t.timestamps
20
- end
21
-
22
- add_index :github_accounts, :github_uid, unique: true
23
- add_index :github_repository_links, :repository_full_name
24
- add_index :github_repository_links, [ :creative_id, :repository_full_name ], unique: true, name: "index_github_links_on_creative_and_repo"
25
- end
26
- end
@@ -1,29 +0,0 @@
1
- class AddWebhookSecretToGithubRepositoryLinks < ActiveRecord::Migration[8.0]
2
- class GithubRepositoryLink < ApplicationRecord
3
- self.table_name = "github_repository_links"
4
- end
5
-
6
- def up
7
- add_column :github_repository_links, :webhook_secret, :string
8
-
9
- GithubRepositoryLink.reset_column_information
10
-
11
- say_with_time "Backfilling webhook secrets" do
12
- GithubRepositoryLink.find_each do |link|
13
- link.update_columns(webhook_secret: generate_secret)
14
- end
15
- end
16
-
17
- change_column_null :github_repository_links, :webhook_secret, false
18
- end
19
-
20
- def down
21
- remove_column :github_repository_links, :webhook_secret
22
- end
23
-
24
- private
25
-
26
- def generate_secret
27
- SecureRandom.hex(20)
28
- end
29
- end
@@ -1,5 +0,0 @@
1
- class AddGithubGeminiPromptToCreatives < ActiveRecord::Migration[8.0]
2
- def change
3
- add_column :creatives, :github_gemini_prompt, :text
4
- end
5
- end