digital-workers 0.1.1 → 2.0.2

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 +17 -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
@@ -0,0 +1,364 @@
1
+ /**
2
+ * Content generation functionality for digital workers
3
+ */
4
+
5
+ import { generateObject, generateText } from 'ai-functions'
6
+ import type { SimpleSchema } from 'ai-functions'
7
+ import type { GenerateResult, GenerateOptions } from './types.js'
8
+
9
+ /**
10
+ * Generate content
11
+ *
12
+ * Uses AI to generate various types of content including text,
13
+ * code, structured data, images, video, and audio.
14
+ *
15
+ * @param prompt - What to generate
16
+ * @param options - Generation options
17
+ * @returns Promise resolving to generated content
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * // Generate text content
22
+ * const result = await generate('Write a product description for wireless earbuds', {
23
+ * type: 'text',
24
+ * instructions: 'Focus on sound quality and battery life. Keep it under 100 words.',
25
+ * })
26
+ * console.log(result.content)
27
+ * ```
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * // Generate structured data
32
+ * const result = await generate('Create a user profile', {
33
+ * type: 'structured',
34
+ * schema: {
35
+ * name: 'User full name',
36
+ * email: 'Email address',
37
+ * role: 'admin | user | guest',
38
+ * preferences: {
39
+ * theme: 'light | dark',
40
+ * notifications: 'Whether to receive notifications (boolean)',
41
+ * },
42
+ * },
43
+ * })
44
+ * console.log(result.content) // { name: '...', email: '...', ... }
45
+ * ```
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * // Generate code
50
+ * const result = await generate('Create a React component for a todo list', {
51
+ * type: 'code',
52
+ * instructions: 'Use TypeScript and hooks. Include prop types.',
53
+ * })
54
+ * console.log(result.content) // TypeScript React component code
55
+ * ```
56
+ */
57
+ export async function generate<T = string>(
58
+ prompt: string,
59
+ options: GenerateOptions = {}
60
+ ): Promise<GenerateResult<T>> {
61
+ const {
62
+ type = 'text',
63
+ schema,
64
+ instructions,
65
+ model = 'sonnet',
66
+ } = options
67
+
68
+ const startTime = Date.now()
69
+
70
+ switch (type) {
71
+ case 'text': {
72
+ const systemPrompt = instructions
73
+ ? `You are an expert content generator. ${instructions}`
74
+ : 'You are an expert content generator.'
75
+
76
+ const result = await generateText({
77
+ model,
78
+ prompt,
79
+ system: systemPrompt,
80
+ })
81
+
82
+ return {
83
+ content: result.text as T,
84
+ type: 'text',
85
+ metadata: {
86
+ model,
87
+ tokens: result.usage?.totalTokens,
88
+ duration: Date.now() - startTime,
89
+ },
90
+ }
91
+ }
92
+
93
+ case 'structured': {
94
+ if (!schema) {
95
+ throw new Error('Schema is required for structured content generation')
96
+ }
97
+
98
+ const systemPrompt = instructions
99
+ ? `You are an expert at generating structured data. ${instructions}`
100
+ : 'You are an expert at generating structured data.'
101
+
102
+ const result = await generateObject({
103
+ model,
104
+ schema,
105
+ prompt,
106
+ system: systemPrompt,
107
+ })
108
+
109
+ return {
110
+ content: result.object as T,
111
+ type: 'structured',
112
+ metadata: {
113
+ model,
114
+ tokens: result.usage?.totalTokens,
115
+ duration: Date.now() - startTime,
116
+ },
117
+ }
118
+ }
119
+
120
+ case 'code': {
121
+ const systemPrompt = instructions
122
+ ? `You are an expert programmer. Generate clean, well-documented code. ${instructions}`
123
+ : 'You are an expert programmer. Generate clean, well-documented code.'
124
+
125
+ const result = await generateObject({
126
+ model,
127
+ schema: {
128
+ code: 'The generated code',
129
+ language: 'Programming language used',
130
+ explanation: 'Brief explanation of the code',
131
+ },
132
+ prompt,
133
+ system: systemPrompt,
134
+ })
135
+
136
+ const codeResult = result.object as {
137
+ code: string
138
+ language: string
139
+ explanation: string
140
+ }
141
+
142
+ return {
143
+ content: codeResult.code as T,
144
+ type: 'code',
145
+ metadata: {
146
+ model,
147
+ tokens: result.usage?.totalTokens,
148
+ duration: Date.now() - startTime,
149
+ language: codeResult.language,
150
+ explanation: codeResult.explanation,
151
+ },
152
+ }
153
+ }
154
+
155
+ case 'image': {
156
+ // Image generation would integrate with image generation APIs
157
+ // For now, return a placeholder
158
+ throw new Error('Image generation not yet implemented')
159
+ }
160
+
161
+ case 'video': {
162
+ // Video generation would integrate with video generation APIs
163
+ throw new Error('Video generation not yet implemented')
164
+ }
165
+
166
+ case 'audio': {
167
+ // Audio generation would integrate with audio generation APIs
168
+ throw new Error('Audio generation not yet implemented')
169
+ }
170
+
171
+ default:
172
+ throw new Error(`Unknown content type: ${type}`)
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Generate multiple variations of content
178
+ *
179
+ * @param prompt - What to generate
180
+ * @param count - Number of variations to generate
181
+ * @param options - Generation options
182
+ * @returns Promise resolving to array of generated content
183
+ *
184
+ * @example
185
+ * ```ts
186
+ * const variations = await generate.variations(
187
+ * 'Write a catchy headline for a coffee shop',
188
+ * 5,
189
+ * { type: 'text' }
190
+ * )
191
+ *
192
+ * variations.forEach((v, i) => {
193
+ * console.log(`${i + 1}. ${v.content}`)
194
+ * })
195
+ * ```
196
+ */
197
+ generate.variations = async <T = string>(
198
+ prompt: string,
199
+ count: number,
200
+ options: GenerateOptions = {}
201
+ ): Promise<Array<GenerateResult<T>>> => {
202
+ return Promise.all(
203
+ Array.from({ length: count }, () => generate<T>(prompt, options))
204
+ )
205
+ }
206
+
207
+ /**
208
+ * Generate content with a specific tone
209
+ *
210
+ * @param prompt - What to generate
211
+ * @param tone - The desired tone
212
+ * @param options - Generation options
213
+ * @returns Promise resolving to generated content
214
+ *
215
+ * @example
216
+ * ```ts
217
+ * const professional = await generate.withTone(
218
+ * 'Write an email declining a meeting',
219
+ * 'professional',
220
+ * { type: 'text' }
221
+ * )
222
+ *
223
+ * const friendly = await generate.withTone(
224
+ * 'Write an email declining a meeting',
225
+ * 'friendly',
226
+ * { type: 'text' }
227
+ * )
228
+ * ```
229
+ */
230
+ generate.withTone = async <T = string>(
231
+ prompt: string,
232
+ tone: 'professional' | 'casual' | 'friendly' | 'formal' | 'humorous' | 'empathetic',
233
+ options: GenerateOptions = {}
234
+ ): Promise<GenerateResult<T>> => {
235
+ const toneInstructions = {
236
+ professional: 'Use a professional, business-appropriate tone.',
237
+ casual: 'Use a casual, conversational tone.',
238
+ friendly: 'Use a warm, friendly tone.',
239
+ formal: 'Use a formal, ceremonious tone.',
240
+ humorous: 'Use a light, humorous tone.',
241
+ empathetic: 'Use an empathetic, understanding tone.',
242
+ }
243
+
244
+ return generate<T>(prompt, {
245
+ ...options,
246
+ instructions: `${toneInstructions[tone]} ${options.instructions || ''}`,
247
+ })
248
+ }
249
+
250
+ /**
251
+ * Generate content for a specific audience
252
+ *
253
+ * @param prompt - What to generate
254
+ * @param audience - Target audience
255
+ * @param options - Generation options
256
+ * @returns Promise resolving to generated content
257
+ *
258
+ * @example
259
+ * ```ts
260
+ * const technical = await generate.forAudience(
261
+ * 'Explain how OAuth works',
262
+ * 'software engineers',
263
+ * { type: 'text' }
264
+ * )
265
+ *
266
+ * const nonTechnical = await generate.forAudience(
267
+ * 'Explain how OAuth works',
268
+ * 'non-technical business users',
269
+ * { type: 'text' }
270
+ * )
271
+ * ```
272
+ */
273
+ generate.forAudience = async <T = string>(
274
+ prompt: string,
275
+ audience: string,
276
+ options: GenerateOptions = {}
277
+ ): Promise<GenerateResult<T>> => {
278
+ return generate<T>(prompt, {
279
+ ...options,
280
+ instructions: `Write for ${audience}. ${options.instructions || ''}`,
281
+ })
282
+ }
283
+
284
+ /**
285
+ * Generate content with specific length
286
+ *
287
+ * @param prompt - What to generate
288
+ * @param length - Desired length
289
+ * @param options - Generation options
290
+ * @returns Promise resolving to generated content
291
+ *
292
+ * @example
293
+ * ```ts
294
+ * const short = await generate.withLength(
295
+ * 'Describe our company',
296
+ * 'short',
297
+ * { type: 'text' }
298
+ * )
299
+ *
300
+ * const detailed = await generate.withLength(
301
+ * 'Describe our company',
302
+ * 'detailed',
303
+ * { type: 'text' }
304
+ * )
305
+ * ```
306
+ */
307
+ generate.withLength = async <T = string>(
308
+ prompt: string,
309
+ length: 'brief' | 'short' | 'medium' | 'long' | 'detailed',
310
+ options: GenerateOptions = {}
311
+ ): Promise<GenerateResult<T>> => {
312
+ const lengthInstructions = {
313
+ brief: 'Keep it very brief - 1-2 sentences maximum.',
314
+ short: 'Keep it short - around 50-100 words.',
315
+ medium: 'Use a medium length - around 150-300 words.',
316
+ long: 'Write a longer piece - around 400-600 words.',
317
+ detailed: 'Write a detailed, comprehensive piece - 800+ words.',
318
+ }
319
+
320
+ return generate<T>(prompt, {
321
+ ...options,
322
+ instructions: `${lengthInstructions[length]} ${options.instructions || ''}`,
323
+ })
324
+ }
325
+
326
+ /**
327
+ * Generate content by iteratively refining it
328
+ *
329
+ * @param prompt - What to generate
330
+ * @param refinements - Refinement prompts to apply
331
+ * @param options - Generation options
332
+ * @returns Promise resolving to refined content
333
+ *
334
+ * @example
335
+ * ```ts
336
+ * const refined = await generate.refine(
337
+ * 'Write a product tagline',
338
+ * [
339
+ * 'Make it more memorable',
340
+ * 'Add a sense of urgency',
341
+ * 'Emphasize the value proposition',
342
+ * ],
343
+ * { type: 'text' }
344
+ * )
345
+ * ```
346
+ */
347
+ generate.refine = async <T = string>(
348
+ prompt: string,
349
+ refinements: string[],
350
+ options: GenerateOptions = {}
351
+ ): Promise<GenerateResult<T>> => {
352
+ // Generate initial content
353
+ let result = await generate<T>(prompt, options)
354
+
355
+ // Apply refinements iteratively
356
+ for (const refinement of refinements) {
357
+ result = await generate<T>(
358
+ `Refine the following content: ${result.content}\n\nRefinement: ${refinement}`,
359
+ options
360
+ )
361
+ }
362
+
363
+ return result
364
+ }
package/src/goals.ts ADDED
@@ -0,0 +1,220 @@
1
+ /**
2
+ * Goals definition for digital workers
3
+ */
4
+
5
+ import type { WorkerGoals, KPI } from './types.js'
6
+
7
+ /**
8
+ * Define worker goals
9
+ *
10
+ * Goals provide direction and metrics for workers and teams.
11
+ * Supports short-term, long-term, and strategic objectives with KPIs.
12
+ *
13
+ * @param definition - Goals definition
14
+ * @returns The defined goals
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const engineeringGoals = Goals({
19
+ * shortTerm: [
20
+ * 'Complete Q1 roadmap features',
21
+ * 'Reduce bug backlog by 30%',
22
+ * 'Improve test coverage to 80%',
23
+ * ],
24
+ * longTerm: [
25
+ * 'Migrate to microservices architecture',
26
+ * 'Achieve 99.9% uptime',
27
+ * 'Build scalable platform for 1M users',
28
+ * ],
29
+ * strategic: [
30
+ * 'Become industry leader in performance',
31
+ * 'Enable product innovation through technology',
32
+ * ],
33
+ * metrics: [
34
+ * {
35
+ * name: 'Deployment Frequency',
36
+ * description: 'Number of deployments per week',
37
+ * current: 5,
38
+ * target: 10,
39
+ * unit: 'deploys/week',
40
+ * trend: 'up',
41
+ * period: 'weekly',
42
+ * },
43
+ * {
44
+ * name: 'Mean Time to Recovery',
45
+ * description: 'Average time to recover from incidents',
46
+ * current: 45,
47
+ * target: 30,
48
+ * unit: 'minutes',
49
+ * trend: 'down',
50
+ * period: 'monthly',
51
+ * },
52
+ * ],
53
+ * })
54
+ * ```
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const supportGoals = Goals({
59
+ * shortTerm: [
60
+ * 'Achieve 95% customer satisfaction',
61
+ * 'Reduce average response time to < 5 min',
62
+ * ],
63
+ * longTerm: [
64
+ * 'Build comprehensive knowledge base',
65
+ * 'Implement AI-first support workflow',
66
+ * ],
67
+ * metrics: [
68
+ * {
69
+ * name: 'Customer Satisfaction',
70
+ * description: 'CSAT score from surveys',
71
+ * current: 92,
72
+ * target: 95,
73
+ * unit: '%',
74
+ * trend: 'up',
75
+ * period: 'monthly',
76
+ * },
77
+ * ],
78
+ * })
79
+ * ```
80
+ */
81
+ export function Goals(definition: WorkerGoals): WorkerGoals {
82
+ return definition
83
+ }
84
+
85
+ /**
86
+ * Add a short-term goal
87
+ *
88
+ * @param goals - The goals object
89
+ * @param goal - Goal to add
90
+ * @returns Updated goals
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * const updated = Goals.addShortTerm(engineeringGoals, 'Complete security audit')
95
+ * ```
96
+ */
97
+ Goals.addShortTerm = (goals: WorkerGoals, goal: string): WorkerGoals => ({
98
+ ...goals,
99
+ shortTerm: [...goals.shortTerm, goal],
100
+ })
101
+
102
+ /**
103
+ * Add a long-term goal
104
+ *
105
+ * @param goals - The goals object
106
+ * @param goal - Goal to add
107
+ * @returns Updated goals
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * const updated = Goals.addLongTerm(engineeringGoals, 'Build ML platform')
112
+ * ```
113
+ */
114
+ Goals.addLongTerm = (goals: WorkerGoals, goal: string): WorkerGoals => ({
115
+ ...goals,
116
+ longTerm: [...goals.longTerm, goal],
117
+ })
118
+
119
+ /**
120
+ * Add a strategic goal
121
+ *
122
+ * @param goals - The goals object
123
+ * @param goal - Goal to add
124
+ * @returns Updated goals
125
+ *
126
+ * @example
127
+ * ```ts
128
+ * const updated = Goals.addStrategic(engineeringGoals, 'Become carbon neutral')
129
+ * ```
130
+ */
131
+ Goals.addStrategic = (goals: WorkerGoals, goal: string): WorkerGoals => ({
132
+ ...goals,
133
+ strategic: [...(goals.strategic || []), goal],
134
+ })
135
+
136
+ /**
137
+ * Add a KPI metric
138
+ *
139
+ * @param goals - The goals object
140
+ * @param kpi - KPI to add
141
+ * @returns Updated goals
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * const updated = Goals.addMetric(engineeringGoals, {
146
+ * name: 'Code Quality',
147
+ * description: 'Code quality score from SonarQube',
148
+ * current: 85,
149
+ * target: 90,
150
+ * unit: 'score',
151
+ * trend: 'up',
152
+ * period: 'weekly',
153
+ * })
154
+ * ```
155
+ */
156
+ Goals.addMetric = (goals: WorkerGoals, kpi: KPI): WorkerGoals => ({
157
+ ...goals,
158
+ metrics: [...(goals.metrics || []), kpi],
159
+ })
160
+
161
+ /**
162
+ * Update a KPI metric
163
+ *
164
+ * @param goals - The goals object
165
+ * @param name - Name of KPI to update
166
+ * @param updates - Fields to update
167
+ * @returns Updated goals
168
+ *
169
+ * @example
170
+ * ```ts
171
+ * const updated = Goals.updateMetric(engineeringGoals, 'Deployment Frequency', {
172
+ * current: 8,
173
+ * trend: 'up',
174
+ * })
175
+ * ```
176
+ */
177
+ Goals.updateMetric = (
178
+ goals: WorkerGoals,
179
+ name: string,
180
+ updates: Partial<Omit<KPI, 'name'>>
181
+ ): WorkerGoals => ({
182
+ ...goals,
183
+ metrics: goals.metrics?.map((kpi) =>
184
+ kpi.name === name ? { ...kpi, ...updates } : kpi
185
+ ),
186
+ })
187
+
188
+ /**
189
+ * Get progress for a KPI (0-1)
190
+ *
191
+ * @param kpi - The KPI
192
+ * @returns Progress value between 0 and 1
193
+ *
194
+ * @example
195
+ * ```ts
196
+ * const kpi = { current: 75, target: 100 }
197
+ * const progress = Goals.progress(kpi) // 0.75
198
+ * ```
199
+ */
200
+ Goals.progress = (kpi: Pick<KPI, 'current' | 'target'>): number => {
201
+ if (kpi.target === 0) return 0
202
+ return Math.min(1, Math.max(0, kpi.current / kpi.target))
203
+ }
204
+
205
+ /**
206
+ * Check if a KPI is on track
207
+ *
208
+ * @param kpi - The KPI
209
+ * @param threshold - Minimum progress to be considered "on track" (default: 0.8)
210
+ * @returns Whether the KPI is on track
211
+ *
212
+ * @example
213
+ * ```ts
214
+ * const kpi = { current: 85, target: 100 }
215
+ * const onTrack = Goals.onTrack(kpi) // true (85% >= 80% threshold)
216
+ * ```
217
+ */
218
+ Goals.onTrack = (kpi: Pick<KPI, 'current' | 'target'>, threshold = 0.8): boolean => {
219
+ return Goals.progress(kpi) >= threshold
220
+ }
package/src/index.ts ADDED
@@ -0,0 +1,118 @@
1
+ /**
2
+ * digital-workers - Abstract interface for organizing digital work
3
+ *
4
+ * This package provides the foundational abstraction for structuring work
5
+ * independent of whether AI agents or humans perform individual tasks. It
6
+ * defines a unified Worker interface that enables workflows to be designed
7
+ * once and executed by any combination of AI and human workers.
8
+ *
9
+ * Package relationships:
10
+ * - `autonomous-agents` - Implements Worker for AI agents
11
+ * - `human-in-the-loop` - Implements Worker for humans
12
+ * - `ai-workflows` - Uses digital-workers to orchestrate execution
13
+ *
14
+ * The key insight: define WHAT work needs to happen, not WHO does it.
15
+ *
16
+ * ## Worker Actions
17
+ *
18
+ * Worker actions (notify, ask, approve, decide, do) are durable workflow actions
19
+ * that integrate with ai-workflows. They can be invoked via:
20
+ *
21
+ * 1. `$.do('Worker.notify', data)` - Durable action
22
+ * 2. `$.send('Worker.notify', data)` - Fire and forget
23
+ * 3. `$.notify(target, message)` - Convenience method (when using withWorkers)
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import { Workflow } from 'ai-workflows'
28
+ * import { registerWorkerActions, withWorkers } from 'digital-workers'
29
+ *
30
+ * const workflow = Workflow($ => {
31
+ * registerWorkerActions($)
32
+ * const worker$ = withWorkers($)
33
+ *
34
+ * $.on.Expense.submitted(async (expense) => {
35
+ * await worker$.notify(finance, `New expense: ${expense.amount}`)
36
+ *
37
+ * const approval = await worker$.approve(
38
+ * `Expense: $${expense.amount}`,
39
+ * manager,
40
+ * { via: 'slack' }
41
+ * )
42
+ *
43
+ * if (approval.approved) {
44
+ * await worker$.notify(expense.submitter, 'Expense approved!')
45
+ * }
46
+ * })
47
+ * })
48
+ * ```
49
+ *
50
+ * @packageDocumentation
51
+ */
52
+
53
+ // Export all types
54
+ export type * from './types.js'
55
+
56
+ // Export workflow integration
57
+ export {
58
+ registerWorkerActions,
59
+ withWorkers,
60
+ handleNotify,
61
+ handleAsk,
62
+ handleApprove,
63
+ handleDecide,
64
+ handleDo,
65
+ notify as notifyAction,
66
+ ask as askAction,
67
+ approve as approveAction,
68
+ decide as decideAction,
69
+ } from './actions.js'
70
+
71
+ // Export core functions
72
+ export { Role } from './role.js'
73
+ export { Team } from './team.js'
74
+ export { Goals } from './goals.js'
75
+ export { approve } from './approve.js'
76
+ export { ask } from './ask.js'
77
+ export { do } from './do.js'
78
+ export { decide } from './decide.js'
79
+ export { generate } from './generate.js'
80
+ export { is } from './is.js'
81
+ export { notify } from './notify.js'
82
+ export { kpis, okrs } from './kpis.js'
83
+
84
+ // Export verb definitions
85
+ export { WorkerVerbs } from './types.js'
86
+
87
+ // Export transport bridge (connects to digital-tools)
88
+ export type {
89
+ Transport,
90
+ TransportConfig,
91
+ MessagePayload,
92
+ MessageAction,
93
+ DeliveryResult,
94
+ Address,
95
+ TransportHandler,
96
+ } from './transports.js'
97
+
98
+ export {
99
+ channelToTransport,
100
+ getWorkerTransports,
101
+ getTeamTransports,
102
+ resolveAddress,
103
+ resolveWorkerAddresses,
104
+ getPrimaryAddress,
105
+ registerTransport,
106
+ getTransportHandler,
107
+ hasTransport,
108
+ listTransports,
109
+ sendViaTransport,
110
+ sendToMultipleTransports,
111
+ buildNotifyPayload,
112
+ buildAskPayload,
113
+ buildApprovePayload,
114
+ toDigitalToolsMessage,
115
+ fromDigitalToolsMessage,
116
+ MessageTypeMapping,
117
+ CallTypeMapping,
118
+ } from './transports.js'