brainiac-discord 0.0.18 → 0.0.20

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81f74969c95690e118d85fe590b2e2d35b39609937e807afaa2865ac58c8846d
4
- data.tar.gz: cde31da7b3a0b2a4b84bff28b4b1e2fa99fe6ba7e7e8e372b572b1d0ea085c5c
3
+ metadata.gz: 173d9471b14272a611b844fb7a12e0d728f812ab2b06cda08b05faf26329243c
4
+ data.tar.gz: c0658fe873c620e9b1be027d1866035b4d6bd846e13088626eefa174e77c186d
5
5
  SHA512:
6
- metadata.gz: 397af906d3f427dab7723fe20d3cc25840a35e109e4e054f9cf9689337cbcc8ccc376e0b14403d5dd38ede9fc25b3b2e2efa368371dae012b14c6dd5e9f0aa03
7
- data.tar.gz: 8201ec6515468a4ed1a1f4e63ecc8bdf66c57e333a096c00c216559bb4a1466443928ea6c35542efdd77f80bea0c80a2555916cf053ffff41e6e721f329029ba
6
+ metadata.gz: d3997e24550bd3be11cb48942dafa1b624cdc0288410ce5388e4eca6a5145f61291d7dce56295c34544c9dad46407572c3b587e96b3c35a2c168ea4a34afa09e
7
+ data.tar.gz: 55a5b86aae6ce19a9d37b2e2e2d438d3c7ddc80c166367996ffaa9f1355a98613e2f10cb0582c4e171e8e135b27b507cee5317731173a8e01bec63ff795de870
@@ -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:)
@@ -11,6 +11,12 @@ module Brainiac
11
11
  CHANNEL = <<~PROMPT
12
12
  ## Discord Channel Rules
13
13
 
14
+ ### Current Message Priority
15
+ The message in "**Message:**" above is your PRIMARY task. Everything else is context.
16
+ - Original thread topic: reference only — don't answer questions that weren't asked
17
+ - Channel history: context only — helps you understand the conversation flow
18
+ - Your job: respond to the current message, not summarize the thread
19
+
14
20
  ### Mentions
15
21
  Discord does NOT support plain-text @mentions. Writing `@Galen` renders as plain text.
16
22
  To actually mention someone, use the `<@USER_ID>` format. Here are the known IDs:
@@ -3,7 +3,7 @@
3
3
  module Brainiac
4
4
  module Plugins
5
5
  module Discord
6
- VERSION = "0.0.18"
6
+ VERSION = "0.0.20"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brainiac-discord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis