digital-workers 2.0.2 → 2.1.3
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/.turbo/turbo-build.log +4 -5
- package/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +134 -180
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +1 -0
- package/dist/actions.js.map +1 -1
- package/dist/agent-comms.d.ts +438 -0
- package/dist/agent-comms.d.ts.map +1 -0
- package/dist/agent-comms.js +666 -0
- package/dist/agent-comms.js.map +1 -0
- package/dist/capability-tiers.d.ts +230 -0
- package/dist/capability-tiers.d.ts.map +1 -0
- package/dist/capability-tiers.js +388 -0
- package/dist/capability-tiers.js.map +1 -0
- package/dist/cascade-context.d.ts +523 -0
- package/dist/cascade-context.d.ts.map +1 -0
- package/dist/cascade-context.js +494 -0
- package/dist/cascade-context.js.map +1 -0
- package/dist/error-escalation.d.ts +416 -0
- package/dist/error-escalation.d.ts.map +1 -0
- package/dist/error-escalation.js +656 -0
- package/dist/error-escalation.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -1
- package/dist/load-balancing.d.ts +395 -0
- package/dist/load-balancing.d.ts.map +1 -0
- package/dist/load-balancing.js +905 -0
- package/dist/load-balancing.js.map +1 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +14 -14
- package/src/actions.js +436 -0
- package/src/actions.ts +9 -8
- package/src/agent-comms.ts +1238 -0
- package/src/approve.js +234 -0
- package/src/ask.js +226 -0
- package/src/capability-tiers.ts +545 -0
- package/src/cascade-context.ts +648 -0
- package/src/decide.js +244 -0
- package/src/do.js +227 -0
- package/src/error-escalation.ts +1135 -0
- package/src/generate.js +298 -0
- package/src/goals.js +205 -0
- package/src/index.js +68 -0
- package/src/index.ts +223 -0
- package/src/is.js +317 -0
- package/src/kpis.js +270 -0
- package/src/load-balancing.ts +1381 -0
- package/src/notify.js +219 -0
- package/src/role.js +110 -0
- package/src/team.js +130 -0
- package/src/transports.js +357 -0
- package/src/types.js +71 -0
- package/src/types.ts +8 -0
- package/test/actions.test.js +401 -0
- package/test/agent-comms.test.ts +1397 -0
- package/test/capability-tiers.test.ts +631 -0
- package/test/cascade-context.test.ts +692 -0
- package/test/error-escalation.test.ts +1205 -0
- package/test/load-balancing-thread-safety.test.ts +464 -0
- package/test/load-balancing.test.ts +1145 -0
- package/test/standalone.test.js +250 -0
- package/test/types.test.js +371 -0
- package/test/types.test.ts +35 -0
package/src/actions.ts
CHANGED
|
@@ -325,13 +325,14 @@ export function withWorkers($: WorkflowContext): WorkflowContext & WorkerContext
|
|
|
325
325
|
message: string,
|
|
326
326
|
options: NotifyOptions = {}
|
|
327
327
|
): Promise<NotifyResult> {
|
|
328
|
-
|
|
328
|
+
// Workflow handler returns NotifyResult; $.do passes through the result
|
|
329
|
+
return $.do<NotifyResult>('Worker.notify', {
|
|
329
330
|
actor: 'system',
|
|
330
331
|
object: target,
|
|
331
332
|
action: 'notify',
|
|
332
333
|
message,
|
|
333
334
|
...options,
|
|
334
|
-
})
|
|
335
|
+
} as NotifyActionData)
|
|
335
336
|
},
|
|
336
337
|
|
|
337
338
|
async ask<T = string>(
|
|
@@ -339,13 +340,13 @@ export function withWorkers($: WorkflowContext): WorkflowContext & WorkerContext
|
|
|
339
340
|
question: string,
|
|
340
341
|
options: AskOptions = {}
|
|
341
342
|
): Promise<AskResult<T>> {
|
|
342
|
-
return $.do<
|
|
343
|
+
return $.do<AskResult<T>>('Worker.ask', {
|
|
343
344
|
actor: 'system',
|
|
344
345
|
object: target,
|
|
345
346
|
action: 'ask',
|
|
346
347
|
question,
|
|
347
348
|
...options,
|
|
348
|
-
})
|
|
349
|
+
} as AskActionData)
|
|
349
350
|
},
|
|
350
351
|
|
|
351
352
|
async approve(
|
|
@@ -360,24 +361,24 @@ export function withWorkers($: WorkflowContext): WorkflowContext & WorkerContext
|
|
|
360
361
|
? { id: target.id, type: 'type' in target ? target.type : undefined, name: 'name' in target ? target.name : undefined }
|
|
361
362
|
: 'system'
|
|
362
363
|
|
|
363
|
-
return $.do<
|
|
364
|
+
return $.do<ApprovalResult>('Worker.approve', {
|
|
364
365
|
actor,
|
|
365
366
|
object: target,
|
|
366
367
|
action: 'approve',
|
|
367
368
|
request,
|
|
368
369
|
...options,
|
|
369
|
-
})
|
|
370
|
+
} as ApproveActionData)
|
|
370
371
|
},
|
|
371
372
|
|
|
372
373
|
async decide<T = string>(
|
|
373
374
|
options: DecideOptions<T>
|
|
374
375
|
): Promise<DecideResult<T>> {
|
|
375
|
-
return $.do<
|
|
376
|
+
return $.do<DecideResult<T>>('Worker.decide', {
|
|
376
377
|
actor: 'ai',
|
|
377
378
|
object: 'decision',
|
|
378
379
|
action: 'decide',
|
|
379
380
|
...options,
|
|
380
|
-
})
|
|
381
|
+
} as DecideActionData)
|
|
381
382
|
},
|
|
382
383
|
}
|
|
383
384
|
|