brainiac-discord 0.0.18 → 0.0.19
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/lib/brainiac/plugins/discord/message.rb +26 -0
- data/lib/brainiac/plugins/discord/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '039a353d5ca3679a9ac10b849382d8df6df5080c89a15f6eda1a843585c60beb'
|
|
4
|
+
data.tar.gz: 0a8944ada2fa21e0ece41680930b773620b8b68c7c6cc003847d21ac86beda9f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b119932ccf37b19d4bdeaebefc49538ba1d560060103064e8931804c1827ef7656de9903a8231b866872d425043e638254061d5358c4d2bc771e451749f206b4
|
|
7
|
+
data.tar.gz: ca37078a141d0829cfbfb26602155b91962616a9b0882801844b63fbd045f3a0a0de1c07ef18577599de20e09282a9a01746b96e67c1ed3238ce0a96786e45a1
|
|
@@ -1312,6 +1312,13 @@ module Brainiac
|
|
|
1312
1312
|
exit_status: exit_status, profile: profile
|
|
1313
1313
|
)
|
|
1314
1314
|
|
|
1315
|
+
# Capture and store the CLI session id for future --resume-id dispatches.
|
|
1316
|
+
# This allows resuming the specific session for this worktree rather than
|
|
1317
|
+
# whichever session was globally last. The session id gets stored on the
|
|
1318
|
+
# work item (keyed by agent_cli and worktree), and cli_session_id_for will
|
|
1319
|
+
# retrieve it when resolve_resume is called.
|
|
1320
|
+
capture_discord_session_id(resolved: resolved, work_dir: work_dir, agent_name: agent_name)
|
|
1321
|
+
|
|
1315
1322
|
if exit_status.signaled? || session_cancelled
|
|
1316
1323
|
handle_cancelled(exit_status, session_cancelled, agent_name, message_id,
|
|
1317
1324
|
response_file, meta_file, prompt_file, attachment_paths)
|
|
@@ -1380,6 +1387,25 @@ module Brainiac
|
|
|
1380
1387
|
LOG.warn "[Discord:#{agent_name}] Failed to archive session history: #{e.message}" if defined?(LOG)
|
|
1381
1388
|
end
|
|
1382
1389
|
|
|
1390
|
+
# Capture and store the CLI session id after a Discord dispatch completes.
|
|
1391
|
+
#
|
|
1392
|
+
# Discord threads get worktrees registered as work items (via register_work_item
|
|
1393
|
+
# in create_thread_worktree), so we can use the core's capture_cli_session_id
|
|
1394
|
+
# to store the session id on the work item. On future dispatches, resolve_resume
|
|
1395
|
+
# calls cli_session_id_for which retrieves this stored id, enabling accurate
|
|
1396
|
+
# --resume-id targeting instead of resuming whichever session was globally last.
|
|
1397
|
+
#
|
|
1398
|
+
# Fully best-effort: capture_cli_session_id already logs failures internally,
|
|
1399
|
+
# but we guard here too so a session capture failure never breaks Discord's flow.
|
|
1400
|
+
def capture_discord_session_id(resolved:, work_dir:, agent_name:)
|
|
1401
|
+
return unless defined?(capture_cli_session_id)
|
|
1402
|
+
return unless resolved && work_dir
|
|
1403
|
+
|
|
1404
|
+
capture_cli_session_id(resolved: resolved, chdir: work_dir)
|
|
1405
|
+
rescue StandardError => e
|
|
1406
|
+
LOG.warn "[Discord:#{agent_name}] Failed to capture session id: #{e.message}" if defined?(LOG)
|
|
1407
|
+
end
|
|
1408
|
+
|
|
1383
1409
|
def handle_completed(exit_status:, agent_name:, agent_config_name:, channel_id:, message_id:,
|
|
1384
1410
|
bot_token:, response_file:, meta_file:, log_file:,
|
|
1385
1411
|
project_config:, head_before:, status_before:)
|