@ouro.bot/cli 0.1.0-alpha.210 → 0.1.0-alpha.212

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.
@@ -44,32 +44,32 @@ exports.startBlueBubblesApp = startBlueBubblesApp;
44
44
  const fs = __importStar(require("node:fs"));
45
45
  const http = __importStar(require("node:http"));
46
46
  const path = __importStar(require("node:path"));
47
- const core_1 = require("../heart/core");
48
- const config_1 = require("../heart/config");
49
- const identity_1 = require("../heart/identity");
50
- const turn_coordinator_1 = require("../heart/turn-coordinator");
51
- const context_1 = require("../mind/context");
52
- const tokens_1 = require("../mind/friends/tokens");
53
- const group_context_1 = require("../mind/friends/group-context");
54
- const resolver_1 = require("../mind/friends/resolver");
55
- const store_file_1 = require("../mind/friends/store-file");
56
- const types_1 = require("../mind/friends/types");
57
- const channel_1 = require("../mind/friends/channel");
58
- const pending_1 = require("../mind/pending");
59
- const prompt_1 = require("../mind/prompt");
60
- const mcp_manager_1 = require("../repertoire/mcp-manager");
47
+ const core_1 = require("../../heart/core");
48
+ const config_1 = require("../../heart/config");
49
+ const identity_1 = require("../../heart/identity");
50
+ const turn_coordinator_1 = require("../../heart/turn-coordinator");
51
+ const context_1 = require("../../mind/context");
52
+ const tokens_1 = require("../../mind/friends/tokens");
53
+ const group_context_1 = require("../../mind/friends/group-context");
54
+ const resolver_1 = require("../../mind/friends/resolver");
55
+ const store_file_1 = require("../../mind/friends/store-file");
56
+ const types_1 = require("../../mind/friends/types");
57
+ const channel_1 = require("../../mind/friends/channel");
58
+ const pending_1 = require("../../mind/pending");
59
+ const prompt_1 = require("../../mind/prompt");
60
+ const mcp_manager_1 = require("../../repertoire/mcp-manager");
61
61
  // getPhrases removed — no longer needed after debug-activity cleanup
62
- const runtime_1 = require("../nerves/runtime");
63
- const bluebubbles_model_1 = require("./bluebubbles-model");
64
- const bluebubbles_client_1 = require("./bluebubbles-client");
65
- const bluebubbles_inbound_log_1 = require("./bluebubbles-inbound-log");
66
- const bluebubbles_mutation_log_1 = require("./bluebubbles-mutation-log");
67
- const bluebubbles_runtime_state_1 = require("./bluebubbles-runtime-state");
68
- const bluebubbles_session_cleanup_1 = require("./bluebubbles-session-cleanup");
69
- const tool_activity_callbacks_1 = require("../heart/tool-activity-callbacks");
70
- const commands_1 = require("./commands");
71
- const trust_gate_1 = require("./trust-gate");
72
- const pipeline_1 = require("./pipeline");
62
+ const runtime_1 = require("../../nerves/runtime");
63
+ const model_1 = require("./model");
64
+ const client_1 = require("./client");
65
+ const inbound_log_1 = require("./inbound-log");
66
+ const mutation_log_1 = require("./mutation-log");
67
+ const runtime_state_1 = require("./runtime-state");
68
+ const session_cleanup_1 = require("./session-cleanup");
69
+ const tool_activity_callbacks_1 = require("../../heart/tool-activity-callbacks");
70
+ const commands_1 = require("../commands");
71
+ const trust_gate_1 = require("../trust-gate");
72
+ const pipeline_1 = require("../pipeline");
73
73
  const bbFailoverStates = new Map();
74
74
  // Enrich reaction text with the original message content for context.
75
75
  // If originalText is provided and non-empty, format as: baseText to: "truncated"
@@ -128,8 +128,8 @@ const defaultDeps = {
128
128
  postTurn: context_1.postTurn,
129
129
  sessionPath: config_1.sessionPath,
130
130
  accumulateFriendTokens: tokens_1.accumulateFriendTokens,
131
- createClient: () => (0, bluebubbles_client_1.createBlueBubblesClient)(),
132
- recordMutation: bluebubbles_mutation_log_1.recordBlueBubblesMutation,
131
+ createClient: () => (0, client_1.createBlueBubblesClient)(),
132
+ recordMutation: mutation_log_1.recordBlueBubblesMutation,
133
133
  createFriendStore: () => new store_file_1.FileFriendStore(path.join((0, identity_1.getAgentRoot)(), "friends")),
134
134
  createFriendResolver: (store, params) => new resolver_1.FriendResolver(store, params),
135
135
  createServer: http.createServer,
@@ -618,7 +618,7 @@ async function handleBlueBubblesNormalizedEvent(event, resolvedDeps, source) {
618
618
  const friendId = context.friend.id;
619
619
  const sessPath = resolvedDeps.sessionPath(friendId, "bluebubbles", event.chat.sessionKey);
620
620
  try {
621
- (0, bluebubbles_session_cleanup_1.findObsoleteBlueBubblesThreadSessions)(sessPath);
621
+ (0, session_cleanup_1.findObsoleteBlueBubblesThreadSessions)(sessPath);
622
622
  }
623
623
  catch (error) {
624
624
  (0, runtime_1.emitNervesEvent)({
@@ -641,7 +641,7 @@ async function handleBlueBubblesNormalizedEvent(event, resolvedDeps, source) {
641
641
  : [{ role: "system", content: await resolvedDeps.buildSystem("bluebubbles", { mcpManager }, context) }];
642
642
  if (event.kind === "message") {
643
643
  const agentName = resolvedDeps.getAgentName();
644
- if ((0, bluebubbles_inbound_log_1.hasRecordedBlueBubblesInbound)(agentName, event.chat.sessionKey, event.messageGuid)) {
644
+ if ((0, inbound_log_1.hasRecordedBlueBubblesInbound)(agentName, event.chat.sessionKey, event.messageGuid)) {
645
645
  (0, runtime_1.emitNervesEvent)({
646
646
  component: "senses",
647
647
  event: "senses.bluebubbles_recovery_skip",
@@ -656,9 +656,9 @@ async function handleBlueBubblesNormalizedEvent(event, resolvedDeps, source) {
656
656
  }
657
657
  // Record EARLY to prevent duplicate processing. BB webhooks can retry
658
658
  // before the first turn completes — recording after the turn is too late.
659
- (0, bluebubbles_inbound_log_1.recordBlueBubblesInbound)(agentName, event, source);
659
+ (0, inbound_log_1.recordBlueBubblesInbound)(agentName, event, source);
660
660
  if (source !== "webhook" && sessionLikelyContainsMessage(event, existing?.messages ?? sessionMessages)) {
661
- (0, bluebubbles_inbound_log_1.recordBlueBubblesInbound)(agentName, event, "recovery-bootstrap");
661
+ (0, inbound_log_1.recordBlueBubblesInbound)(agentName, event, "recovery-bootstrap");
662
662
  (0, runtime_1.emitNervesEvent)({
663
663
  component: "senses",
664
664
  event: "senses.bluebubbles_recovery_skip",
@@ -814,7 +814,7 @@ async function handleBlueBubblesNormalizedEvent(event, resolvedDeps, source) {
814
814
  });
815
815
  }
816
816
  if (event.kind === "message") {
817
- (0, bluebubbles_inbound_log_1.recordBlueBubblesInbound)(resolvedDeps.getAgentName(), event, source);
817
+ (0, inbound_log_1.recordBlueBubblesInbound)(resolvedDeps.getAgentName(), event, source);
818
818
  }
819
819
  return {
820
820
  handled: true,
@@ -825,7 +825,7 @@ async function handleBlueBubblesNormalizedEvent(event, resolvedDeps, source) {
825
825
  // Gate allowed — flush the agent's reply
826
826
  await callbacks.flush();
827
827
  if (event.kind === "message") {
828
- (0, bluebubbles_inbound_log_1.recordBlueBubblesInbound)(resolvedDeps.getAgentName(), event, source);
828
+ (0, inbound_log_1.recordBlueBubblesInbound)(resolvedDeps.getAgentName(), event, source);
829
829
  }
830
830
  (0, runtime_1.emitNervesEvent)({
831
831
  component: "senses",
@@ -859,12 +859,12 @@ async function handleBlueBubblesNormalizedEvent(event, resolvedDeps, source) {
859
859
  async function handleBlueBubblesEvent(payload, deps = {}) {
860
860
  const resolvedDeps = { ...defaultDeps, ...deps };
861
861
  const client = resolvedDeps.createClient();
862
- const event = await client.repairEvent((0, bluebubbles_model_1.normalizeBlueBubblesEvent)(payload));
862
+ const event = await client.repairEvent((0, model_1.normalizeBlueBubblesEvent)(payload));
863
863
  return handleBlueBubblesNormalizedEvent(event, resolvedDeps, "webhook");
864
864
  }
865
865
  function countPendingRecoveryCandidates(agentName) {
866
- return (0, bluebubbles_mutation_log_1.listBlueBubblesRecoveryCandidates)(agentName)
867
- .filter((entry) => !(0, bluebubbles_inbound_log_1.hasRecordedBlueBubblesInbound)(agentName, entry.sessionKey, entry.messageGuid))
866
+ return (0, mutation_log_1.listBlueBubblesRecoveryCandidates)(agentName)
867
+ .filter((entry) => !(0, inbound_log_1.hasRecordedBlueBubblesInbound)(agentName, entry.sessionKey, entry.messageGuid))
868
868
  .length;
869
869
  }
870
870
  async function syncBlueBubblesRuntime(deps = {}) {
@@ -875,7 +875,7 @@ async function syncBlueBubblesRuntime(deps = {}) {
875
875
  try {
876
876
  await client.checkHealth();
877
877
  const recovery = await recoverMissedBlueBubblesMessages(resolvedDeps);
878
- (0, bluebubbles_runtime_state_1.writeBlueBubblesRuntimeState)(agentName, {
878
+ (0, runtime_state_1.writeBlueBubblesRuntimeState)(agentName, {
879
879
  upstreamStatus: recovery.pending > 0 || recovery.failed > 0 ? "error" : "ok",
880
880
  detail: recovery.failed > 0
881
881
  ? `recovery failures: ${recovery.failed}`
@@ -888,7 +888,7 @@ async function syncBlueBubblesRuntime(deps = {}) {
888
888
  });
889
889
  }
890
890
  catch (error) {
891
- (0, bluebubbles_runtime_state_1.writeBlueBubblesRuntimeState)(agentName, {
891
+ (0, runtime_state_1.writeBlueBubblesRuntimeState)(agentName, {
892
892
  upstreamStatus: "error",
893
893
  detail: error instanceof Error ? error.message : String(error),
894
894
  lastCheckedAt: checkedAt,
@@ -901,8 +901,8 @@ async function recoverMissedBlueBubblesMessages(deps = {}) {
901
901
  const agentName = resolvedDeps.getAgentName();
902
902
  const client = resolvedDeps.createClient();
903
903
  const result = { recovered: 0, skipped: 0, pending: 0, failed: 0 };
904
- for (const candidate of (0, bluebubbles_mutation_log_1.listBlueBubblesRecoveryCandidates)(agentName)) {
905
- if ((0, bluebubbles_inbound_log_1.hasRecordedBlueBubblesInbound)(agentName, candidate.sessionKey, candidate.messageGuid)) {
904
+ for (const candidate of (0, mutation_log_1.listBlueBubblesRecoveryCandidates)(agentName)) {
905
+ if ((0, inbound_log_1.hasRecordedBlueBubblesInbound)(agentName, candidate.sessionKey, candidate.messageGuid)) {
906
906
  result.skipped++;
907
907
  continue;
908
908
  }
@@ -38,8 +38,8 @@ const node_child_process_1 = require("node:child_process");
38
38
  const fs = __importStar(require("node:fs/promises"));
39
39
  const os = __importStar(require("node:os"));
40
40
  const path = __importStar(require("node:path"));
41
- const runtime_1 = require("../nerves/runtime");
42
- const identity_1 = require("../heart/identity");
41
+ const runtime_1 = require("../../nerves/runtime");
42
+ const identity_1 = require("../../heart/identity");
43
43
  const MAX_ATTACHMENT_BYTES = 8 * 1024 * 1024;
44
44
  const AUDIO_EXTENSIONS = new Set([".mp3", ".wav", ".m4a", ".caf", ".ogg"]);
45
45
  const IMAGE_EXTENSIONS = new Set([".jpg", ".jpeg", ".png", ".gif", ".webp", ".heic", ".heif"]);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeBlueBubblesEvent = normalizeBlueBubblesEvent;
4
- const runtime_1 = require("../nerves/runtime");
4
+ const runtime_1 = require("../../nerves/runtime");
5
5
  function asRecord(value) {
6
6
  return value && typeof value === "object" && !Array.isArray(value)
7
7
  ? value
@@ -38,9 +38,9 @@ exports.recordBlueBubblesMutation = recordBlueBubblesMutation;
38
38
  exports.listBlueBubblesRecoveryCandidates = listBlueBubblesRecoveryCandidates;
39
39
  const fs = __importStar(require("node:fs"));
40
40
  const path = __importStar(require("node:path"));
41
- const runtime_1 = require("../nerves/runtime");
42
- const identity_1 = require("../heart/identity");
43
- const config_1 = require("../heart/config");
41
+ const runtime_1 = require("../../nerves/runtime");
42
+ const identity_1 = require("../../heart/identity");
43
+ const config_1 = require("../../heart/config");
44
44
  function getBlueBubblesMutationLogPath(agentName, sessionKey) {
45
45
  return path.join((0, identity_1.getAgentRoot)(agentName), "state", "senses", "bluebubbles", "mutations", `${(0, config_1.sanitizeKey)(sessionKey)}.ndjson`);
46
46
  }
@@ -38,8 +38,8 @@ exports.readBlueBubblesRuntimeState = readBlueBubblesRuntimeState;
38
38
  exports.writeBlueBubblesRuntimeState = writeBlueBubblesRuntimeState;
39
39
  const fs = __importStar(require("node:fs"));
40
40
  const path = __importStar(require("node:path"));
41
- const identity_1 = require("../heart/identity");
42
- const runtime_1 = require("../nerves/runtime");
41
+ const identity_1 = require("../../heart/identity");
42
+ const runtime_1 = require("../../nerves/runtime");
43
43
  const DEFAULT_RUNTIME_STATE = {
44
44
  upstreamStatus: "unknown",
45
45
  detail: "startup health probe pending",
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.findObsoleteBlueBubblesThreadSessions = findObsoleteBlueBubblesThreadSessions;
37
37
  const fs = __importStar(require("node:fs"));
38
38
  const path = __importStar(require("node:path"));
39
- const runtime_1 = require("../nerves/runtime");
39
+ const runtime_1 = require("../../nerves/runtime");
40
40
  function findObsoleteBlueBubblesThreadSessions(trunkSessionPath) {
41
41
  const normalized = trunkSessionPath.trim();
42
42
  if (!normalized.endsWith(".json"))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.210",
3
+ "version": "0.1.0-alpha.212",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",
@@ -25,7 +25,7 @@
25
25
  "daemon": "tsc && node dist/heart/daemon/daemon-entry.js",
26
26
  "ouro": "tsc && node dist/heart/daemon/ouro-entry.js",
27
27
  "teams": "tsc && node dist/senses/teams-entry.js --agent ouroboros",
28
- "bluebubbles": "tsc && node dist/senses/bluebubbles-entry.js --agent ouroboros",
28
+ "bluebubbles": "tsc && node dist/senses/bluebubbles/entry.js --agent ouroboros",
29
29
  "test": "vitest run",
30
30
  "test:coverage:vitest": "vitest run --coverage",
31
31
  "test:coverage": "node scripts/run-coverage-gate.cjs",