human-in-the-loop 0.1.0 → 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.
@@ -0,0 +1,308 @@
1
+ /**
2
+ * Helper functions for common human-in-the-loop patterns
3
+ */
4
+ import type { Role, Team, Goals, KPIs, OKRs, Human as HumanType, ApprovalResponse } from './types.js';
5
+ import { Human } from './human.js';
6
+ /**
7
+ * Define a human role
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const techLead = Role({
12
+ * id: 'tech-lead',
13
+ * name: 'Tech Lead',
14
+ * capabilities: ['approve-prs', 'deploy-prod'],
15
+ * escalatesTo: 'engineering-manager',
16
+ * })
17
+ * ```
18
+ */
19
+ export declare function Role(role: Role): Role;
20
+ /**
21
+ * Define a team
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const engineering = Team({
26
+ * id: 'engineering',
27
+ * name: 'Engineering Team',
28
+ * members: ['alice', 'bob', 'charlie'],
29
+ * lead: 'alice',
30
+ * })
31
+ * ```
32
+ */
33
+ export declare function Team(team: Team): Team;
34
+ /**
35
+ * Define goals for a team or individual
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const q1Goals = Goals({
40
+ * id: 'q1-2024',
41
+ * objectives: [
42
+ * 'Launch v2.0',
43
+ * 'Improve performance by 50%',
44
+ * ],
45
+ * targetDate: new Date('2024-03-31'),
46
+ * })
47
+ * ```
48
+ */
49
+ export declare function Goals(goals: Goals): Goals;
50
+ /**
51
+ * Request approval from a human
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const result = await approve({
56
+ * title: 'Deploy to production',
57
+ * description: 'Deploy v2.0.0 to production',
58
+ * subject: 'Production Deployment',
59
+ * input: { version: '2.0.0', environment: 'prod' },
60
+ * assignee: 'tech-lead@example.com',
61
+ * priority: 'high',
62
+ * })
63
+ *
64
+ * if (result.approved) {
65
+ * await deploy()
66
+ * }
67
+ * ```
68
+ */
69
+ export declare function approve<TData = unknown>(params: {
70
+ title: string;
71
+ description: string;
72
+ subject: string;
73
+ input: TData;
74
+ assignee?: string | string[];
75
+ role?: string;
76
+ team?: string;
77
+ priority?: 'low' | 'normal' | 'high' | 'critical';
78
+ timeout?: number;
79
+ escalatesTo?: string | string[];
80
+ requiresApproval?: boolean;
81
+ approvers?: string[];
82
+ metadata?: Record<string, unknown>;
83
+ }): Promise<ApprovalResponse>;
84
+ /**
85
+ * Ask a question to a human
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * const answer = await ask({
90
+ * title: 'Product naming',
91
+ * question: 'What should we name the new feature?',
92
+ * context: { feature: 'AI Assistant' },
93
+ * assignee: 'product-manager@example.com',
94
+ * })
95
+ * ```
96
+ */
97
+ export declare function ask(params: {
98
+ title: string;
99
+ question: string;
100
+ context?: unknown;
101
+ assignee?: string | string[];
102
+ role?: string;
103
+ team?: string;
104
+ priority?: 'low' | 'normal' | 'high' | 'critical';
105
+ timeout?: number;
106
+ suggestions?: string[];
107
+ metadata?: Record<string, unknown>;
108
+ }): Promise<string>;
109
+ /**
110
+ * Request a human to perform a task
111
+ *
112
+ * This uses the digital-workers interface for humans
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * const result = await do({
117
+ * title: 'Review code',
118
+ * instructions: 'Review the PR and provide feedback',
119
+ * input: { prUrl: 'https://github.com/...' },
120
+ * assignee: 'senior-dev@example.com',
121
+ * })
122
+ * ```
123
+ */
124
+ export declare function do_<TInput = unknown, TOutput = unknown>(params: {
125
+ title: string;
126
+ instructions: string;
127
+ input: TInput;
128
+ assignee?: string | string[];
129
+ role?: string;
130
+ team?: string;
131
+ priority?: 'low' | 'normal' | 'high' | 'critical';
132
+ timeout?: number;
133
+ tools?: any[];
134
+ estimatedEffort?: string;
135
+ metadata?: Record<string, unknown>;
136
+ }): Promise<TOutput>;
137
+ export { do_ as do };
138
+ /**
139
+ * Request a human to make a decision
140
+ *
141
+ * @example
142
+ * ```ts
143
+ * const choice = await decide({
144
+ * title: 'Pick deployment strategy',
145
+ * options: ['blue-green', 'canary', 'rolling'],
146
+ * context: { risk: 'high', users: 100000 },
147
+ * assignee: 'devops-lead@example.com',
148
+ * })
149
+ * ```
150
+ */
151
+ export declare function decide<TOptions extends string = string>(params: {
152
+ title: string;
153
+ description?: string;
154
+ options: TOptions[];
155
+ context?: unknown;
156
+ assignee?: string | string[];
157
+ role?: string;
158
+ team?: string;
159
+ priority?: 'low' | 'normal' | 'high' | 'critical';
160
+ timeout?: number;
161
+ criteria?: string[];
162
+ metadata?: Record<string, unknown>;
163
+ }): Promise<TOptions>;
164
+ /**
165
+ * Request generation/content creation from a human
166
+ *
167
+ * This is a specialized form of do() for content generation
168
+ *
169
+ * @example
170
+ * ```ts
171
+ * const content = await generate({
172
+ * title: 'Write blog post',
173
+ * instructions: 'Write a blog post about our new feature',
174
+ * input: { topic: 'AI Assistant', targetAudience: 'developers' },
175
+ * assignee: 'content-writer@example.com',
176
+ * })
177
+ * ```
178
+ */
179
+ export declare function generate<TInput = unknown>(params: {
180
+ title: string;
181
+ instructions: string;
182
+ input: TInput;
183
+ assignee?: string | string[];
184
+ role?: string;
185
+ team?: string;
186
+ priority?: 'low' | 'normal' | 'high' | 'critical';
187
+ timeout?: number;
188
+ metadata?: Record<string, unknown>;
189
+ }): Promise<string>;
190
+ /**
191
+ * Type checking/validation request
192
+ *
193
+ * Ask a human to validate data or check type compliance
194
+ *
195
+ * @example
196
+ * ```ts
197
+ * const valid = await is({
198
+ * title: 'Validate user data',
199
+ * question: 'Is this user data valid and complete?',
200
+ * input: userData,
201
+ * assignee: 'data-specialist@example.com',
202
+ * })
203
+ * ```
204
+ */
205
+ export declare function is(params: {
206
+ title: string;
207
+ question: string;
208
+ input: unknown;
209
+ assignee?: string | string[];
210
+ role?: string;
211
+ team?: string;
212
+ priority?: 'low' | 'normal' | 'high' | 'critical';
213
+ timeout?: number;
214
+ metadata?: Record<string, unknown>;
215
+ }): Promise<boolean>;
216
+ /**
217
+ * Send a notification to a human
218
+ *
219
+ * @example
220
+ * ```ts
221
+ * await notify({
222
+ * type: 'info',
223
+ * title: 'Deployment complete',
224
+ * message: 'Version 2.0.0 deployed successfully',
225
+ * recipient: 'team@example.com',
226
+ * channels: ['slack', 'email'],
227
+ * })
228
+ * ```
229
+ */
230
+ export declare function notify(params: {
231
+ type: 'info' | 'warning' | 'error' | 'success';
232
+ title: string;
233
+ message: string;
234
+ recipient: string | string[];
235
+ channels?: ('slack' | 'email' | 'sms' | 'web')[];
236
+ priority?: 'low' | 'normal' | 'high' | 'critical';
237
+ data?: unknown;
238
+ }): Promise<void>;
239
+ /**
240
+ * Track Key Performance Indicators
241
+ *
242
+ * @example
243
+ * ```ts
244
+ * kpis({
245
+ * id: 'monthly-revenue',
246
+ * name: 'Monthly Revenue',
247
+ * value: 150000,
248
+ * target: 200000,
249
+ * unit: 'USD',
250
+ * trend: 'up',
251
+ * })
252
+ * ```
253
+ */
254
+ export declare function kpis(kpis: KPIs): KPIs;
255
+ /**
256
+ * Define Objectives and Key Results
257
+ *
258
+ * @example
259
+ * ```ts
260
+ * okrs({
261
+ * id: 'q1-2024-growth',
262
+ * objective: 'Accelerate user growth',
263
+ * keyResults: [
264
+ * {
265
+ * description: 'Increase active users by 50%',
266
+ * progress: 0.3,
267
+ * current: 13000,
268
+ * target: 15000,
269
+ * },
270
+ * {
271
+ * description: 'Achieve 95% customer satisfaction',
272
+ * progress: 0.85,
273
+ * current: 0.93,
274
+ * target: 0.95,
275
+ * },
276
+ * ],
277
+ * period: 'Q1 2024',
278
+ * owner: 'ceo@example.com',
279
+ * })
280
+ * ```
281
+ */
282
+ export declare function okrs(okrs: OKRs): OKRs;
283
+ /**
284
+ * Register a human worker in the system
285
+ *
286
+ * @example
287
+ * ```ts
288
+ * const alice = registerHuman({
289
+ * id: 'alice',
290
+ * name: 'Alice Smith',
291
+ * email: 'alice@example.com',
292
+ * roles: ['tech-lead', 'developer'],
293
+ * teams: ['engineering', 'frontend'],
294
+ * channels: {
295
+ * slack: '@alice',
296
+ * email: 'alice@example.com',
297
+ * },
298
+ * })
299
+ * ```
300
+ */
301
+ export declare function registerHuman(human: HumanType): HumanType;
302
+ /**
303
+ * Get the default Human manager instance
304
+ *
305
+ * Use this to access the underlying HumanManager for advanced operations
306
+ */
307
+ export declare function getDefaultHuman(): ReturnType<typeof Human>;
308
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,IAAI,SAAS,EAClB,gBAAgB,EAEjB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAOlC;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAErC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAErC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAEzC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,OAAO,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,EAAE;IACrD,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAA;IACjD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAA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;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAErC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,UAAU,CAAC,OAAO,KAAK,CAAC,CAE1D"}
@@ -0,0 +1,275 @@
1
+ /**
2
+ * Helper functions for common human-in-the-loop patterns
3
+ */
4
+ import { Human } from './human.js';
5
+ /**
6
+ * Create a default Human instance for convenience
7
+ */
8
+ const defaultHuman = Human();
9
+ /**
10
+ * Define a human role
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const techLead = Role({
15
+ * id: 'tech-lead',
16
+ * name: 'Tech Lead',
17
+ * capabilities: ['approve-prs', 'deploy-prod'],
18
+ * escalatesTo: 'engineering-manager',
19
+ * })
20
+ * ```
21
+ */
22
+ export function Role(role) {
23
+ return defaultHuman.defineRole(role);
24
+ }
25
+ /**
26
+ * Define a team
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const engineering = Team({
31
+ * id: 'engineering',
32
+ * name: 'Engineering Team',
33
+ * members: ['alice', 'bob', 'charlie'],
34
+ * lead: 'alice',
35
+ * })
36
+ * ```
37
+ */
38
+ export function Team(team) {
39
+ return defaultHuman.defineTeam(team);
40
+ }
41
+ /**
42
+ * Define goals for a team or individual
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const q1Goals = Goals({
47
+ * id: 'q1-2024',
48
+ * objectives: [
49
+ * 'Launch v2.0',
50
+ * 'Improve performance by 50%',
51
+ * ],
52
+ * targetDate: new Date('2024-03-31'),
53
+ * })
54
+ * ```
55
+ */
56
+ export function Goals(goals) {
57
+ return defaultHuman.defineGoals(goals);
58
+ }
59
+ /**
60
+ * Request approval from a human
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const result = await approve({
65
+ * title: 'Deploy to production',
66
+ * description: 'Deploy v2.0.0 to production',
67
+ * subject: 'Production Deployment',
68
+ * input: { version: '2.0.0', environment: 'prod' },
69
+ * assignee: 'tech-lead@example.com',
70
+ * priority: 'high',
71
+ * })
72
+ *
73
+ * if (result.approved) {
74
+ * await deploy()
75
+ * }
76
+ * ```
77
+ */
78
+ export async function approve(params) {
79
+ return defaultHuman.approve(params);
80
+ }
81
+ /**
82
+ * Ask a question to a human
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * const answer = await ask({
87
+ * title: 'Product naming',
88
+ * question: 'What should we name the new feature?',
89
+ * context: { feature: 'AI Assistant' },
90
+ * assignee: 'product-manager@example.com',
91
+ * })
92
+ * ```
93
+ */
94
+ export async function ask(params) {
95
+ return defaultHuman.ask(params);
96
+ }
97
+ /**
98
+ * Request a human to perform a task
99
+ *
100
+ * This uses the digital-workers interface for humans
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const result = await do({
105
+ * title: 'Review code',
106
+ * instructions: 'Review the PR and provide feedback',
107
+ * input: { prUrl: 'https://github.com/...' },
108
+ * assignee: 'senior-dev@example.com',
109
+ * })
110
+ * ```
111
+ */
112
+ export async function do_(params) {
113
+ return defaultHuman.do(params);
114
+ }
115
+ // Export as 'do' for the API, but define as 'do_' to avoid reserved keyword
116
+ export { do_ as do };
117
+ /**
118
+ * Request a human to make a decision
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * const choice = await decide({
123
+ * title: 'Pick deployment strategy',
124
+ * options: ['blue-green', 'canary', 'rolling'],
125
+ * context: { risk: 'high', users: 100000 },
126
+ * assignee: 'devops-lead@example.com',
127
+ * })
128
+ * ```
129
+ */
130
+ export async function decide(params) {
131
+ return defaultHuman.decide(params);
132
+ }
133
+ /**
134
+ * Request generation/content creation from a human
135
+ *
136
+ * This is a specialized form of do() for content generation
137
+ *
138
+ * @example
139
+ * ```ts
140
+ * const content = await generate({
141
+ * title: 'Write blog post',
142
+ * instructions: 'Write a blog post about our new feature',
143
+ * input: { topic: 'AI Assistant', targetAudience: 'developers' },
144
+ * assignee: 'content-writer@example.com',
145
+ * })
146
+ * ```
147
+ */
148
+ export async function generate(params) {
149
+ return defaultHuman.do(params);
150
+ }
151
+ /**
152
+ * Type checking/validation request
153
+ *
154
+ * Ask a human to validate data or check type compliance
155
+ *
156
+ * @example
157
+ * ```ts
158
+ * const valid = await is({
159
+ * title: 'Validate user data',
160
+ * question: 'Is this user data valid and complete?',
161
+ * input: userData,
162
+ * assignee: 'data-specialist@example.com',
163
+ * })
164
+ * ```
165
+ */
166
+ export async function is(params) {
167
+ const result = await defaultHuman.decide({
168
+ title: params.title,
169
+ description: params.question,
170
+ options: ['true', 'false'],
171
+ context: params.input,
172
+ assignee: params.assignee,
173
+ role: params.role,
174
+ team: params.team,
175
+ priority: params.priority,
176
+ timeout: params.timeout,
177
+ metadata: params.metadata,
178
+ });
179
+ return result === 'true';
180
+ }
181
+ /**
182
+ * Send a notification to a human
183
+ *
184
+ * @example
185
+ * ```ts
186
+ * await notify({
187
+ * type: 'info',
188
+ * title: 'Deployment complete',
189
+ * message: 'Version 2.0.0 deployed successfully',
190
+ * recipient: 'team@example.com',
191
+ * channels: ['slack', 'email'],
192
+ * })
193
+ * ```
194
+ */
195
+ export async function notify(params) {
196
+ await defaultHuman.notify(params);
197
+ }
198
+ /**
199
+ * Track Key Performance Indicators
200
+ *
201
+ * @example
202
+ * ```ts
203
+ * kpis({
204
+ * id: 'monthly-revenue',
205
+ * name: 'Monthly Revenue',
206
+ * value: 150000,
207
+ * target: 200000,
208
+ * unit: 'USD',
209
+ * trend: 'up',
210
+ * })
211
+ * ```
212
+ */
213
+ export function kpis(kpis) {
214
+ return defaultHuman.trackKPIs(kpis);
215
+ }
216
+ /**
217
+ * Define Objectives and Key Results
218
+ *
219
+ * @example
220
+ * ```ts
221
+ * okrs({
222
+ * id: 'q1-2024-growth',
223
+ * objective: 'Accelerate user growth',
224
+ * keyResults: [
225
+ * {
226
+ * description: 'Increase active users by 50%',
227
+ * progress: 0.3,
228
+ * current: 13000,
229
+ * target: 15000,
230
+ * },
231
+ * {
232
+ * description: 'Achieve 95% customer satisfaction',
233
+ * progress: 0.85,
234
+ * current: 0.93,
235
+ * target: 0.95,
236
+ * },
237
+ * ],
238
+ * period: 'Q1 2024',
239
+ * owner: 'ceo@example.com',
240
+ * })
241
+ * ```
242
+ */
243
+ export function okrs(okrs) {
244
+ return defaultHuman.defineOKRs(okrs);
245
+ }
246
+ /**
247
+ * Register a human worker in the system
248
+ *
249
+ * @example
250
+ * ```ts
251
+ * const alice = registerHuman({
252
+ * id: 'alice',
253
+ * name: 'Alice Smith',
254
+ * email: 'alice@example.com',
255
+ * roles: ['tech-lead', 'developer'],
256
+ * teams: ['engineering', 'frontend'],
257
+ * channels: {
258
+ * slack: '@alice',
259
+ * email: 'alice@example.com',
260
+ * },
261
+ * })
262
+ * ```
263
+ */
264
+ export function registerHuman(human) {
265
+ return defaultHuman.registerHuman(human);
266
+ }
267
+ /**
268
+ * Get the default Human manager instance
269
+ *
270
+ * Use this to access the underlying HumanManager for advanced operations
271
+ */
272
+ export function getDefaultHuman() {
273
+ return defaultHuman;
274
+ }
275
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC;;GAEG;AACH,MAAM,YAAY,GAAG,KAAK,EAAE,CAAA;AAE5B;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,IAAI,CAAC,IAAU;IAC7B,OAAO,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;AACtC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,IAAI,CAAC,IAAU;IAC7B,OAAO,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;AACtC,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,KAAK,CAAC,KA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