crewly 1.20.150 → 1.20.151

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 (50) hide show
  1. package/dist/backend/backend/src/constants.d.ts +24 -0
  2. package/dist/backend/backend/src/constants.d.ts.map +1 -1
  3. package/dist/backend/backend/src/constants.js +24 -0
  4. package/dist/backend/backend/src/constants.js.map +1 -1
  5. package/dist/backend/backend/src/index.d.ts.map +1 -1
  6. package/dist/backend/backend/src/index.js +48 -2
  7. package/dist/backend/backend/src/index.js.map +1 -1
  8. package/dist/backend/backend/src/services/cloud/agent-roster.utils.d.ts +31 -0
  9. package/dist/backend/backend/src/services/cloud/agent-roster.utils.d.ts.map +1 -0
  10. package/dist/backend/backend/src/services/cloud/agent-roster.utils.js +53 -0
  11. package/dist/backend/backend/src/services/cloud/agent-roster.utils.js.map +1 -0
  12. package/dist/backend/backend/src/services/cloud/cloud-sync.types.d.ts +1 -1
  13. package/dist/backend/backend/src/services/cloud/cloud-sync.types.d.ts.map +1 -1
  14. package/dist/backend/backend/src/services/cloud/cloud-sync.types.js +1 -0
  15. package/dist/backend/backend/src/services/cloud/cloud-sync.types.js.map +1 -1
  16. package/dist/backend/backend/src/services/cloud/cloud-talk-inbound.service.d.ts +125 -0
  17. package/dist/backend/backend/src/services/cloud/cloud-talk-inbound.service.d.ts.map +1 -0
  18. package/dist/backend/backend/src/services/cloud/cloud-talk-inbound.service.js +272 -0
  19. package/dist/backend/backend/src/services/cloud/cloud-talk-inbound.service.js.map +1 -0
  20. package/dist/backend/backend/src/services/cloud/conversation-cloud-sync.service.d.ts +21 -1
  21. package/dist/backend/backend/src/services/cloud/conversation-cloud-sync.service.d.ts.map +1 -1
  22. package/dist/backend/backend/src/services/cloud/conversation-cloud-sync.service.js +53 -5
  23. package/dist/backend/backend/src/services/cloud/conversation-cloud-sync.service.js.map +1 -1
  24. package/dist/backend/backend/src/services/cloud/conversation-ingest.contract.d.ts +48 -0
  25. package/dist/backend/backend/src/services/cloud/conversation-ingest.contract.d.ts.map +1 -1
  26. package/dist/backend/backend/src/services/cloud/conversation-ingest.contract.js +66 -0
  27. package/dist/backend/backend/src/services/cloud/conversation-ingest.contract.js.map +1 -1
  28. package/dist/backend/backend/src/services/slack/slack-initializer.d.ts.map +1 -1
  29. package/dist/backend/backend/src/services/slack/slack-initializer.js +2 -0
  30. package/dist/backend/backend/src/services/slack/slack-initializer.js.map +1 -1
  31. package/dist/backend/backend/src/services/slack/slack-instance-registry.service.d.ts +5 -0
  32. package/dist/backend/backend/src/services/slack/slack-instance-registry.service.d.ts.map +1 -1
  33. package/dist/backend/backend/src/services/slack/slack-instance-registry.service.js +5 -0
  34. package/dist/backend/backend/src/services/slack/slack-instance-registry.service.js.map +1 -1
  35. package/dist/backend/backend/src/types/slack.types.d.ts +12 -0
  36. package/dist/backend/backend/src/types/slack.types.d.ts.map +1 -1
  37. package/dist/backend/backend/src/types/slack.types.js.map +1 -1
  38. package/dist/backend/build-info.json +2 -2
  39. package/dist/cli/backend/src/constants.d.ts +24 -0
  40. package/dist/cli/backend/src/constants.d.ts.map +1 -1
  41. package/dist/cli/backend/src/constants.js +24 -0
  42. package/dist/cli/backend/src/constants.js.map +1 -1
  43. package/dist/cli/backend/src/services/cloud/cloud-sync.types.d.ts +1 -1
  44. package/dist/cli/backend/src/services/cloud/cloud-sync.types.d.ts.map +1 -1
  45. package/dist/cli/backend/src/services/cloud/cloud-sync.types.js +1 -0
  46. package/dist/cli/backend/src/services/cloud/cloud-sync.types.js.map +1 -1
  47. package/dist/cli/backend/src/types/slack.types.d.ts +12 -0
  48. package/dist/cli/backend/src/types/slack.types.d.ts.map +1 -1
  49. package/dist/cli/backend/src/types/slack.types.js.map +1 -1
  50. package/package.json +1 -1
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The agent roster this machine reports to Crewly Cloud — on the Slack
3
+ * registry heartbeat and on the conversation uploader's periodic probe — so
4
+ * the portal lists every agent (spec §C.3 `roster[]`), including agents that
5
+ * have no messages yet and machines that do not use Slack.
6
+ *
7
+ * Session names are the machine's own (`crewly-orc` for the orchestrator,
8
+ * never the per-machine Slack spelling), the same names the uploaded
9
+ * conversation log and Cloud Talk use.
10
+ *
11
+ * @module services/cloud/agent-roster.utils
12
+ */
13
+ import type { Team } from '../../types/index.js';
14
+ import type { AgentRosterEntry } from './conversation-ingest.contract.js';
15
+ /**
16
+ * Build the roster: the orchestrator first, then every team member with a
17
+ * session (orchestrator-role members are the orchestrator itself and are
18
+ * skipped). A session listed twice keeps its first entry.
19
+ *
20
+ * @param teams - Stored teams
21
+ * @returns Roster entries
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * buildAgentRoster(await storage.getTeams());
26
+ * // [{ agentSession: 'crewly-orc', displayName: 'Crewly Orc', role: 'orchestrator' },
27
+ * // { agentSession: 'dev-ella', displayName: 'Ella', role: 'developer', teamName: 'Web' }]
28
+ * ```
29
+ */
30
+ export declare function buildAgentRoster(teams: readonly Team[]): AgentRosterEntry[];
31
+ //# sourceMappingURL=agent-roster.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-roster.utils.d.ts","sourceRoot":"","sources":["../../../../../../backend/src/services/cloud/agent-roster.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,gBAAgB,EAAE,CAoB3E"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The agent roster this machine reports to Crewly Cloud — on the Slack
3
+ * registry heartbeat and on the conversation uploader's periodic probe — so
4
+ * the portal lists every agent (spec §C.3 `roster[]`), including agents that
5
+ * have no messages yet and machines that do not use Slack.
6
+ *
7
+ * Session names are the machine's own (`crewly-orc` for the orchestrator,
8
+ * never the per-machine Slack spelling), the same names the uploaded
9
+ * conversation log and Cloud Talk use.
10
+ *
11
+ * @module services/cloud/agent-roster.utils
12
+ */
13
+ import { CLOUD_TALK_CONSTANTS, ORCHESTRATOR_SESSION_NAME } from '../../constants.js';
14
+ import { resolveMemberSessionName } from '../../utils/member-session-name.utils.js';
15
+ /**
16
+ * Build the roster: the orchestrator first, then every team member with a
17
+ * session (orchestrator-role members are the orchestrator itself and are
18
+ * skipped). A session listed twice keeps its first entry.
19
+ *
20
+ * @param teams - Stored teams
21
+ * @returns Roster entries
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * buildAgentRoster(await storage.getTeams());
26
+ * // [{ agentSession: 'crewly-orc', displayName: 'Crewly Orc', role: 'orchestrator' },
27
+ * // { agentSession: 'dev-ella', displayName: 'Ella', role: 'developer', teamName: 'Web' }]
28
+ * ```
29
+ */
30
+ export function buildAgentRoster(teams) {
31
+ const out = [
32
+ { agentSession: ORCHESTRATOR_SESSION_NAME, displayName: CLOUD_TALK_CONSTANTS.ORCHESTRATOR_DISPLAY_NAME, role: 'orchestrator' },
33
+ ];
34
+ const seen = new Set([ORCHESTRATOR_SESSION_NAME]);
35
+ for (const team of teams) {
36
+ for (const member of team.members ?? []) {
37
+ if (!member?.id || String(member.role) === 'orchestrator')
38
+ continue;
39
+ const agentSession = resolveMemberSessionName(team.name, member);
40
+ if (!agentSession || seen.has(agentSession))
41
+ continue;
42
+ seen.add(agentSession);
43
+ out.push({
44
+ agentSession,
45
+ displayName: member.name || agentSession,
46
+ ...(member.role ? { role: String(member.role) } : {}),
47
+ ...(team.name ? { teamName: team.name } : {}),
48
+ });
49
+ }
50
+ }
51
+ return out;
52
+ }
53
+ //# sourceMappingURL=agent-roster.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-roster.utils.js","sourceRoot":"","sources":["../../../../../../backend/src/services/cloud/agent-roster.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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L,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -113,7 +113,7 @@ export interface HeartbeatPayload {
113
113
  timestamp: string;
114
114
  }
115
115
  /** All supported message types for inter-device communication. */
116
- export type MessageType = 'command' | 'sync_teams' | 'sync_settings' | 'notification' | 'relay' | 'ping' | 'task_update' | 'agent_message' | 'cross-machine' | 'browser_command' | 'browser_response' | 'chat_request' | 'chat_response' | 'chat_event' | 'slack_event';
116
+ export type MessageType = 'command' | 'sync_teams' | 'sync_settings' | 'notification' | 'relay' | 'ping' | 'task_update' | 'agent_message' | 'cross-machine' | 'browser_command' | 'browser_response' | 'chat_request' | 'chat_response' | 'chat_event' | 'slack_event' | 'talk_message';
117
117
  /** Valid message type values for runtime validation. */
118
118
  export declare const MESSAGE_TYPES: readonly MessageType[];
119
119
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"cloud-sync.types.d.ts","sourceRoot":"","sources":["../../../../../../backend/src/services/cloud/cloud-sync.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,yDAAyD;AACzD,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,cAAc,CAAC;AAE9E,4DAA4D;AAC5D,eAAO,MAAM,iBAAiB,0DAA2D,CAAC;AAE1F;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B,KAAK,EAAE,cAAc,CAAC;IACtB,8EAA8E;IAC9E,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,0DAA0D;IAC1D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,6EAA6E;IAC7E,YAAY,EAAE,OAAO,CAAC;CACvB;AAMD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAA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e,CAW1E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAS1E"}
1
+ {"version":3,"file":"cloud-sync.types.d.ts","sourceRoot":"","sources":["../../../../../../backend/src/services/cloud/cloud-sync.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,yDAAyD;AACzD,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,cAAc,CAAC;AAE9E,4DAA4D;AAC5D,eAAO,MAAM,iBAAiB,0DAA2D,CAAC;AAE1F;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B,KAAK,EAAE,cAAc,CAAC;IACtB,8EAA8E;IAC9E,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,0DAA0D;IAC1D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,6EAA6E;IAC7E,YAAY,EAAE,OAAO,CAAC;CACvB;AAMD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;CACpB;AAMD,+EAA+E;AAC/E,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,qEAAqE;AACrE,MAAM,WAAW,eAAe;IAC9B,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,YAAY,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AO,CAAC;KACnB,CAAC;CACH;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAUhF;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAIlF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAI5E;AAMD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAShE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAW1E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAS1E"}
@@ -27,6 +27,7 @@ export const MESSAGE_TYPES = [
27
27
  'chat_response',
28
28
  'chat_event',
29
29
  'slack_event',
30
+ 'talk_message',
30
31
  ];
31
32
  /**
32
33
  * Check if an object satisfies the AgentMessagePayload interface shape.
@@ -1 +1 @@
1
- {"version":3,"file":"cloud-sync.types.js","sourceRoot":"","sources":["../../../../../../backend/src/services/cloud/cloud-sync.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,4DAA4D;AAC5D,MAAM,CAAC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CACxC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,GAAG,GAAG,KAAgC,CAAC;IAC7C,OAAO,CACL,OAAO,GAAG,CAAC,EAAE,KAAK,QAAQ;QAC1B,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ;QAC5B,OAAO,GAAG,CAAC,cAAc,KAAK,QAAQ;QACtC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;QACvB,OAAO,GAAG,CAAC,SAAS,KAAK,SAAS;QAClC,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,CAC/B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,GAAG,GAAG,KAAgC,CAAC;IAC7C,OAAO,CACL,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ;QAChC,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ;QAC7B,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ;QAChC,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,CACnC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * CloudTalkInboundService — the machine side of Cloud Talk
3
+ * (specs/unified-conversations-cloud-store.md §D.3, Phase 3).
4
+ *
5
+ * The owner talks to an agent from the Crewly Cloud portal. Cloud stores the
6
+ * message and pushes a `talk_message` relay message to this machine with
7
+ * only ids in it (`{messageId, clientMessageId, instanceId, agentSession}`).
8
+ * This service:
9
+ *
10
+ * 1. fetches the text from Cloud with this machine's own Cloud token
11
+ * (`GET /api/cloud/conversations/talk/:messageId?instanceId=`). Cloud only
12
+ * answers for a message stored on the token's account and addressed to
13
+ * this machine, so a push anybody else managed to drop in the relay
14
+ * queue is never delivered;
15
+ * 2. records it in the agent's DM — the channel the dashboard and the
16
+ * agent's Slack DM use — with `source: 'cloud-talk'` and the Talk
17
+ * `clientMessageId` (idempotent: a re-push records nothing new). The
18
+ * conversation uploader then sends it back to Cloud with that
19
+ * `clientMessageId`, which is what marks it `delivered` there;
20
+ * 3. hands it to the agent exactly like a Crewly Chat DM (ticket intake +
21
+ * the chat-v2 dispatcher, which wakes a sleeping agent). The agent
22
+ * answers in that DM; the reply-affinity rule (G6) keeps the answer off
23
+ * Slack because the owner's latest turn there came from Cloud Talk.
24
+ *
25
+ * A message for an agent this machine does not have is refused
26
+ * (`POST …/talk/:messageId/failed`) so the portal says so. Fetch failures are
27
+ * retried a few times; after that Cloud re-pushes the message on its own.
28
+ *
29
+ * Older OSS versions ignore `talk_message` (every relay listener filters on
30
+ * its own `type`), and Cloud only sends it to machines that advertise the
31
+ * `talk_message` capability, which this service turns on when it starts.
32
+ *
33
+ * @module services/cloud/cloud-talk-inbound.service
34
+ */
35
+ import { type ComponentLogger } from '../core/logger.service.js';
36
+ import type { ChatChannelDTO, ChatMessageDTO, ChatPrincipal } from '../chat-v2/types.js';
37
+ import { type CloudTalkChat } from '../chat-v2/owner-inbound.utils.js';
38
+ import type { IncomingMessage } from './cloud-sync.types.js';
39
+ /** Emitter of relay messages (CloudSyncService). */
40
+ export interface CloudTalkSource {
41
+ on(event: 'message', listener: (msg: IncomingMessage) => void): unknown;
42
+ off(event: 'message', listener: (msg: IncomingMessage) => void): unknown;
43
+ }
44
+ /** The Cloud session (CloudClientService). */
45
+ export interface CloudTalkCloud {
46
+ getToken(): string | null;
47
+ getCloudUrl(): string | null;
48
+ /** Refresh an expired access token; true when a new one is in place. */
49
+ tryRefreshToken?(): Promise<boolean>;
50
+ }
51
+ /** The chat-v2 operations needed (ChatV2Service). */
52
+ export interface CloudTalkInboundChat extends CloudTalkChat {
53
+ getChannel(channelId: string, principal: ChatPrincipal): ChatChannelDTO;
54
+ }
55
+ /** `fetch` signature (injectable for tests). */
56
+ export type CloudTalkFetch = (input: string, init: RequestInit) => Promise<Response>;
57
+ /** Constructor dependencies. */
58
+ export interface CloudTalkInboundDeps {
59
+ source: CloudTalkSource;
60
+ cloud: CloudTalkCloud;
61
+ chat: CloudTalkInboundChat;
62
+ /** This machine's id (device id = relay queue id = Cloud instance id) and name. */
63
+ identity: () => Promise<{
64
+ instanceId: string;
65
+ deviceName?: string;
66
+ }>;
67
+ /** Hand the recorded message to the agent (ticket intake + dispatcher). */
68
+ deliver: (channel: ChatChannelDTO, message: ChatMessageDTO) => Promise<void>;
69
+ /** Whether the agent exists here; omitted = assume it does. */
70
+ agentExists?: (agentSession: string) => Promise<boolean>;
71
+ /** Owner principal of the DM channels (default: the single-user OSS owner). */
72
+ ownerUserId?: string;
73
+ fetchImpl?: CloudTalkFetch;
74
+ sleep?: (ms: number) => Promise<void>;
75
+ logger?: ComponentLogger;
76
+ }
77
+ /** What {@link CloudTalkInboundService.handle} did with one push (tests, logs). */
78
+ export type CloudTalkOutcome = 'delivered' | 'duplicate' | 'ignored' | 'not_for_this_machine' | 'unverified' | 'expired' | 'fetch_failed' | 'refused';
79
+ /**
80
+ * Whether the Talk handler is running on this machine — Cloud is told the
81
+ * machine handles `talk_message` only then.
82
+ *
83
+ * @returns True once started
84
+ */
85
+ export declare function isCloudTalkInboundActive(): boolean;
86
+ /**
87
+ * Capabilities to advertise to Cloud (heartbeat and uploads).
88
+ *
89
+ * @returns `['talk_message']` while the handler runs, else `[]`
90
+ */
91
+ export declare function cloudTalkCapabilities(): string[];
92
+ /** Receives Cloud Talk messages — see module docs. */
93
+ export declare class CloudTalkInboundService {
94
+ private readonly deps;
95
+ private readonly logger;
96
+ private readonly fetchImpl;
97
+ private readonly sleep;
98
+ private readonly ownerUserId;
99
+ private readonly inFlight;
100
+ private readonly listener;
101
+ private started;
102
+ constructor(deps: CloudTalkInboundDeps);
103
+ /** Subscribe to relay messages and advertise the capability. Idempotent. */
104
+ start(): void;
105
+ /** Unsubscribe; the capability is no longer advertised. */
106
+ stop(): void;
107
+ /**
108
+ * Handle one relay message. Anything but a well-formed `talk_message` is
109
+ * ignored. Never throws.
110
+ *
111
+ * @param msg - Relay message from CloudSyncService
112
+ * @returns What was done
113
+ */
114
+ handle(msg: IncomingMessage): Promise<CloudTalkOutcome>;
115
+ private process;
116
+ private url;
117
+ /**
118
+ * Fetch the Talk message from Cloud with this machine's token; one token
119
+ * refresh on 401, a few retries on network / 5xx errors.
120
+ */
121
+ private fetchMessage;
122
+ /** Tell Cloud this machine cannot deliver a message (best effort). */
123
+ private reportFailed;
124
+ }
125
+ //# sourceMappingURL=cloud-talk-inbound.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-talk-inbound.service.d.ts","sourceRoot":"","sources":["../../../../../../backend/src/services/cloud/cloud-talk-inbound.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAC5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQ7D,oDAAoD;AACpD,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC;IACxE,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC;CAC1E;AAED,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC7B,QAAQ,IAAI,M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Ac,GACd,SAAS,CAAC;AAId;;;;;GAKG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAElD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD;AAcD,sDAAsD;AACtD,qBAAa,uBAAuB;IAWtB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAVjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IACtD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAEvB;IACF,OAAO,CAAC,OAAO,CAAS;gBAEK,IAAI,EAAE,oBAAoB;IAOvD,4EAA4E;IAC5E,KAAK,IAAI,IAAI;IAQb,2DAA2D;IAC3D,IAAI,IAAI,IAAI;IAOZ;;;;;;OAMG;IACG,MAAM,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;YAsB/C,OAAO;IAiErB,OAAO,CAAC,GAAG;IAKX;;;OAGG;YACW,YAAY;IAwC1B,sEAAsE;YACxD,YAAY;CAgB3B"}
@@ -0,0 +1,272 @@
1
+ /**
2
+ * CloudTalkInboundService — the machine side of Cloud Talk
3
+ * (specs/unified-conversations-cloud-store.md §D.3, Phase 3).
4
+ *
5
+ * The owner talks to an agent from the Crewly Cloud portal. Cloud stores the
6
+ * message and pushes a `talk_message` relay message to this machine with
7
+ * only ids in it (`{messageId, clientMessageId, instanceId, agentSession}`).
8
+ * This service:
9
+ *
10
+ * 1. fetches the text from Cloud with this machine's own Cloud token
11
+ * (`GET /api/cloud/conversations/talk/:messageId?instanceId=`). Cloud only
12
+ * answers for a message stored on the token's account and addressed to
13
+ * this machine, so a push anybody else managed to drop in the relay
14
+ * queue is never delivered;
15
+ * 2. records it in the agent's DM — the channel the dashboard and the
16
+ * agent's Slack DM use — with `source: 'cloud-talk'` and the Talk
17
+ * `clientMessageId` (idempotent: a re-push records nothing new). The
18
+ * conversation uploader then sends it back to Cloud with that
19
+ * `clientMessageId`, which is what marks it `delivered` there;
20
+ * 3. hands it to the agent exactly like a Crewly Chat DM (ticket intake +
21
+ * the chat-v2 dispatcher, which wakes a sleeping agent). The agent
22
+ * answers in that DM; the reply-affinity rule (G6) keeps the answer off
23
+ * Slack because the owner's latest turn there came from Cloud Talk.
24
+ *
25
+ * A message for an agent this machine does not have is refused
26
+ * (`POST …/talk/:messageId/failed`) so the portal says so. Fetch failures are
27
+ * retried a few times; after that Cloud re-pushes the message on its own.
28
+ *
29
+ * Older OSS versions ignore `talk_message` (every relay listener filters on
30
+ * its own `type`), and Cloud only sends it to machines that advertise the
31
+ * `talk_message` capability, which this service turns on when it starts.
32
+ *
33
+ * @module services/cloud/cloud-talk-inbound.service
34
+ */
35
+ import { CLOUD_TALK_CONSTANTS, ORCHESTRATOR_SESSION_NAME, SLACK_AGENT_DM_CONSTANTS } from '../../constants.js';
36
+ import { LoggerService } from '../core/logger.service.js';
37
+ import { recordCloudTalkTurn } from '../chat-v2/owner-inbound.utils.js';
38
+ import { parseTalkFetchResponse, parseTalkRelayData, } from './conversation-ingest.contract.js';
39
+ let active = false;
40
+ /**
41
+ * Whether the Talk handler is running on this machine — Cloud is told the
42
+ * machine handles `talk_message` only then.
43
+ *
44
+ * @returns True once started
45
+ */
46
+ export function isCloudTalkInboundActive() {
47
+ return active;
48
+ }
49
+ /**
50
+ * Capabilities to advertise to Cloud (heartbeat and uploads).
51
+ *
52
+ * @returns `['talk_message']` while the handler runs, else `[]`
53
+ */
54
+ export function cloudTalkCapabilities() {
55
+ return active ? [CLOUD_TALK_CONSTANTS.CAPABILITY] : [];
56
+ }
57
+ /**
58
+ * The machine's own session name for an agent Cloud names. Cloud already
59
+ * uses local names; the per-machine Slack spelling of the orchestrator
60
+ * (`crewly-orc@<instance>`) is folded back defensively.
61
+ *
62
+ * @param agentSession - Session as Cloud sent it
63
+ * @returns Local session name
64
+ */
65
+ function localSession(agentSession) {
66
+ return agentSession.startsWith(`${ORCHESTRATOR_SESSION_NAME}@`) ? ORCHESTRATOR_SESSION_NAME : agentSession;
67
+ }
68
+ /** Receives Cloud Talk messages — see module docs. */
69
+ export class CloudTalkInboundService {
70
+ deps;
71
+ logger;
72
+ fetchImpl;
73
+ sleep;
74
+ ownerUserId;
75
+ inFlight = new Set();
76
+ listener = (msg) => {
77
+ void this.handle(msg);
78
+ };
79
+ started = false;
80
+ constructor(deps) {
81
+ this.deps = deps;
82
+ this.logger = deps.logger ?? LoggerService.getInstance().createComponentLogger('CloudTalkInbound');
83
+ this.fetchImpl = deps.fetchImpl ?? ((input, init) => fetch(input, init));
84
+ this.sleep = deps.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
85
+ this.ownerUserId = deps.ownerUserId ?? SLACK_AGENT_DM_CONSTANTS.OWNER_USER_ID;
86
+ }
87
+ /** Subscribe to relay messages and advertise the capability. Idempotent. */
88
+ start() {
89
+ if (this.started)
90
+ return;
91
+ this.started = true;
92
+ this.deps.source.on('message', this.listener);
93
+ active = true;
94
+ this.logger.info('Cloud Talk handler started');
95
+ }
96
+ /** Unsubscribe; the capability is no longer advertised. */
97
+ stop() {
98
+ if (!this.started)
99
+ return;
100
+ this.started = false;
101
+ this.deps.source.off('message', this.listener);
102
+ active = false;
103
+ }
104
+ /**
105
+ * Handle one relay message. Anything but a well-formed `talk_message` is
106
+ * ignored. Never throws.
107
+ *
108
+ * @param msg - Relay message from CloudSyncService
109
+ * @returns What was done
110
+ */
111
+ async handle(msg) {
112
+ if (msg?.type !== CLOUD_TALK_CONSTANTS.RELAY_MESSAGE_TYPE)
113
+ return 'ignored';
114
+ const data = parseTalkRelayData(msg.payload);
115
+ if (!data) {
116
+ this.logger.warn('Ignored a malformed talk_message relay message');
117
+ return 'ignored';
118
+ }
119
+ if (this.inFlight.has(data.messageId))
120
+ return 'duplicate';
121
+ this.inFlight.add(data.messageId);
122
+ try {
123
+ return await this.process(data);
124
+ }
125
+ catch (error) {
126
+ this.logger.warn('Cloud Talk message handling failed', {
127
+ messageId: data.messageId,
128
+ error: error instanceof Error ? error.message : String(error),
129
+ });
130
+ return 'fetch_failed';
131
+ }
132
+ finally {
133
+ this.inFlight.delete(data.messageId);
134
+ }
135
+ }
136
+ async process(data) {
137
+ const { instanceId, deviceName } = await this.deps.identity();
138
+ if (data.instanceId !== instanceId) {
139
+ this.logger.warn('Ignored a talk_message addressed to another machine', { target: data.instanceId });
140
+ return 'not_for_this_machine';
141
+ }
142
+ const fetched = await this.fetchMessage(data, instanceId);
143
+ if (fetched.kind === 'not_found') {
144
+ // Not a message Cloud stored for this account and machine: not from Cloud.
145
+ this.logger.warn('Ignored a talk_message Crewly Cloud does not know for this machine', { messageId: data.messageId });
146
+ return 'unverified';
147
+ }
148
+ if (fetched.kind === 'expired') {
149
+ this.logger.info('Skipped a Cloud Talk message already marked as not delivered', { messageId: data.messageId });
150
+ return 'expired';
151
+ }
152
+ if (fetched.kind === 'error') {
153
+ this.logger.warn('Could not fetch a Cloud Talk message; Cloud will push it again', { messageId: data.messageId, error: fetched.error });
154
+ return 'fetch_failed';
155
+ }
156
+ const message = fetched.message;
157
+ if (message.clientMessageId !== data.clientMessageId || message.agentSession !== data.agentSession || message.instanceId !== instanceId) {
158
+ this.logger.warn('Ignored a talk_message that does not match what Cloud stored', { messageId: data.messageId });
159
+ return 'unverified';
160
+ }
161
+ const agentSession = localSession(message.agentSession);
162
+ if (this.deps.agentExists && !(await this.deps.agentExists(agentSession))) {
163
+ await this.reportFailed(data, instanceId, `No agent named "${agentSession}" on ${deviceName || 'this machine'}`);
164
+ return 'refused';
165
+ }
166
+ let recorded;
167
+ try {
168
+ recorded = recordCloudTalkTurn(this.deps.chat, {
169
+ agentSession,
170
+ text: message.text,
171
+ clientMessageId: message.clientMessageId,
172
+ ownerUserId: this.ownerUserId,
173
+ });
174
+ }
175
+ catch (error) {
176
+ const reason = error instanceof Error ? error.message : String(error);
177
+ await this.reportFailed(data, instanceId, `Could not record the message on ${deviceName || 'this machine'}: ${reason}`);
178
+ return 'refused';
179
+ }
180
+ if (recorded.deduped) {
181
+ // Already recorded (a re-push); the upload has confirmed it or will.
182
+ return 'duplicate';
183
+ }
184
+ this.logger.info('Cloud Talk message received', { agentSession, messageId: data.messageId });
185
+ try {
186
+ const channel = this.deps.chat.getChannel(recorded.channelId, { userId: this.ownerUserId, source: 'oss' });
187
+ await this.deps.deliver(channel, recorded.message);
188
+ }
189
+ catch (error) {
190
+ // Recorded (so Cloud shows it delivered), but the agent was not paged.
191
+ this.logger.warn('Cloud Talk message recorded but not handed to the agent', {
192
+ agentSession,
193
+ error: error instanceof Error ? error.message : String(error),
194
+ });
195
+ }
196
+ return 'delivered';
197
+ }
198
+ url(suffix) {
199
+ const base = this.deps.cloud.getCloudUrl();
200
+ return base ? `${base.replace(/\/$/, '')}${CLOUD_TALK_CONSTANTS.MESSAGE_PATH}${suffix}` : null;
201
+ }
202
+ /**
203
+ * Fetch the Talk message from Cloud with this machine's token; one token
204
+ * refresh on 401, a few retries on network / 5xx errors.
205
+ */
206
+ async fetchMessage(data, instanceId) {
207
+ const url = this.url(`/${encodeURIComponent(data.messageId)}?instanceId=${encodeURIComponent(instanceId)}`);
208
+ if (!url)
209
+ return { kind: 'error', error: 'not signed in to Crewly Cloud' };
210
+ const delays = CLOUD_TALK_CONSTANTS.FETCH_RETRY_DELAYS_MS;
211
+ let refreshed = false;
212
+ let lastError = 'unknown';
213
+ for (let attempt = 0; attempt <= delays.length; attempt++) {
214
+ if (attempt > 0)
215
+ await this.sleep(delays[attempt - 1]);
216
+ const token = this.deps.cloud.getToken();
217
+ if (!token)
218
+ return { kind: 'error', error: 'not signed in to Crewly Cloud' };
219
+ let response;
220
+ try {
221
+ response = await this.fetchImpl(url, {
222
+ method: 'GET',
223
+ headers: { Authorization: `Bearer ${token}` },
224
+ signal: AbortSignal.timeout(CLOUD_TALK_CONSTANTS.REQUEST_TIMEOUT_MS),
225
+ });
226
+ }
227
+ catch (error) {
228
+ lastError = error instanceof Error ? error.message : String(error);
229
+ continue;
230
+ }
231
+ if (response.status === 401 && !refreshed && this.deps.cloud.tryRefreshToken) {
232
+ refreshed = true;
233
+ if (await this.deps.cloud.tryRefreshToken().catch(() => false)) {
234
+ attempt--; // the retry with the new token is free
235
+ continue;
236
+ }
237
+ }
238
+ if (response.status === 404)
239
+ return { kind: 'not_found' };
240
+ if (response.status === 410)
241
+ return { kind: 'expired' };
242
+ if (response.ok) {
243
+ const parsed = parseTalkFetchResponse(await response.json().catch(() => null));
244
+ return parsed ? { kind: 'ok', message: parsed } : { kind: 'error', error: 'unusable response from Crewly Cloud' };
245
+ }
246
+ lastError = `HTTP ${response.status}`;
247
+ if (response.status >= 400 && response.status < 500 && response.status !== 429)
248
+ break;
249
+ }
250
+ return { kind: 'error', error: lastError };
251
+ }
252
+ /** Tell Cloud this machine cannot deliver a message (best effort). */
253
+ async reportFailed(data, instanceId, error) {
254
+ this.logger.warn('Cloud Talk message refused', { messageId: data.messageId, error });
255
+ const url = this.url(`/${encodeURIComponent(data.messageId)}/failed`);
256
+ const token = this.deps.cloud.getToken();
257
+ if (!url || !token)
258
+ return;
259
+ try {
260
+ await this.fetchImpl(url, {
261
+ method: 'POST',
262
+ headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
263
+ body: JSON.stringify({ instanceId, error }),
264
+ signal: AbortSignal.timeout(CLOUD_TALK_CONSTANTS.REQUEST_TIMEOUT_MS),
265
+ });
266
+ }
267
+ catch {
268
+ // Cloud marks it failed after 24 h anyway.
269
+ }
270
+ }
271
+ }
272
+ //# sourceMappingURL=cloud-talk-inbound.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-talk-inbound.service.js","sourceRoot":"","sources":["../../../../../../backend/src/services/cloud/cloud-talk-inbound.service.ts"],"names":[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AE,UAAU,EAAE,KAAK,EAAE,CAAC;gBAC3C,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,oBAAoB,CAAC,kBAAkB,CAAC;aACrE,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACP,2CAA2C;QAC7C,CAAC;IACH,CAAC;CACF"}
@@ -20,6 +20,11 @@
20
20
  * (or `CREWLY_CLOUD_CONVERSATIONS=off`) turns uploading off; the outbox
21
21
  * still fills.
22
22
  * - **O4:** text only — attachments go as name / size / mime.
23
+ * - **Roster (Cloud Talk, Phase 3):** every 5 minutes, and whenever the
24
+ * advertised capabilities change, an empty batch carries this machine's
25
+ * agent roster and capabilities (`talk_message`), so Cloud lists agents
26
+ * that have no messages yet and knows Talk can be sent here — also on
27
+ * machines that do not use Slack (and so never send the Slack heartbeat).
23
28
  *
24
29
  * The wire contract lives in `conversation-ingest.contract.ts`.
25
30
  *
@@ -27,7 +32,7 @@
27
32
  */
28
33
  import { type ComponentLogger } from '../core/logger.service.js';
29
34
  import type { BackfillCursor, OutboxEntry, UploadMessageRow } from '../chat-v2/sqlite/cloud-outbox.store.js';
30
- import { type IngestUpsert } from './conversation-ingest.contract.js';
35
+ import { type AgentRosterEntry, type IngestUpsert } from './conversation-ingest.contract.js';
31
36
  /** The outbox operations the uploader needs (see `CloudOutboxStore`). */
32
37
  export interface ConversationOutbox {
33
38
  peek(limit: number): OutboxEntry[];
@@ -72,6 +77,10 @@ export interface ConversationCloudSyncDeps {
72
77
  reclassifyOwnerRows?: () => void;
73
78
  /** O1: tell the owner once that history now syncs. Resolves true when the DM was posted. */
74
79
  notifyOwner?: (text: string) => Promise<boolean>;
80
+ /** This machine's agents, reported every few minutes (Cloud lists them before they have messages). */
81
+ roster?: () => Promise<AgentRosterEntry[]>;
82
+ /** What this machine handles right now (e.g. `talk_message`); a change is reported at once. */
83
+ capabilities?: () => string[];
75
84
  /** Environment (kill switch). Defaults to `process.env`. */
76
85
  env?: NodeJS.ProcessEnv;
77
86
  fetchImpl?: SyncFetch;
@@ -129,6 +138,9 @@ export declare class ConversationCloudSyncService {
129
138
  private lastBackfillAt;
130
139
  private lastNoticeAttemptAt;
131
140
  private gapLogged;
141
+ /** When the roster last reached Cloud, and the capabilities it carried. */
142
+ private lastRosterAt;
143
+ private lastCapabilitiesKey;
132
144
  constructor(deps: ConversationCloudSyncDeps);
133
145
  /** Start the tick and the new-message wake-up. Idempotent; never throws. */
134
146
  start(): void;
@@ -150,6 +162,14 @@ export declare class ConversationCloudSyncService {
150
162
  private scheduleTick;
151
163
  /** One pass: trim, check the session, drain live, then one backfill step. */
152
164
  private pass;
165
+ /**
166
+ * The roster and capabilities when they are due: every
167
+ * {@link CLOUD_TALK_CONSTANTS.ROSTER_INTERVAL_MS}, or at once when the
168
+ * capabilities changed (the Talk handler starting after the uploader).
169
+ *
170
+ * @returns The fields to send, or null when nothing is due
171
+ */
172
+ private rosterIfDue;
153
173
  /**
154
174
  * Upload every waiting outbox row, oldest first.
155
175
  *