@synergenius/flowweaver-pack-weaver 0.1.0 → 0.2.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/LICENSE +204 -0
- package/dist/bot/approvals.d.ts +18 -0
- package/dist/bot/approvals.d.ts.map +1 -0
- package/dist/bot/approvals.js +166 -0
- package/dist/bot/approvals.js.map +1 -0
- package/dist/bot/bot-agent-channel.d.ts +4 -4
- package/dist/bot/bot-agent-channel.d.ts.map +1 -1
- package/dist/bot/bot-agent-channel.js +8 -12
- package/dist/bot/bot-agent-channel.js.map +1 -1
- package/dist/bot/index.d.ts +4 -2
- package/dist/bot/index.d.ts.map +1 -1
- package/dist/bot/index.js +1 -0
- package/dist/bot/index.js.map +1 -1
- package/dist/bot/notifications.d.ts +3 -1
- package/dist/bot/notifications.d.ts.map +1 -1
- package/dist/bot/notifications.js +55 -25
- package/dist/bot/notifications.js.map +1 -1
- package/dist/bot/runner.d.ts +4 -1
- package/dist/bot/runner.d.ts.map +1 -1
- package/dist/bot/runner.js +57 -17
- package/dist/bot/runner.js.map +1 -1
- package/dist/bot/types.d.ts +13 -2
- package/dist/bot/types.d.ts.map +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +186 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/templates/weaver-template.d.ts.map +1 -1
- package/dist/templates/weaver-template.js +24 -5
- package/dist/templates/weaver-template.js.map +1 -1
- package/flowweaver.manifest.json +2 -2
- package/package.json +17 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Flow Weaver Library License
|
|
2
|
+
|
|
3
|
+
Version 2.0, February 2026
|
|
4
|
+
|
|
5
|
+
## Quick Reference (non-binding summary)
|
|
6
|
+
|
|
7
|
+
This table is provided for convenience only. In case of any conflict between
|
|
8
|
+
this summary and the license terms below, the license terms control.
|
|
9
|
+
|
|
10
|
+
Permitted:
|
|
11
|
+
|
|
12
|
+
Use Who Notes
|
|
13
|
+
---------------------------------------- ---------------- ----------------------------------
|
|
14
|
+
Install and run locally Anyone No restrictions on local use
|
|
15
|
+
Compile workflows Anyone CLI, programmatic, scripts
|
|
16
|
+
Use generated output (code, artifacts) Anyone Output is unrestricted
|
|
17
|
+
Run in CI/CD pipelines and build systems Anyone, any size Not considered "hosting"
|
|
18
|
+
Distribute copies with license notices Anyone Must include license, mark changes
|
|
19
|
+
Create derivative works Anyone Must retain license key checks
|
|
20
|
+
Host internally Orgs <= 15 All members count toward limit
|
|
21
|
+
Embed in internal toolchains Anyone No visual workflow authoring UI
|
|
22
|
+
Use inside a larger product Anyone If flow-weaver is not the primary value
|
|
23
|
+
|
|
24
|
+
Requires commercial license:
|
|
25
|
+
|
|
26
|
+
Use Notes
|
|
27
|
+
---------------------------------------- ----------------------------------
|
|
28
|
+
Host internally Orgs > 15 people
|
|
29
|
+
Build visual workflow authoring tools Standalone products for workflow authoring
|
|
30
|
+
Offer as a hosted or managed service To third parties, at any scale
|
|
31
|
+
Sell products built on the software Where flow-weaver is the primary value
|
|
32
|
+
|
|
33
|
+
Never permitted:
|
|
34
|
+
|
|
35
|
+
Use Notes
|
|
36
|
+
---------------------------------------- ----------------------------------
|
|
37
|
+
Remove or circumvent license keys Applies to software and derivatives
|
|
38
|
+
Remove licensing or copyright notices Must always be retained
|
|
39
|
+
Strip license key checks from forks Derivatives must retain protections
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Acceptance
|
|
44
|
+
|
|
45
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
46
|
+
|
|
47
|
+
## Copyright License
|
|
48
|
+
|
|
49
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
50
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
51
|
+
available, and prepare derivative works of the software, in each case subject to
|
|
52
|
+
the limitations and conditions below.
|
|
53
|
+
|
|
54
|
+
## Limitations
|
|
55
|
+
|
|
56
|
+
You may not provide the software to third parties as a hosted or managed
|
|
57
|
+
service, where the service provides users with access to any of the features or
|
|
58
|
+
functionality of the software.
|
|
59
|
+
|
|
60
|
+
You may not use the software to build, distribute, or offer any standalone
|
|
61
|
+
product or service whose primary purpose is providing a graphical or visual
|
|
62
|
+
interface for creating, editing, designing, or composing workflows. This
|
|
63
|
+
restriction applies whether the product is hosted, distributed, sold, or offered
|
|
64
|
+
free of charge. It does not apply to products that use the software internally
|
|
65
|
+
without exposing its workflow authoring capabilities to end users through a
|
|
66
|
+
graphical interface.
|
|
67
|
+
|
|
68
|
+
You may not sell the software or any product that provides, as its primary
|
|
69
|
+
function, capabilities supplied by the software (including workflow compilation,
|
|
70
|
+
parsing, validation, code generation, or diagram generation), without a separate
|
|
71
|
+
commercial license from the licensor. This does not restrict the sale of products
|
|
72
|
+
that merely incorporate the software as one component among many, where the
|
|
73
|
+
product's primary value comes from functionality independent of the software.
|
|
74
|
+
|
|
75
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
76
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
77
|
+
software that is protected by the license key.
|
|
78
|
+
|
|
79
|
+
Derivative works must retain all license key functionality, license verification
|
|
80
|
+
mechanisms, and licensing notices present in the original software. Distributing
|
|
81
|
+
derivative works with license key protections removed, disabled, or bypassed
|
|
82
|
+
constitutes a violation of this license.
|
|
83
|
+
|
|
84
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
85
|
+
of the licensor in the software. Any use of the licensor's trademarks is subject
|
|
86
|
+
to applicable law.
|
|
87
|
+
|
|
88
|
+
## Patents
|
|
89
|
+
|
|
90
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
91
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
92
|
+
sale, import and have imported the software, in each case subject to the
|
|
93
|
+
limitations and conditions in this license. This license does not cover any
|
|
94
|
+
patent claims that you cause to be infringed by modifications or additions to the
|
|
95
|
+
software. If you or your company make any written claim that the software
|
|
96
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
97
|
+
the software granted under these terms ends immediately. If your company makes
|
|
98
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
99
|
+
company.
|
|
100
|
+
|
|
101
|
+
## Notices
|
|
102
|
+
|
|
103
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
104
|
+
also gets a copy of these terms.
|
|
105
|
+
|
|
106
|
+
If you modify the software, you must include in any modified copies of the
|
|
107
|
+
software prominent notices stating that you have modified the software.
|
|
108
|
+
|
|
109
|
+
## No Other Rights
|
|
110
|
+
|
|
111
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
112
|
+
these terms.
|
|
113
|
+
|
|
114
|
+
## Termination
|
|
115
|
+
|
|
116
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
117
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
118
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
119
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
120
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
121
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
122
|
+
to terminate immediately.
|
|
123
|
+
|
|
124
|
+
You may request a review of any termination by contacting the licensor in
|
|
125
|
+
writing within 15 days of termination. The licensor will respond within 30 days.
|
|
126
|
+
|
|
127
|
+
## No Liability
|
|
128
|
+
|
|
129
|
+
As far as the law allows, the software comes as is, without any warranty or
|
|
130
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
131
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
132
|
+
legal claim.
|
|
133
|
+
|
|
134
|
+
## Governing Law
|
|
135
|
+
|
|
136
|
+
This license is governed by the laws of Portugal. Any disputes arising from or
|
|
137
|
+
related to this license will be submitted to the exclusive jurisdiction of the
|
|
138
|
+
courts of Lisbon, Portugal.
|
|
139
|
+
|
|
140
|
+
## Definitions
|
|
141
|
+
|
|
142
|
+
The "licensor" is Ricardo Jose Horta Morais (Synergenius), and the "software"
|
|
143
|
+
is the software the licensor makes available under these terms.
|
|
144
|
+
|
|
145
|
+
"You" refers to the individual or entity agreeing to these terms. "Your company"
|
|
146
|
+
is any legal entity, sole proprietorship, or other kind of organization that you
|
|
147
|
+
work for, plus all organizations that have control over, are under the control
|
|
148
|
+
of, or are under common control with that organization. "Control" means
|
|
149
|
+
ownership of substantially all the assets of an entity, or the power to direct
|
|
150
|
+
its management and policies by vote, contract, or otherwise. Control can be
|
|
151
|
+
direct or indirect.
|
|
152
|
+
|
|
153
|
+
"Third parties" means any individual or entity that is not you or your company
|
|
154
|
+
as defined in these terms.
|
|
155
|
+
|
|
156
|
+
"Your licenses" are all the licenses granted to you for the software under these
|
|
157
|
+
terms. "Use" means anything you do with the software requiring one of your
|
|
158
|
+
licenses.
|
|
159
|
+
|
|
160
|
+
"Hosting the software" means making the software's functionality available to
|
|
161
|
+
users over a network as a service. Running the software in automated build
|
|
162
|
+
pipelines, continuous integration systems, command-line interfaces, or
|
|
163
|
+
development toolchains does not constitute hosting, regardless of organization
|
|
164
|
+
size.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
ADDITIONAL NOTICES
|
|
169
|
+
|
|
170
|
+
1. Output of the Software
|
|
171
|
+
|
|
172
|
+
The output of the software, including but not limited to compiled workflows,
|
|
173
|
+
generated code, deployment artifacts, and any other files produced by the
|
|
174
|
+
software's compilation, code generation, or export features, is not considered
|
|
175
|
+
part of the software and may be used, copied, modified, distributed, and
|
|
176
|
+
sublicensed for any purpose without restriction under this license.
|
|
177
|
+
|
|
178
|
+
2. Internal Hosting Threshold
|
|
179
|
+
|
|
180
|
+
Organizations with 15 or fewer individuals, including employees, contractors,
|
|
181
|
+
and affiliates, may host the software on internal infrastructure for use by
|
|
182
|
+
their members without restriction under this license. The count includes all
|
|
183
|
+
individuals in the organization, not only those who directly use the software.
|
|
184
|
+
|
|
185
|
+
Organizations with more than 15 individuals that wish to host the software,
|
|
186
|
+
whether on internal infrastructure or as a service, require a commercial
|
|
187
|
+
license.
|
|
188
|
+
|
|
189
|
+
3. Unrestricted Use
|
|
190
|
+
|
|
191
|
+
Using the software locally, including installing, running, compiling workflows,
|
|
192
|
+
generating code, and producing deployment artifacts, is permitted for any
|
|
193
|
+
individual or organization regardless of size, subject to the Limitations above.
|
|
194
|
+
|
|
195
|
+
4. Export Compliance
|
|
196
|
+
|
|
197
|
+
You are responsible for compliance with all applicable export and import laws
|
|
198
|
+
and regulations in your jurisdiction when using, distributing, or making the
|
|
199
|
+
software available.
|
|
200
|
+
|
|
201
|
+
5. Commercial Licensing
|
|
202
|
+
|
|
203
|
+
For commercial licensing inquiries, partnership arrangements, or questions
|
|
204
|
+
about permitted use, contact support@synergenius.pt.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ApprovalMode, NotificationEvent } from './types.js';
|
|
2
|
+
export interface ApprovalRequest {
|
|
3
|
+
context: Record<string, unknown>;
|
|
4
|
+
prompt: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ApprovalResult {
|
|
7
|
+
approved: boolean;
|
|
8
|
+
reason: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ApprovalHandler {
|
|
11
|
+
handle(request: ApprovalRequest, event: NotificationEvent): Promise<ApprovalResult>;
|
|
12
|
+
}
|
|
13
|
+
export declare function createApprovalHandler(mode: ApprovalMode, options: {
|
|
14
|
+
timeoutSeconds: number;
|
|
15
|
+
webhookUrl?: string;
|
|
16
|
+
notifier: (event: NotificationEvent) => Promise<void>;
|
|
17
|
+
}): ApprovalHandler;
|
|
18
|
+
//# sourceMappingURL=approvals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../src/bot/approvals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAElE,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,CACJ,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,cAAc,CAAC,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE;IACP,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD,GACA,eAAe,CAejB"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import * as readline from 'node:readline';
|
|
2
|
+
export function createApprovalHandler(mode, options) {
|
|
3
|
+
switch (mode) {
|
|
4
|
+
case 'auto':
|
|
5
|
+
return new AutoApproval(options.notifier);
|
|
6
|
+
case 'prompt':
|
|
7
|
+
return new PromptApproval(options.timeoutSeconds, options.notifier);
|
|
8
|
+
case 'webhook':
|
|
9
|
+
return new WebhookApproval(options.webhookUrl ?? '', options.timeoutSeconds, options.notifier);
|
|
10
|
+
case 'timeout-auto':
|
|
11
|
+
return new TimeoutAutoApproval(options.timeoutSeconds, options.notifier);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
class AutoApproval {
|
|
15
|
+
notifier;
|
|
16
|
+
constructor(notifier) {
|
|
17
|
+
this.notifier = notifier;
|
|
18
|
+
}
|
|
19
|
+
async handle(_request, event) {
|
|
20
|
+
await this.notifier(event);
|
|
21
|
+
return { approved: true, reason: 'auto-approved by Weaver' };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class PromptApproval {
|
|
25
|
+
timeoutSeconds;
|
|
26
|
+
notifier;
|
|
27
|
+
constructor(timeoutSeconds, notifier) {
|
|
28
|
+
this.timeoutSeconds = timeoutSeconds;
|
|
29
|
+
this.notifier = notifier;
|
|
30
|
+
}
|
|
31
|
+
async handle(request, event) {
|
|
32
|
+
await this.notifier(event);
|
|
33
|
+
// Non-TTY: fall back to timeout-auto
|
|
34
|
+
if (!process.stdin.isTTY) {
|
|
35
|
+
console.log(`[weaver] No TTY available, auto-approving after ${this.timeoutSeconds}s`);
|
|
36
|
+
await new Promise((r) => setTimeout(r, this.timeoutSeconds * 1000));
|
|
37
|
+
return { approved: true, reason: 'auto-approved (no TTY)' };
|
|
38
|
+
}
|
|
39
|
+
const summary = typeof request.context === 'string'
|
|
40
|
+
? request.context
|
|
41
|
+
: JSON.stringify(request.context, null, 2);
|
|
42
|
+
console.log('\n[weaver] Approval required:');
|
|
43
|
+
console.log(summary.slice(0, 500));
|
|
44
|
+
if (summary.length > 500)
|
|
45
|
+
console.log(' ... (truncated)');
|
|
46
|
+
const answer = await this.askWithTimeout(`\n[weaver] Approve? (y/n, auto-approves in ${this.timeoutSeconds}s): `, this.timeoutSeconds);
|
|
47
|
+
if (answer === null) {
|
|
48
|
+
return {
|
|
49
|
+
approved: true,
|
|
50
|
+
reason: `auto-approved after ${this.timeoutSeconds}s timeout`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const approved = answer.trim().toLowerCase().startsWith('y');
|
|
54
|
+
return {
|
|
55
|
+
approved,
|
|
56
|
+
reason: approved ? 'approved by user' : 'rejected by user',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
askWithTimeout(prompt, timeoutSeconds) {
|
|
60
|
+
return new Promise((resolve) => {
|
|
61
|
+
const rl = readline.createInterface({
|
|
62
|
+
input: process.stdin,
|
|
63
|
+
output: process.stdout,
|
|
64
|
+
});
|
|
65
|
+
const timer = setTimeout(() => {
|
|
66
|
+
console.log('\n[weaver] Timeout reached, auto-approving');
|
|
67
|
+
rl.close();
|
|
68
|
+
resolve(null);
|
|
69
|
+
}, timeoutSeconds * 1000);
|
|
70
|
+
rl.question(prompt, (answer) => {
|
|
71
|
+
clearTimeout(timer);
|
|
72
|
+
rl.close();
|
|
73
|
+
resolve(answer);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
class WebhookApproval {
|
|
79
|
+
webhookUrl;
|
|
80
|
+
timeoutSeconds;
|
|
81
|
+
notifier;
|
|
82
|
+
constructor(webhookUrl, timeoutSeconds, notifier) {
|
|
83
|
+
this.webhookUrl = webhookUrl;
|
|
84
|
+
this.timeoutSeconds = timeoutSeconds;
|
|
85
|
+
this.notifier = notifier;
|
|
86
|
+
}
|
|
87
|
+
async handle(request, event) {
|
|
88
|
+
await this.notifier(event);
|
|
89
|
+
if (!this.webhookUrl) {
|
|
90
|
+
console.error('[weaver] Webhook approval requires webhookUrl in approval config, falling back to timeout-auto');
|
|
91
|
+
await new Promise((r) => setTimeout(r, this.timeoutSeconds * 1000));
|
|
92
|
+
return { approved: true, reason: 'auto-approved (no webhookUrl)' };
|
|
93
|
+
}
|
|
94
|
+
// POST the proposal to the webhook
|
|
95
|
+
try {
|
|
96
|
+
const resp = await fetch(this.webhookUrl, {
|
|
97
|
+
method: 'POST',
|
|
98
|
+
headers: { 'Content-Type': 'application/json' },
|
|
99
|
+
body: JSON.stringify({
|
|
100
|
+
type: 'approval-request',
|
|
101
|
+
proposal: request.context,
|
|
102
|
+
prompt: request.prompt,
|
|
103
|
+
timeoutSeconds: this.timeoutSeconds,
|
|
104
|
+
}),
|
|
105
|
+
});
|
|
106
|
+
if (!resp.ok) {
|
|
107
|
+
console.error(`[weaver] Webhook POST failed: ${resp.status}, falling back to timeout-auto`);
|
|
108
|
+
await new Promise((r) => setTimeout(r, this.timeoutSeconds * 1000));
|
|
109
|
+
return { approved: true, reason: 'auto-approved (webhook error)' };
|
|
110
|
+
}
|
|
111
|
+
// Poll for response
|
|
112
|
+
const pollUrl = resp.headers.get('location') ?? this.webhookUrl + '/status';
|
|
113
|
+
return await this.pollForDecision(pollUrl);
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
117
|
+
console.error(`[weaver] Webhook error: ${msg}, falling back to timeout-auto`);
|
|
118
|
+
await new Promise((r) => setTimeout(r, this.timeoutSeconds * 1000));
|
|
119
|
+
return { approved: true, reason: 'auto-approved (webhook error)' };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async pollForDecision(url) {
|
|
123
|
+
const deadline = Date.now() + this.timeoutSeconds * 1000;
|
|
124
|
+
const interval = 5000;
|
|
125
|
+
while (Date.now() < deadline) {
|
|
126
|
+
await new Promise((r) => setTimeout(r, interval));
|
|
127
|
+
try {
|
|
128
|
+
const resp = await fetch(url);
|
|
129
|
+
if (!resp.ok)
|
|
130
|
+
continue;
|
|
131
|
+
const body = (await resp.json());
|
|
132
|
+
if (body.pending)
|
|
133
|
+
continue;
|
|
134
|
+
return {
|
|
135
|
+
approved: body.approved ?? true,
|
|
136
|
+
reason: body.reason ?? (body.approved ? 'approved via webhook' : 'rejected via webhook'),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
approved: true,
|
|
145
|
+
reason: `auto-approved after ${this.timeoutSeconds}s webhook timeout`,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
class TimeoutAutoApproval {
|
|
150
|
+
timeoutSeconds;
|
|
151
|
+
notifier;
|
|
152
|
+
constructor(timeoutSeconds, notifier) {
|
|
153
|
+
this.timeoutSeconds = timeoutSeconds;
|
|
154
|
+
this.notifier = notifier;
|
|
155
|
+
}
|
|
156
|
+
async handle(_request, event) {
|
|
157
|
+
await this.notifier(event);
|
|
158
|
+
console.log(`[weaver] Waiting ${this.timeoutSeconds}s before auto-approving...`);
|
|
159
|
+
await new Promise((r) => setTimeout(r, this.timeoutSeconds * 1000));
|
|
160
|
+
return {
|
|
161
|
+
approved: true,
|
|
162
|
+
reason: `auto-approved after ${this.timeoutSeconds}s timeout`,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=approvals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvals.js","sourceRoot":"","sources":["../../src/bot/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAoB1C,MAAM,UAAU,qBAAqB,CACnC,IAAkB,EAClB,OAIC;IAED,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,MAAM;YACT,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC5C,KAAK,QAAQ;YACX,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QACtE,KAAK,SAAS;YACZ,OAAO,IAAI,eAAe,CACxB,OAAO,CAAC,UAAU,IAAI,EAAE,EACxB,OAAO,CAAC,cAAc,EACtB,OAAO,CAAC,QAAQ,CACjB,CAAC;QACJ,KAAK,cAAc;YACjB,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AAED,MAAM,YAAY;IACI;IAApB,YAAoB,QAAqD;QAArD,aAAQ,GAAR,QAAQ,CAA6C;IAAG,CAAC;IAE7E,KAAK,CAAC,MAAM,CACV,QAAyB,EACzB,KAAwB;QAExB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC;IAC/D,CAAC;CAC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I,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,sBAAsB,CAAC;iBACzF,CAAC;YACJ,CAAC;YAAC,MAAM,CAAC;gBACP,SAAS;YACX,CAAC;QACH,CAAC;QAED,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,uBAAuB,IAAI,CAAC,cAAc,mBAAmB;SACtE,CAAC;IACJ,CAAC;CACF;AAED,MAAM,mBAAmB;IAEb;IACA;IAFV,YACU,cAAsB,EACtB,QAAqD;QADrD,mBAAc,GAAd,cAAc,CAAQ;QACtB,aAAQ,GAAR,QAAQ,CAA6C;IAC5D,CAAC;IAEJ,KAAK,CAAC,MAAM,CACV,QAAyB,EACzB,KAAwB;QAExB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,CAAC,GAAG,CACT,oBAAoB,IAAI,CAAC,cAAc,4BAA4B,CACpE,CAAC;QACF,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC;QACpE,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,uBAAuB,IAAI,CAAC,cAAc,WAAW;SAC9D,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BotAgentProvider } from './agent-provider.js';
|
|
2
|
-
import type { NotificationEvent } from './types.js';
|
|
2
|
+
import type { ApprovalMode, NotificationEvent } from './types.js';
|
|
3
3
|
export interface BotChannelContext {
|
|
4
4
|
projectDir: string;
|
|
5
5
|
workflowFile?: string;
|
|
@@ -7,13 +7,13 @@ export interface BotChannelContext {
|
|
|
7
7
|
}
|
|
8
8
|
export declare class BotAgentChannel {
|
|
9
9
|
private provider;
|
|
10
|
-
private
|
|
11
|
-
private approvalTimeoutSeconds;
|
|
10
|
+
private approvalHandler;
|
|
12
11
|
private notifier;
|
|
13
12
|
private context;
|
|
14
13
|
constructor(provider: BotAgentProvider, options: {
|
|
15
|
-
approvalMode:
|
|
14
|
+
approvalMode: ApprovalMode;
|
|
16
15
|
approvalTimeoutSeconds: number;
|
|
16
|
+
approvalWebhookUrl?: string;
|
|
17
17
|
notifier: (event: NotificationEvent) => Promise<void>;
|
|
18
18
|
context: BotChannelContext;
|
|
19
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot-agent-channel.d.ts","sourceRoot":"","sources":["../../src/bot/bot-agent-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"bot-agent-channel.d.ts","sourceRoot":"","sources":["../../src/bot/bot-agent-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGlE,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAmB;IACnC,OAAO,CAAC,eAAe,CAA2C;IAClE,OAAO,CAAC,QAAQ,CAA8C;IAC9D,OAAO,CAAC,OAAO,CAAoB;gBAGjC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE;QACP,YAAY,EAAE,YAAY,CAAC;QAC3B,sBAAsB,EAAE,MAAM,CAAC;QAC/B,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACtD,OAAO,EAAE,iBAAiB,CAAC;KAC5B;IAYG,OAAO,CAAC,YAAY,EAAE;QAC1B,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjC,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,MAAM,CAAC;YAOL,cAAc;IAgB5B,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAG1B,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAC7B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAC5B"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import { createApprovalHandler } from './approvals.js';
|
|
1
2
|
export class BotAgentChannel {
|
|
2
3
|
provider;
|
|
3
|
-
|
|
4
|
-
approvalTimeoutSeconds;
|
|
4
|
+
approvalHandler;
|
|
5
5
|
notifier;
|
|
6
6
|
context;
|
|
7
7
|
constructor(provider, options) {
|
|
8
8
|
this.provider = provider;
|
|
9
|
-
this.approvalMode = options.approvalMode;
|
|
10
|
-
this.approvalTimeoutSeconds = options.approvalTimeoutSeconds;
|
|
11
9
|
this.notifier = options.notifier;
|
|
12
10
|
this.context = options.context;
|
|
11
|
+
this.approvalHandler = createApprovalHandler(options.approvalMode, {
|
|
12
|
+
timeoutSeconds: options.approvalTimeoutSeconds,
|
|
13
|
+
webhookUrl: options.approvalWebhookUrl,
|
|
14
|
+
notifier: options.notifier,
|
|
15
|
+
});
|
|
13
16
|
}
|
|
14
17
|
async request(agentRequest) {
|
|
15
18
|
if (agentRequest.agentId.includes('approval')) {
|
|
@@ -25,14 +28,7 @@ export class BotAgentChannel {
|
|
|
25
28
|
workflowFile: this.context.workflowFile,
|
|
26
29
|
proposal: request.context,
|
|
27
30
|
};
|
|
28
|
-
|
|
29
|
-
await this.notifier(event);
|
|
30
|
-
return { approved: true, reason: 'auto-approved by Weaver' };
|
|
31
|
-
}
|
|
32
|
-
// timeout-auto: notify, wait, then auto-approve
|
|
33
|
-
await this.notifier(event);
|
|
34
|
-
await new Promise((r) => setTimeout(r, this.approvalTimeoutSeconds * 1000));
|
|
35
|
-
return { approved: true, reason: `auto-approved after ${this.approvalTimeoutSeconds}s timeout` };
|
|
31
|
+
return this.approvalHandler.handle(request, event);
|
|
36
32
|
}
|
|
37
33
|
// Compat stubs for AgentChannel interface (used by executor, not by nodes)
|
|
38
34
|
onPause() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot-agent-channel.js","sourceRoot":"","sources":["../../src/bot/bot-agent-channel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bot-agent-channel.js","sourceRoot":"","sources":["../../src/bot/bot-agent-channel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAQvD,MAAM,OAAO,eAAe;IAClB,QAAQ,CAAmB;IAC3B,eAAe,CAA2C;IAC1D,QAAQ,CAA8C;IACtD,OAAO,CAAoB;IAEnC,YACE,QAA0B,EAC1B,OAMC;QAED,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,qBAAqB,CAAC,OAAO,CAAC,YAAY,EAAE;YACjE,cAAc,EAAE,OAAO,CAAC,sBAAsB;YAC9C,UAAU,EAAE,OAAO,CAAC,kBAAkB;YACtC,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,YAIb;QACC,IAAI,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9C,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC5C,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,OAG5B;QACC,MAAM,KAAK,GAAsB;YAC/B,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;YACzB,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;YACnC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY;YACvC,QAAQ,EAAE,OAAO,CAAC,OAAO;SAC1B,CAAC;QAEF,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;IAED,2EAA2E;IAC3E,OAAO;QACL,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,MAAM,CAAC,OAAe,IAAS,CAAC;IAChC,IAAI,CAAC,OAAe,IAAS,CAAC;CAC/B"}
|
package/dist/bot/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
export type { BotConfig, BotProviderConfig, BotApprovalConfig, BotNotifyConfig, NotificationEvent, NotificationEventType, WeaverConfig, WorkflowResult, ProviderName, } from './types.js';
|
|
1
|
+
export type { BotConfig, BotProviderConfig, BotApprovalConfig, BotNotifyConfig, NotificationEvent, NotificationEventType, ExecutionEvent, ExecutionEventType, ApprovalMode, WeaverConfig, WorkflowResult, ProviderName, } from './types.js';
|
|
2
2
|
export type { BotAgentProvider } from './agent-provider.js';
|
|
3
3
|
export { AnthropicAgentProvider, resolveProviderConfig, createProvider, detectProvider, } from './agent-provider.js';
|
|
4
4
|
export { CliAgentProvider } from './cli-provider.js';
|
|
5
5
|
export { BotAgentChannel } from './bot-agent-channel.js';
|
|
6
6
|
export type { BotChannelContext } from './bot-agent-channel.js';
|
|
7
7
|
export { WebhookNotificationChannel, createNotifier, } from './notifications.js';
|
|
8
|
-
export type { NotificationChannel } from './notifications.js';
|
|
8
|
+
export type { NotificationChannel, NotificationErrorHandler } from './notifications.js';
|
|
9
9
|
export { buildSystemPrompt } from './system-prompt.js';
|
|
10
10
|
export { runWorkflow } from './runner.js';
|
|
11
|
+
export { createApprovalHandler } from './approvals.js';
|
|
12
|
+
export type { ApprovalHandler, ApprovalResult } from './approvals.js';
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/bot/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bot/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EACL,0BAA0B,EAC1B,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bot/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EACL,0BAA0B,EAC1B,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/bot/index.js
CHANGED
|
@@ -4,4 +4,5 @@ export { BotAgentChannel } from './bot-agent-channel.js';
|
|
|
4
4
|
export { WebhookNotificationChannel, createNotifier, } from './notifications.js';
|
|
5
5
|
export { buildSystemPrompt } from './system-prompt.js';
|
|
6
6
|
export { runWorkflow } from './runner.js';
|
|
7
|
+
export { createApprovalHandler } from './approvals.js';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/dist/bot/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bot/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bot/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EACL,0BAA0B,EAC1B,cAAc,GACf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -4,13 +4,15 @@ export interface NotificationChannel {
|
|
|
4
4
|
shouldSend(eventType: NotificationEventType): boolean;
|
|
5
5
|
send(event: NotificationEvent): Promise<void>;
|
|
6
6
|
}
|
|
7
|
+
export type NotificationErrorHandler = (channel: string, event: NotificationEvent, error: string) => void;
|
|
7
8
|
export declare class WebhookNotificationChannel implements NotificationChannel {
|
|
8
9
|
name: string;
|
|
9
10
|
private url;
|
|
10
11
|
private channelType;
|
|
11
12
|
private events;
|
|
12
13
|
private headers;
|
|
13
|
-
|
|
14
|
+
private onError?;
|
|
15
|
+
constructor(config: BotNotifyConfig, onError?: NotificationErrorHandler);
|
|
14
16
|
shouldSend(eventType: NotificationEventType): boolean;
|
|
15
17
|
send(event: NotificationEvent): Promise<void>;
|
|
16
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/bot/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,SAAS,EAAE,qBAAqB,GAAG,OAAO,CAAC;IACtD,IAAI,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C;
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot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