digital-workers 2.1.3 → 2.3.0
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.
- package/CHANGELOG.md +9 -0
- package/README.md +2 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +33 -21
- package/dist/actions.js.map +1 -1
- package/dist/agent-comms.d.ts.map +1 -1
- package/dist/agent-comms.js +36 -25
- package/dist/agent-comms.js.map +1 -1
- package/dist/approve.d.ts +40 -8
- package/dist/approve.d.ts.map +1 -1
- package/dist/approve.js +86 -20
- package/dist/approve.js.map +1 -1
- package/dist/ask.d.ts +38 -7
- package/dist/ask.d.ts.map +1 -1
- package/dist/ask.js +85 -25
- package/dist/ask.js.map +1 -1
- package/dist/browse.d.ts +223 -0
- package/dist/browse.d.ts.map +1 -0
- package/dist/browse.js +392 -0
- package/dist/browse.js.map +1 -0
- package/dist/capability-tiers.js +3 -3
- package/dist/capability-tiers.js.map +1 -1
- package/dist/cascade-context.d.ts +28 -28
- package/dist/client.d.ts +162 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +64 -0
- package/dist/client.js.map +1 -0
- package/dist/decide.d.ts +42 -6
- package/dist/decide.d.ts.map +1 -1
- package/dist/decide.js +54 -11
- package/dist/decide.js.map +1 -1
- package/dist/do.d.ts +36 -7
- package/dist/do.d.ts.map +1 -1
- package/dist/do.js +82 -39
- package/dist/do.js.map +1 -1
- package/dist/error-escalation.d.ts.map +1 -1
- package/dist/error-escalation.js +38 -38
- package/dist/error-escalation.js.map +1 -1
- package/dist/generate.d.ts +48 -7
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +49 -8
- package/dist/generate.js.map +1 -1
- package/dist/goals.d.ts +10 -9
- package/dist/goals.d.ts.map +1 -1
- package/dist/goals.js +30 -24
- package/dist/goals.js.map +1 -1
- package/dist/image.d.ts +189 -0
- package/dist/image.d.ts.map +1 -0
- package/dist/image.js +528 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +49 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +58 -2
- package/dist/index.js.map +1 -1
- package/dist/is.d.ts +45 -10
- package/dist/is.d.ts.map +1 -1
- package/dist/is.js +56 -21
- package/dist/is.js.map +1 -1
- package/dist/kpis.d.ts +24 -15
- package/dist/kpis.d.ts.map +1 -1
- package/dist/kpis.js +16 -14
- package/dist/kpis.js.map +1 -1
- package/dist/load-balancing.d.ts.map +1 -1
- package/dist/load-balancing.js +124 -38
- package/dist/load-balancing.js.map +1 -1
- package/dist/logger.d.ts +76 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +39 -0
- package/dist/logger.js.map +1 -0
- package/dist/notify.d.ts +38 -9
- package/dist/notify.d.ts.map +1 -1
- package/dist/notify.js +72 -17
- package/dist/notify.js.map +1 -1
- package/dist/role.d.ts +5 -4
- package/dist/role.d.ts.map +1 -1
- package/dist/role.js +13 -10
- package/dist/role.js.map +1 -1
- package/dist/runtime.d.ts +310 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +510 -0
- package/dist/runtime.js.map +1 -0
- package/dist/team.d.ts +11 -6
- package/dist/team.d.ts.map +1 -1
- package/dist/team.js +22 -15
- package/dist/team.js.map +1 -1
- package/dist/transports/email.d.ts +318 -0
- package/dist/transports/email.d.ts.map +1 -0
- package/dist/transports/email.js +779 -0
- package/dist/transports/email.js.map +1 -0
- package/dist/transports/slack.d.ts +515 -0
- package/dist/transports/slack.d.ts.map +1 -0
- package/dist/transports/slack.js +844 -0
- package/dist/transports/slack.js.map +1 -0
- package/dist/transports.d.ts.map +1 -1
- package/dist/transports.js +44 -25
- package/dist/transports.js.map +1 -1
- package/dist/types.d.ts +141 -19
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/id.d.ts +19 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/id.js +21 -0
- package/dist/utils/id.js.map +1 -0
- package/dist/video.d.ts +203 -0
- package/dist/video.d.ts.map +1 -0
- package/dist/video.js +528 -0
- package/dist/video.js.map +1 -0
- package/dist/worker.d.ts +343 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +698 -0
- package/dist/worker.js.map +1 -0
- package/package.json +32 -14
- package/src/actions.ts +39 -30
- package/src/agent-comms.ts +54 -92
- package/src/approve.ts +91 -20
- package/src/ask.ts +99 -25
- package/src/browse.ts +627 -0
- package/src/capability-tiers.ts +5 -5
- package/src/client.ts +221 -0
- package/src/decide.ts +81 -35
- package/src/do.ts +98 -52
- package/src/error-escalation.ts +55 -67
- package/src/generate.ts +52 -18
- package/src/goals.ts +36 -27
- package/src/image.ts +816 -0
- package/src/index.ts +187 -2
- package/src/is.ts +59 -25
- package/src/kpis.ts +41 -36
- package/src/load-balancing.ts +132 -46
- package/src/logger.ts +93 -0
- package/src/notify.ts +78 -17
- package/src/role.ts +30 -20
- package/src/runtime.ts +796 -0
- package/src/team.ts +24 -19
- package/src/transports/email.ts +1160 -0
- package/src/transports/slack.ts +1320 -0
- package/src/transports.ts +58 -43
- package/src/types.ts +174 -46
- package/src/utils/id.ts +21 -0
- package/src/video.ts +906 -0
- package/src/worker.ts +1007 -0
- package/test/approve.test.ts +305 -0
- package/test/ask.test.ts +274 -0
- package/test/browse.test.ts +361 -0
- package/test/decide.test.ts +252 -0
- package/test/do.test.ts +144 -0
- package/test/error-logging.test.ts +357 -0
- package/test/generate.test.ts +319 -0
- package/test/image.test.ts +398 -0
- package/test/is.test.ts +287 -0
- package/test/load-balancing-safety.test.ts +404 -0
- package/test/notify.test.ts +434 -0
- package/test/primitives.test.ts +320 -0
- package/test/runtime-integration.test.ts +892 -0
- package/test/transports/crypto.test.ts +230 -0
- package/test/transports/email.test.ts +866 -0
- package/test/transports/id-generation.test.ts +91 -0
- package/test/transports/slack.test.ts +760 -0
- package/test/type-safety.test.ts +834 -0
- package/test/types.test.ts +60 -2
- package/test/video.test.ts +530 -0
- package/test/worker.test.ts +1433 -0
- package/tsconfig.json +4 -1
- package/vitest.config.ts +42 -0
- package/wrangler.jsonc +36 -0
- package/.turbo/turbo-build.log +0 -4
- package/LICENSE +0 -21
- package/src/actions.js +0 -436
- package/src/approve.js +0 -234
- package/src/ask.js +0 -226
- package/src/decide.js +0 -244
- package/src/do.js +0 -227
- package/src/generate.js +0 -298
- package/src/goals.js +0 -205
- package/src/index.js +0 -68
- package/src/is.js +0 -317
- package/src/kpis.js +0 -270
- package/src/notify.js +0 -219
- package/src/role.js +0 -110
- package/src/team.js +0 -130
- package/src/transports.js +0 -357
- package/src/types.js +0 -71
package/dist/notify.d.ts
CHANGED
|
@@ -1,32 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Notification functionality for digital workers
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: Real Channel Delivery vs LLM Generation
|
|
5
|
+
* ---------------------------------------------------
|
|
6
|
+
* This module sends real notifications via communication channels,
|
|
7
|
+
* NOT LLM-generated notification content.
|
|
8
|
+
*
|
|
9
|
+
* - `digital-workers.notify()` - Sends actual notifications to Workers
|
|
10
|
+
* via real channels (Slack, email, SMS, etc.) with delivery tracking.
|
|
11
|
+
*
|
|
12
|
+
* - ai-functions does not have an equivalent `notify` primitive since
|
|
13
|
+
* it focuses on LLM operations, not communication channel delivery.
|
|
14
|
+
*
|
|
15
|
+
* Use digital-workers.notify() when you need:
|
|
16
|
+
* - Real notification delivery to people/agents
|
|
17
|
+
* - Multi-channel delivery (Slack + SMS for urgent)
|
|
18
|
+
* - Delivery tracking and confirmation
|
|
19
|
+
* - Priority-based channel selection
|
|
20
|
+
* - Scheduled notifications
|
|
21
|
+
*
|
|
22
|
+
* @module
|
|
3
23
|
*/
|
|
4
24
|
import type { ActionTarget, NotifyResult, NotifyOptions } from './types.js';
|
|
5
25
|
/**
|
|
6
|
-
* Send a notification to a
|
|
26
|
+
* Send a notification to a Worker (Human or AI Agent) via communication channels.
|
|
27
|
+
*
|
|
28
|
+
* **Unique to digital-workers:**
|
|
29
|
+
* This function sends real notifications via actual communication channels
|
|
30
|
+
* (Slack, email, SMS, phone, etc.). There is no equivalent in ai-functions
|
|
31
|
+
* since ai-functions focuses on LLM operations rather than external delivery.
|
|
7
32
|
*
|
|
8
|
-
*
|
|
9
|
-
* to the target's preferred channel if not specified.
|
|
33
|
+
* This is a **communication delivery primitive** for worker coordination.
|
|
10
34
|
*
|
|
11
|
-
* @param target - The worker or team to notify
|
|
35
|
+
* @param target - The worker or team to notify (routes to their configured channels)
|
|
12
36
|
* @param message - The notification message
|
|
13
|
-
* @param options - Notification options
|
|
14
|
-
* @returns Promise resolving to
|
|
37
|
+
* @param options - Notification options (channel, priority, metadata)
|
|
38
|
+
* @returns Promise resolving to NotifyResult with delivery status and metadata
|
|
15
39
|
*
|
|
16
40
|
* @example
|
|
17
41
|
* ```ts
|
|
18
42
|
* // Notify a worker via their preferred channel
|
|
19
|
-
* await notify(alice, 'Deployment completed successfully')
|
|
43
|
+
* const result = await notify(alice, 'Deployment completed successfully')
|
|
44
|
+
* console.log(result.sent) // true
|
|
45
|
+
* console.log(result.via) // ['slack']
|
|
20
46
|
*
|
|
21
47
|
* // Notify via specific channel
|
|
22
48
|
* await notify(alice, 'Urgent: Server down!', { via: 'slack' })
|
|
23
49
|
*
|
|
24
|
-
* // Notify via multiple channels
|
|
50
|
+
* // Notify via multiple channels (for urgent messages)
|
|
25
51
|
* await notify(alice, 'Critical alert', { via: ['slack', 'sms'] })
|
|
26
52
|
*
|
|
27
|
-
* // Notify a team
|
|
53
|
+
* // Notify a team (reaches all members via their channels)
|
|
28
54
|
* await notify(engineering, 'Sprint planning tomorrow', { via: 'slack' })
|
|
29
55
|
* ```
|
|
56
|
+
*
|
|
57
|
+
* @see {@link notify.alert} for high-priority urgent notifications
|
|
58
|
+
* @see {@link notify.schedule} for delayed/scheduled notifications
|
|
30
59
|
*/
|
|
31
60
|
export declare function notify(target: ActionTarget, message: string, options?: NotifyOptions): Promise<NotifyResult>;
|
|
32
61
|
export declare namespace notify {
|
package/dist/notify.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAIV,YAAY,EAEZ,YAAY,EACZ,aAAa,EAEd,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,MAAM,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAgDvB;yBApDqB,MAAM;wBA+DlB,YAAY,WACX,MAAM,YACN,aAAa,KACrB,OAAO,CAAC,YAAY,CAAC;uBAad,YAAY,WACX,MAAM,YACN,aAAa,KACrB,OAAO,CAAC,YAAY,CAAC;uBAgBd,YAAY,SACb,MAAM,QACP,MAAM,YACH,aAAa,KACrB,OAAO,CAAC,YAAY,CAAC;+BAkBP,KAAK,CAAC;QACnB,MAAM,EAAE,YAAY,CAAA;QACpB,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE,aAAa,CAAA;KACxB,CAAC,KACD,OAAO,CAAC,YAAY,EAAE,CAAC;2BAmBhB,YAAY,WACX,MAAM,QACT,IAAI,GAAG,MAAM,YACV,aAAa,KACrB,OAAO,CAAC;QAAE,SAAS,EAAE,IAAI,CAAC;QAAC,YAAY,EAAE,IAAI,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC"}
|
package/dist/notify.js
CHANGED
|
@@ -1,31 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Notification functionality for digital workers
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: Real Channel Delivery vs LLM Generation
|
|
5
|
+
* ---------------------------------------------------
|
|
6
|
+
* This module sends real notifications via communication channels,
|
|
7
|
+
* NOT LLM-generated notification content.
|
|
8
|
+
*
|
|
9
|
+
* - `digital-workers.notify()` - Sends actual notifications to Workers
|
|
10
|
+
* via real channels (Slack, email, SMS, etc.) with delivery tracking.
|
|
11
|
+
*
|
|
12
|
+
* - ai-functions does not have an equivalent `notify` primitive since
|
|
13
|
+
* it focuses on LLM operations, not communication channel delivery.
|
|
14
|
+
*
|
|
15
|
+
* Use digital-workers.notify() when you need:
|
|
16
|
+
* - Real notification delivery to people/agents
|
|
17
|
+
* - Multi-channel delivery (Slack + SMS for urgent)
|
|
18
|
+
* - Delivery tracking and confirmation
|
|
19
|
+
* - Priority-based channel selection
|
|
20
|
+
* - Scheduled notifications
|
|
21
|
+
*
|
|
22
|
+
* @module
|
|
3
23
|
*/
|
|
24
|
+
import { generateRequestId } from './utils/id.js';
|
|
4
25
|
/**
|
|
5
|
-
* Send a notification to a
|
|
26
|
+
* Send a notification to a Worker (Human or AI Agent) via communication channels.
|
|
6
27
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
28
|
+
* **Unique to digital-workers:**
|
|
29
|
+
* This function sends real notifications via actual communication channels
|
|
30
|
+
* (Slack, email, SMS, phone, etc.). There is no equivalent in ai-functions
|
|
31
|
+
* since ai-functions focuses on LLM operations rather than external delivery.
|
|
9
32
|
*
|
|
10
|
-
*
|
|
33
|
+
* This is a **communication delivery primitive** for worker coordination.
|
|
34
|
+
*
|
|
35
|
+
* @param target - The worker or team to notify (routes to their configured channels)
|
|
11
36
|
* @param message - The notification message
|
|
12
|
-
* @param options - Notification options
|
|
13
|
-
* @returns Promise resolving to
|
|
37
|
+
* @param options - Notification options (channel, priority, metadata)
|
|
38
|
+
* @returns Promise resolving to NotifyResult with delivery status and metadata
|
|
14
39
|
*
|
|
15
40
|
* @example
|
|
16
41
|
* ```ts
|
|
17
42
|
* // Notify a worker via their preferred channel
|
|
18
|
-
* await notify(alice, 'Deployment completed successfully')
|
|
43
|
+
* const result = await notify(alice, 'Deployment completed successfully')
|
|
44
|
+
* console.log(result.sent) // true
|
|
45
|
+
* console.log(result.via) // ['slack']
|
|
19
46
|
*
|
|
20
47
|
* // Notify via specific channel
|
|
21
48
|
* await notify(alice, 'Urgent: Server down!', { via: 'slack' })
|
|
22
49
|
*
|
|
23
|
-
* // Notify via multiple channels
|
|
50
|
+
* // Notify via multiple channels (for urgent messages)
|
|
24
51
|
* await notify(alice, 'Critical alert', { via: ['slack', 'sms'] })
|
|
25
52
|
*
|
|
26
|
-
* // Notify a team
|
|
53
|
+
* // Notify a team (reaches all members via their channels)
|
|
27
54
|
* await notify(engineering, 'Sprint planning tomorrow', { via: 'slack' })
|
|
28
55
|
* ```
|
|
56
|
+
*
|
|
57
|
+
* @see {@link notify.alert} for high-priority urgent notifications
|
|
58
|
+
* @see {@link notify.schedule} for delayed/scheduled notifications
|
|
29
59
|
*/
|
|
30
60
|
export async function notify(target, message, options = {}) {
|
|
31
61
|
const { via, priority = 'normal', fallback = false, timeout, context, metadata } = options;
|
|
@@ -45,7 +75,10 @@ export async function notify(target, message, options = {}) {
|
|
|
45
75
|
// Send to each channel
|
|
46
76
|
const delivery = await Promise.all(channels.map(async (channel) => {
|
|
47
77
|
try {
|
|
48
|
-
await sendToChannel(channel, message, contacts, {
|
|
78
|
+
await sendToChannel(channel, message, contacts, {
|
|
79
|
+
priority,
|
|
80
|
+
...(metadata !== undefined && { metadata }),
|
|
81
|
+
});
|
|
49
82
|
return { channel, status: 'sent' };
|
|
50
83
|
}
|
|
51
84
|
catch (error) {
|
|
@@ -204,17 +237,39 @@ async function sendToChannel(channel, message, contacts, options) {
|
|
|
204
237
|
if (!contact) {
|
|
205
238
|
throw new Error(`No ${channel} contact configured`);
|
|
206
239
|
}
|
|
207
|
-
//
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
//
|
|
212
|
-
|
|
240
|
+
// Import transport functions dynamically to avoid circular dependencies
|
|
241
|
+
const { channelToTransport, sendViaTransport, hasTransport, resolveAddress } = await import('./transports.js');
|
|
242
|
+
const transport = channelToTransport(channel);
|
|
243
|
+
const address = resolveAddress(contacts, channel);
|
|
244
|
+
// If transport is registered, use it for real delivery
|
|
245
|
+
if (hasTransport(transport) && address) {
|
|
246
|
+
const payload = {
|
|
247
|
+
to: address.value,
|
|
248
|
+
body: message,
|
|
249
|
+
type: 'notification',
|
|
250
|
+
priority: (options.priority || 'normal'),
|
|
251
|
+
...(options.metadata !== undefined && { metadata: options.metadata }),
|
|
252
|
+
};
|
|
253
|
+
const result = await sendViaTransport(transport, payload);
|
|
254
|
+
if (!result.success) {
|
|
255
|
+
throw new Error(`Failed to send notification via ${transport}: ${result.error}`);
|
|
256
|
+
}
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
// No transport registered - log to console for development/testing
|
|
260
|
+
// This provides visibility into what would be sent
|
|
261
|
+
console.log(`[digital-workers] Notification (${channel}):`, {
|
|
262
|
+
to: typeof contact === 'string' ? contact : JSON.stringify(contact),
|
|
263
|
+
message,
|
|
264
|
+
priority: options.priority || 'normal',
|
|
265
|
+
metadata: options.metadata,
|
|
266
|
+
note: `No transport registered for '${transport}'. Register a transport handler to enable real delivery.`,
|
|
267
|
+
});
|
|
213
268
|
}
|
|
214
269
|
/**
|
|
215
270
|
* Generate a unique message ID
|
|
216
271
|
*/
|
|
217
272
|
function generateMessageId(prefix = 'msg') {
|
|
218
|
-
return
|
|
273
|
+
return generateRequestId(prefix);
|
|
219
274
|
}
|
|
220
275
|
//# sourceMappingURL=notify.js.map
|
package/dist/notify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAs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AC,SAAS,CAAC,OAAO,CAAC;QACnE,OAAO;QACP,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,QAAQ;QACtC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,IAAI,EAAE,gCAAgC,SAAS,0DAA0D;KAC1G,CAAC,CAAA;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,MAAM,GAAG,KAAK;IACvC,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAA;AAClC,CAAC"}
|
package/dist/role.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { WorkerRole } from './types.js';
|
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```ts
|
|
16
|
-
* const engineer =
|
|
16
|
+
* const engineer = defineRole({
|
|
17
17
|
* name: 'Software Engineer',
|
|
18
18
|
* description: 'Builds and maintains software systems',
|
|
19
19
|
* responsibilities: [
|
|
@@ -29,7 +29,7 @@ import type { WorkerRole } from './types.js';
|
|
|
29
29
|
*
|
|
30
30
|
* @example
|
|
31
31
|
* ```ts
|
|
32
|
-
* const supportAgent =
|
|
32
|
+
* const supportAgent = defineRole({
|
|
33
33
|
* name: 'Customer Support Agent',
|
|
34
34
|
* description: 'Assists customers with inquiries and issues',
|
|
35
35
|
* responsibilities: [
|
|
@@ -42,12 +42,13 @@ import type { WorkerRole } from './types.js';
|
|
|
42
42
|
* })
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
export declare function
|
|
45
|
+
export declare function defineRole(definition: Omit<WorkerRole, 'type'> & {
|
|
46
46
|
type?: WorkerRole['type'];
|
|
47
47
|
}): WorkerRole;
|
|
48
|
-
export declare namespace
|
|
48
|
+
export declare namespace defineRole {
|
|
49
49
|
var ai: (definition: Omit<WorkerRole, "type">) => WorkerRole;
|
|
50
50
|
var human: (definition: Omit<WorkerRole, "type">) => WorkerRole;
|
|
51
51
|
var hybrid: (definition: Omit<WorkerRole, "type">) => WorkerRole;
|
|
52
52
|
}
|
|
53
|
+
export { defineRole as Role };
|
|
53
54
|
//# sourceMappingURL=role.d.ts.map
|
package/dist/role.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../src/role.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../src/role.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAI5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,UAAU,CACxB,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;CAAE,GACnE,UAAU,CAKZ;yBAPe,UAAU;yBAyBG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,KAAG,UAAU;4BAuBlC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,KAAG,UAAU;6BAsBpC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,KAAG,UAAU;;AAOtE,OAAO,EAAE,UAAU,IAAI,IAAI,EAAE,CAAA"}
|
package/dist/role.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Role definition for digital workers
|
|
3
3
|
*/
|
|
4
|
+
// Note: Role type is re-exported from types.ts which imports from org.ai
|
|
4
5
|
/**
|
|
5
6
|
* Define a worker role
|
|
6
7
|
*
|
|
@@ -12,7 +13,7 @@
|
|
|
12
13
|
*
|
|
13
14
|
* @example
|
|
14
15
|
* ```ts
|
|
15
|
-
* const engineer =
|
|
16
|
+
* const engineer = defineRole({
|
|
16
17
|
* name: 'Software Engineer',
|
|
17
18
|
* description: 'Builds and maintains software systems',
|
|
18
19
|
* responsibilities: [
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
*
|
|
29
30
|
* @example
|
|
30
31
|
* ```ts
|
|
31
|
-
* const supportAgent =
|
|
32
|
+
* const supportAgent = defineRole({
|
|
32
33
|
* name: 'Customer Support Agent',
|
|
33
34
|
* description: 'Assists customers with inquiries and issues',
|
|
34
35
|
* responsibilities: [
|
|
@@ -41,10 +42,10 @@
|
|
|
41
42
|
* })
|
|
42
43
|
* ```
|
|
43
44
|
*/
|
|
44
|
-
export function
|
|
45
|
+
export function defineRole(definition) {
|
|
45
46
|
return {
|
|
46
|
-
type: 'hybrid', // Default to hybrid (can be AI or human)
|
|
47
47
|
...definition,
|
|
48
|
+
type: definition.type ?? 'hybrid',
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
@@ -52,7 +53,7 @@ export function Role(definition) {
|
|
|
52
53
|
*
|
|
53
54
|
* @example
|
|
54
55
|
* ```ts
|
|
55
|
-
* const dataAnalyst =
|
|
56
|
+
* const dataAnalyst = defineRole.ai({
|
|
56
57
|
* name: 'Data Analyst',
|
|
57
58
|
* description: 'Analyzes data and generates insights',
|
|
58
59
|
* responsibilities: [
|
|
@@ -63,7 +64,7 @@ export function Role(definition) {
|
|
|
63
64
|
* })
|
|
64
65
|
* ```
|
|
65
66
|
*/
|
|
66
|
-
|
|
67
|
+
defineRole.ai = (definition) => ({
|
|
67
68
|
...definition,
|
|
68
69
|
type: 'ai',
|
|
69
70
|
});
|
|
@@ -72,7 +73,7 @@ Role.ai = (definition) => ({
|
|
|
72
73
|
*
|
|
73
74
|
* @example
|
|
74
75
|
* ```ts
|
|
75
|
-
* const manager =
|
|
76
|
+
* const manager = defineRole.human({
|
|
76
77
|
* name: 'Engineering Manager',
|
|
77
78
|
* description: 'Leads engineering team and makes strategic decisions',
|
|
78
79
|
* responsibilities: [
|
|
@@ -84,7 +85,7 @@ Role.ai = (definition) => ({
|
|
|
84
85
|
* })
|
|
85
86
|
* ```
|
|
86
87
|
*/
|
|
87
|
-
|
|
88
|
+
defineRole.human = (definition) => ({
|
|
88
89
|
...definition,
|
|
89
90
|
type: 'human',
|
|
90
91
|
});
|
|
@@ -93,7 +94,7 @@ Role.human = (definition) => ({
|
|
|
93
94
|
*
|
|
94
95
|
* @example
|
|
95
96
|
* ```ts
|
|
96
|
-
* const contentWriter =
|
|
97
|
+
* const contentWriter = defineRole.hybrid({
|
|
97
98
|
* name: 'Content Writer',
|
|
98
99
|
* description: 'Creates written content for various channels',
|
|
99
100
|
* responsibilities: [
|
|
@@ -104,8 +105,10 @@ Role.human = (definition) => ({
|
|
|
104
105
|
* })
|
|
105
106
|
* ```
|
|
106
107
|
*/
|
|
107
|
-
|
|
108
|
+
defineRole.hybrid = (definition) => ({
|
|
108
109
|
...definition,
|
|
109
110
|
type: 'hybrid',
|
|
110
111
|
});
|
|
112
|
+
// Legacy alias for backward compatibility
|
|
113
|
+
export { defineRole as Role };
|
|
111
114
|
//# sourceMappingURL=role.js.map
|
package/dist/role.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role.js","sourceRoot":"","sources":["../src/role.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"role.js","sourceRoot":"","sources":["../src/role.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,yEAAyE;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,UAAU,CACxB,UAAoE;IAEpE,OAAO;QACL,GAAG,UAAU;QACb,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,QAAQ;KACpB,CAAA;AACjB,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,UAAU,CAAC,EAAE,GAAG,CAAC,UAAoC,EAAc,EAAE,CACnE,CAAC;IACC,GAAG,UAAU;IACb,IAAI,EAAE,IAAI;CACI,CAAA,CAAA;AAElB;;;;;;;;;;;;;;;;GAgBG;AACH,UAAU,CAAC,KAAK,GAAG,CAAC,UAAoC,EAAc,EAAE,CACtE,CAAC;IACC,GAAG,UAAU;IACb,IAAI,EAAE,OAAO;CACC,CAAA,CAAA;AAElB;;;;;;;;;;;;;;;GAeG;AACH,UAAU,CAAC,MAAM,GAAG,CAAC,UAAoC,EAAc,EAAE,CACvE,CAAC;IACC,GAAG,UAAU;IACb,IAAI,EAAE,QAAQ;CACA,CAAA,CAAA;AAElB,0CAA0C;AAC1C,OAAO,EAAE,UAAU,IAAI,IAAI,EAAE,CAAA"}
|