digital-workers 0.1.1 → 2.0.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 (83) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +9 -0
  3. package/README.md +290 -106
  4. package/dist/actions.d.ts +95 -0
  5. package/dist/actions.d.ts.map +1 -0
  6. package/dist/actions.js +437 -0
  7. package/dist/actions.js.map +1 -0
  8. package/dist/approve.d.ts +49 -0
  9. package/dist/approve.d.ts.map +1 -0
  10. package/dist/approve.js +235 -0
  11. package/dist/approve.js.map +1 -0
  12. package/dist/ask.d.ts +42 -0
  13. package/dist/ask.d.ts.map +1 -0
  14. package/dist/ask.js +227 -0
  15. package/dist/ask.js.map +1 -0
  16. package/dist/decide.d.ts +62 -0
  17. package/dist/decide.d.ts.map +1 -0
  18. package/dist/decide.js +245 -0
  19. package/dist/decide.js.map +1 -0
  20. package/dist/do.d.ts +63 -0
  21. package/dist/do.d.ts.map +1 -0
  22. package/dist/do.js +228 -0
  23. package/dist/do.js.map +1 -0
  24. package/dist/generate.d.ts +61 -0
  25. package/dist/generate.d.ts.map +1 -0
  26. package/dist/generate.js +299 -0
  27. package/dist/generate.js.map +1 -0
  28. package/dist/goals.d.ts +89 -0
  29. package/dist/goals.d.ts.map +1 -0
  30. package/dist/goals.js +206 -0
  31. package/dist/goals.js.map +1 -0
  32. package/dist/index.d.ts +68 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +69 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/is.d.ts +54 -0
  37. package/dist/is.d.ts.map +1 -0
  38. package/dist/is.js +318 -0
  39. package/dist/is.js.map +1 -0
  40. package/dist/kpis.d.ts +103 -0
  41. package/dist/kpis.d.ts.map +1 -0
  42. package/dist/kpis.js +271 -0
  43. package/dist/kpis.js.map +1 -0
  44. package/dist/notify.d.ts +47 -0
  45. package/dist/notify.d.ts.map +1 -0
  46. package/dist/notify.js +220 -0
  47. package/dist/notify.js.map +1 -0
  48. package/dist/role.d.ts +53 -0
  49. package/dist/role.d.ts.map +1 -0
  50. package/dist/role.js +111 -0
  51. package/dist/role.js.map +1 -0
  52. package/dist/team.d.ts +61 -0
  53. package/dist/team.d.ts.map +1 -0
  54. package/dist/team.js +131 -0
  55. package/dist/team.js.map +1 -0
  56. package/dist/transports.d.ts +164 -0
  57. package/dist/transports.d.ts.map +1 -0
  58. package/dist/transports.js +358 -0
  59. package/dist/transports.js.map +1 -0
  60. package/dist/types.d.ts +693 -0
  61. package/dist/types.d.ts.map +1 -0
  62. package/dist/types.js +72 -0
  63. package/dist/types.js.map +1 -0
  64. package/package.json +27 -61
  65. package/src/actions.ts +615 -0
  66. package/src/approve.ts +317 -0
  67. package/src/ask.ts +304 -0
  68. package/src/decide.ts +295 -0
  69. package/src/do.ts +275 -0
  70. package/src/generate.ts +364 -0
  71. package/src/goals.ts +220 -0
  72. package/src/index.ts +118 -0
  73. package/src/is.ts +372 -0
  74. package/src/kpis.ts +348 -0
  75. package/src/notify.ts +303 -0
  76. package/src/role.ts +116 -0
  77. package/src/team.ts +142 -0
  78. package/src/transports.ts +504 -0
  79. package/src/types.ts +843 -0
  80. package/test/actions.test.ts +546 -0
  81. package/test/standalone.test.ts +299 -0
  82. package/test/types.test.ts +460 -0
  83. package/tsconfig.json +9 -0
package/dist/role.js ADDED
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Role definition for digital workers
3
+ */
4
+ /**
5
+ * Define a worker role
6
+ *
7
+ * Roles define responsibilities, skills, and permissions for workers
8
+ * (both AI agents and humans) within an organization.
9
+ *
10
+ * @param definition - Role definition
11
+ * @returns The defined role
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const engineer = Role({
16
+ * name: 'Software Engineer',
17
+ * description: 'Builds and maintains software systems',
18
+ * responsibilities: [
19
+ * 'Write clean, maintainable code',
20
+ * 'Review pull requests',
21
+ * 'Fix bugs and issues',
22
+ * 'Participate in architecture decisions',
23
+ * ],
24
+ * skills: ['TypeScript', 'React', 'Node.js'],
25
+ * type: 'hybrid', // Can be filled by AI or human
26
+ * })
27
+ * ```
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const supportAgent = Role({
32
+ * name: 'Customer Support Agent',
33
+ * description: 'Assists customers with inquiries and issues',
34
+ * responsibilities: [
35
+ * 'Respond to customer inquiries',
36
+ * 'Troubleshoot issues',
37
+ * 'Escalate complex problems',
38
+ * 'Maintain customer satisfaction',
39
+ * ],
40
+ * type: 'ai', // AI-first role
41
+ * })
42
+ * ```
43
+ */
44
+ export function Role(definition) {
45
+ return {
46
+ type: 'hybrid', // Default to hybrid (can be AI or human)
47
+ ...definition,
48
+ };
49
+ }
50
+ /**
51
+ * Create an AI-specific role
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const dataAnalyst = Role.ai({
56
+ * name: 'Data Analyst',
57
+ * description: 'Analyzes data and generates insights',
58
+ * responsibilities: [
59
+ * 'Process large datasets',
60
+ * 'Generate reports',
61
+ * 'Identify trends and patterns',
62
+ * ],
63
+ * })
64
+ * ```
65
+ */
66
+ Role.ai = (definition) => ({
67
+ ...definition,
68
+ type: 'ai',
69
+ });
70
+ /**
71
+ * Create a human-specific role
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * const manager = Role.human({
76
+ * name: 'Engineering Manager',
77
+ * description: 'Leads engineering team and makes strategic decisions',
78
+ * responsibilities: [
79
+ * 'Team leadership and mentoring',
80
+ * 'Strategic planning',
81
+ * 'Performance reviews',
82
+ * 'Budget management',
83
+ * ],
84
+ * })
85
+ * ```
86
+ */
87
+ Role.human = (definition) => ({
88
+ ...definition,
89
+ type: 'human',
90
+ });
91
+ /**
92
+ * Create a hybrid role (can be AI or human)
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * const contentWriter = Role.hybrid({
97
+ * name: 'Content Writer',
98
+ * description: 'Creates written content for various channels',
99
+ * responsibilities: [
100
+ * 'Write blog posts and articles',
101
+ * 'Create marketing copy',
102
+ * 'Edit and proofread content',
103
+ * ],
104
+ * })
105
+ * ```
106
+ */
107
+ Role.hybrid = (definition) => ({
108
+ ...definition,
109
+ type: 'hybrid',
110
+ });
111
+ //# sourceMappingURL=role.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.js","sourceRoot":"","sources":["../src/role.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,IAAI,CAAC,UAAoE;IACvF,OAAO;QACL,IAAI,EAAE,QAAQ,EAAE,yCAAyC;QACzD,GAAG,UAAU;KACd,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,IAAI,CAAC,EAAE,GAAG,CAAC,UAAoC,EAAc,EAAE,CAAC,CAAC;IAC/D,GAAG,UAAU;IACb,IAAI,EAAE,IAAI;CACX,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,IAAI,CAAC,KAAK,GAAG,CAAC,UAAoC,EAAc,EAAE,CAAC,CAAC;IAClE,GAAG,UAAU;IACb,IAAI,EAAE,OAAO;CACd,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;GAeG;AACH,IAAI,CAAC,MAAM,GAAG,CAAC,UAAoC,EAAc,EAAE,CAAC,CAAC;IACnE,GAAG,UAAU;IACb,IAAI,EAAE,QAAQ;CACf,CAAC,CAAA"}
package/dist/team.d.ts ADDED
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Team definition for digital workers
3
+ */
4
+ import type { WorkerTeam } from './types.js';
5
+ /**
6
+ * Define a team of workers
7
+ *
8
+ * Teams organize workers (AI agents and humans) into cohesive units
9
+ * with shared goals and responsibilities.
10
+ *
11
+ * @param definition - Team definition
12
+ * @returns The defined team
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const engineeringTeam = Team({
17
+ * name: 'Engineering',
18
+ * description: 'Product engineering team',
19
+ * members: [
20
+ * { id: 'alice', name: 'Alice', role: 'Senior Engineer', type: 'human' },
21
+ * { id: 'bob', name: 'Bob', role: 'Engineer', type: 'human' },
22
+ * { id: 'ai-reviewer', name: 'Code Reviewer', role: 'Code Reviewer', type: 'ai' },
23
+ * { id: 'ai-tester', name: 'Test Generator', role: 'Test Engineer', type: 'ai' },
24
+ * ],
25
+ * goals: [
26
+ * 'Ship features on schedule',
27
+ * 'Maintain code quality',
28
+ * 'Reduce technical debt',
29
+ * ],
30
+ * lead: 'alice',
31
+ * })
32
+ * ```
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const supportTeam = Team({
37
+ * name: 'Customer Support',
38
+ * description: '24/7 customer support team',
39
+ * members: [
40
+ * { id: 'support-ai-1', name: 'Support Bot Alpha', role: 'Support Agent', type: 'ai' },
41
+ * { id: 'support-ai-2', name: 'Support Bot Beta', role: 'Support Agent', type: 'ai' },
42
+ * { id: 'escalation-human', name: 'Jane', role: 'Senior Support', type: 'human' },
43
+ * ],
44
+ * goals: [
45
+ * 'Maintain 95% satisfaction rate',
46
+ * 'Response time under 5 minutes',
47
+ * 'First contact resolution > 80%',
48
+ * ],
49
+ * lead: 'escalation-human',
50
+ * })
51
+ * ```
52
+ */
53
+ export declare function Team(definition: WorkerTeam): WorkerTeam;
54
+ export declare namespace Team {
55
+ var addMember: (team: WorkerTeam, member: WorkerTeam["members"][number]) => WorkerTeam;
56
+ var removeMember: (team: WorkerTeam, memberId: string) => WorkerTeam;
57
+ var aiMembers: (team: WorkerTeam) => import("./types.js").WorkerRef[];
58
+ var humanMembers: (team: WorkerTeam) => import("./types.js").WorkerRef[];
59
+ var byRole: (team: WorkerTeam, role: string) => import("./types.js").WorkerRef[];
60
+ }
61
+ //# sourceMappingURL=team.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team.d.ts","sourceRoot":"","sources":["../src/team.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAEvD;yBAFe,IAAI;0BAsBZ,UAAU,UACR,UAAU,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KACpC,UAAU;6BAiBc,UAAU,YAAY,MAAM,KAAG,UAAU;0BAiB5C,UAAU;6BAcP,UAAU;uBAchB,UAAU,QAAQ,MAAM"}
package/dist/team.js ADDED
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Team definition for digital workers
3
+ */
4
+ /**
5
+ * Define a team of workers
6
+ *
7
+ * Teams organize workers (AI agents and humans) into cohesive units
8
+ * with shared goals and responsibilities.
9
+ *
10
+ * @param definition - Team definition
11
+ * @returns The defined team
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const engineeringTeam = Team({
16
+ * name: 'Engineering',
17
+ * description: 'Product engineering team',
18
+ * members: [
19
+ * { id: 'alice', name: 'Alice', role: 'Senior Engineer', type: 'human' },
20
+ * { id: 'bob', name: 'Bob', role: 'Engineer', type: 'human' },
21
+ * { id: 'ai-reviewer', name: 'Code Reviewer', role: 'Code Reviewer', type: 'ai' },
22
+ * { id: 'ai-tester', name: 'Test Generator', role: 'Test Engineer', type: 'ai' },
23
+ * ],
24
+ * goals: [
25
+ * 'Ship features on schedule',
26
+ * 'Maintain code quality',
27
+ * 'Reduce technical debt',
28
+ * ],
29
+ * lead: 'alice',
30
+ * })
31
+ * ```
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const supportTeam = Team({
36
+ * name: 'Customer Support',
37
+ * description: '24/7 customer support team',
38
+ * members: [
39
+ * { id: 'support-ai-1', name: 'Support Bot Alpha', role: 'Support Agent', type: 'ai' },
40
+ * { id: 'support-ai-2', name: 'Support Bot Beta', role: 'Support Agent', type: 'ai' },
41
+ * { id: 'escalation-human', name: 'Jane', role: 'Senior Support', type: 'human' },
42
+ * ],
43
+ * goals: [
44
+ * 'Maintain 95% satisfaction rate',
45
+ * 'Response time under 5 minutes',
46
+ * 'First contact resolution > 80%',
47
+ * ],
48
+ * lead: 'escalation-human',
49
+ * })
50
+ * ```
51
+ */
52
+ export function Team(definition) {
53
+ return definition;
54
+ }
55
+ /**
56
+ * Add a member to a team
57
+ *
58
+ * @param team - The team to add to
59
+ * @param member - The member to add
60
+ * @returns Updated team
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const updatedTeam = Team.addMember(engineeringTeam, {
65
+ * id: 'charlie',
66
+ * name: 'Charlie',
67
+ * role: 'Junior Engineer',
68
+ * type: 'human',
69
+ * })
70
+ * ```
71
+ */
72
+ Team.addMember = (team, member) => ({
73
+ ...team,
74
+ members: [...team.members, member],
75
+ });
76
+ /**
77
+ * Remove a member from a team
78
+ *
79
+ * @param team - The team to remove from
80
+ * @param memberId - ID of the member to remove
81
+ * @returns Updated team
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const updatedTeam = Team.removeMember(engineeringTeam, 'bob')
86
+ * ```
87
+ */
88
+ Team.removeMember = (team, memberId) => ({
89
+ ...team,
90
+ members: team.members.filter((m) => m.id !== memberId),
91
+ });
92
+ /**
93
+ * Get all AI members of a team
94
+ *
95
+ * @param team - The team
96
+ * @returns Array of AI members
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const aiMembers = Team.aiMembers(supportTeam)
101
+ * console.log(aiMembers) // [Support Bot Alpha, Support Bot Beta]
102
+ * ```
103
+ */
104
+ Team.aiMembers = (team) => team.members.filter((m) => m.type === 'agent');
105
+ /**
106
+ * Get all human members of a team
107
+ *
108
+ * @param team - The team
109
+ * @returns Array of human members
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * const humans = Team.humanMembers(engineeringTeam)
114
+ * console.log(humans) // [Alice, Bob]
115
+ * ```
116
+ */
117
+ Team.humanMembers = (team) => team.members.filter((m) => m.type === 'human');
118
+ /**
119
+ * Get members by role
120
+ *
121
+ * @param team - The team
122
+ * @param role - Role to filter by
123
+ * @returns Array of members with that role
124
+ *
125
+ * @example
126
+ * ```ts
127
+ * const engineers = Team.byRole(engineeringTeam, 'Engineer')
128
+ * ```
129
+ */
130
+ Team.byRole = (team, role) => team.members.filter((m) => m.role === role);
131
+ //# sourceMappingURL=team.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team.js","sourceRoot":"","sources":["../src/team.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,UAAU,IAAI,CAAC,UAAsB;IACzC,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,IAAI,CAAC,SAAS,GAAG,CACf,IAAgB,EAChB,MAAqC,EACzB,EAAE,CAAC,CAAC;IAChB,GAAG,IAAI;IACP,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;CACnC,CAAC,CAAA;AAEF;;;;;;;;;;;GAWG;AACH,IAAI,CAAC,YAAY,GAAG,CAAC,IAAgB,EAAE,QAAgB,EAAc,EAAE,CAAC,CAAC;IACvE,GAAG,IAAI;IACP,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC;CACvD,CAAC,CAAA;AAEF;;;;;;;;;;;GAWG;AACH,IAAI,CAAC,SAAS,GAAG,CAAC,IAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAA;AAErF;;;;;;;;;;;GAWG;AACH,IAAI,CAAC,YAAY,GAAG,CAAC,IAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAA;AAExF;;;;;;;;;;;GAWG;AACH,IAAI,CAAC,MAAM,GAAG,CAAC,IAAgB,EAAE,IAAY,EAAE,EAAE,CAC/C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA"}
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Communication Transports Bridge
3
+ *
4
+ * Connects digital-workers contact channels to digital-tools
5
+ * communication providers (Message, Call).
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import type { Worker, Team, Contacts, ContactChannel, NotifyActionData, AskActionData, ApproveActionData } from './types.js';
10
+ /**
11
+ * Communication transport - maps contact channels to delivery mechanisms
12
+ */
13
+ export type Transport = 'email' | 'sms' | 'voice' | 'slack' | 'teams' | 'discord' | 'whatsapp' | 'telegram' | 'web' | 'webhook';
14
+ /**
15
+ * Transport configuration
16
+ */
17
+ export interface TransportConfig {
18
+ transport: Transport;
19
+ provider?: string;
20
+ apiKey?: string;
21
+ apiUrl?: string;
22
+ options?: Record<string, unknown>;
23
+ }
24
+ /**
25
+ * Message payload for transport
26
+ */
27
+ export interface MessagePayload {
28
+ to: string | string[];
29
+ from?: string;
30
+ replyTo?: string;
31
+ subject?: string;
32
+ body: string;
33
+ html?: string;
34
+ type: 'notification' | 'question' | 'approval';
35
+ priority?: 'low' | 'normal' | 'high' | 'urgent';
36
+ threadId?: string;
37
+ metadata?: Record<string, unknown>;
38
+ actions?: MessageAction[];
39
+ schema?: unknown;
40
+ timeout?: number;
41
+ }
42
+ /**
43
+ * Interactive message action
44
+ */
45
+ export interface MessageAction {
46
+ id: string;
47
+ label: string;
48
+ style?: 'primary' | 'secondary' | 'danger';
49
+ value?: unknown;
50
+ }
51
+ /**
52
+ * Transport delivery result
53
+ */
54
+ export interface DeliveryResult {
55
+ success: boolean;
56
+ transport: Transport;
57
+ messageId?: string;
58
+ error?: string;
59
+ metadata?: Record<string, unknown>;
60
+ }
61
+ /**
62
+ * Map contact channel to transport
63
+ */
64
+ export declare function channelToTransport(channel: ContactChannel): Transport;
65
+ /**
66
+ * Get available transports for a worker
67
+ */
68
+ export declare function getWorkerTransports(worker: Worker): Transport[];
69
+ /**
70
+ * Get team transports (union of all member transports + team contacts)
71
+ */
72
+ export declare function getTeamTransports(team: Team): Transport[];
73
+ /**
74
+ * Identifier for a communication address
75
+ */
76
+ export interface Address {
77
+ transport: Transport;
78
+ value: string;
79
+ name?: string;
80
+ metadata?: Record<string, unknown>;
81
+ }
82
+ /**
83
+ * Resolve contact to address
84
+ */
85
+ export declare function resolveAddress(contacts: Contacts, channel: ContactChannel): Address | null;
86
+ /**
87
+ * Resolve all addresses for a worker
88
+ */
89
+ export declare function resolveWorkerAddresses(worker: Worker): Address[];
90
+ /**
91
+ * Get primary address for a worker based on preferences
92
+ */
93
+ export declare function getPrimaryAddress(worker: Worker): Address | null;
94
+ /**
95
+ * Transport handler function type
96
+ */
97
+ export type TransportHandler = (payload: MessagePayload, config: TransportConfig) => Promise<DeliveryResult>;
98
+ /**
99
+ * Register a transport handler
100
+ */
101
+ export declare function registerTransport(transport: Transport, handler: TransportHandler): void;
102
+ /**
103
+ * Get transport handler
104
+ */
105
+ export declare function getTransportHandler(transport: Transport): TransportHandler | undefined;
106
+ /**
107
+ * Check if transport is registered
108
+ */
109
+ export declare function hasTransport(transport: Transport): boolean;
110
+ /**
111
+ * List registered transports
112
+ */
113
+ export declare function listTransports(): Transport[];
114
+ /**
115
+ * Send via transport
116
+ */
117
+ export declare function sendViaTransport(transport: Transport, payload: MessagePayload, config?: TransportConfig): Promise<DeliveryResult>;
118
+ /**
119
+ * Send to multiple transports (fan-out)
120
+ */
121
+ export declare function sendToMultipleTransports(transports: Transport[], payload: MessagePayload, configs?: Record<Transport, TransportConfig>): Promise<DeliveryResult[]>;
122
+ /**
123
+ * Build message payload from notify action
124
+ */
125
+ export declare function buildNotifyPayload(action: NotifyActionData): MessagePayload;
126
+ /**
127
+ * Build message payload from ask action
128
+ */
129
+ export declare function buildAskPayload(action: AskActionData): MessagePayload;
130
+ /**
131
+ * Build message payload from approve action
132
+ */
133
+ export declare function buildApprovePayload(action: ApproveActionData): MessagePayload;
134
+ /**
135
+ * Message type mapping (from digital-tools)
136
+ */
137
+ export declare const MessageTypeMapping: {
138
+ readonly email: "email";
139
+ readonly sms: "text";
140
+ readonly slack: "chat";
141
+ readonly teams: "chat";
142
+ readonly discord: "chat";
143
+ readonly whatsapp: "text";
144
+ readonly telegram: "text";
145
+ readonly voice: "voicemail";
146
+ };
147
+ /**
148
+ * Call type mapping (from digital-tools)
149
+ */
150
+ export declare const CallTypeMapping: {
151
+ readonly phone: "phone";
152
+ readonly voice: "phone";
153
+ readonly web: "web";
154
+ readonly video: "video";
155
+ };
156
+ /**
157
+ * Convert worker notification to digital-tools Message format
158
+ */
159
+ export declare function toDigitalToolsMessage(payload: MessagePayload, transport: Transport): Record<string, unknown>;
160
+ /**
161
+ * Convert digital-tools Message to worker notification format
162
+ */
163
+ export declare function fromDigitalToolsMessage(message: Record<string, unknown>): Partial<MessagePayload>;
164
+ //# sourceMappingURL=transports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transports.d.ts","sourceRoot":"","sources":["../src/transports.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,MAAM,EACN,IAAI,EAEJ,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EAIlB,MAAM,YAAY,CAAA;AAMnB;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,KAAK,GACL,OAAO,GACP,OAAO,GACP,OAAO,GACP,SAAS,GACT,UAAU,GACV,UAAU,GACV,KAAK,GACL,SAAS,CAAA;AAEb;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,SAAS,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,E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