@yorha2b-lab/autodev 5.7.1 → 5.7.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/.github/cla.json +7 -0
- package/.github/workflows/cla.yml +33 -0
- package/CLA.md +41 -0
- package/README.md +1 -1
- package/bin/autodev.js +1 -1
- package/package.json +1 -1
- package/src/ai/index.js +34 -49
- package/src/bootstrap/index.js +3 -3
- package/src/commands/watch.js +1 -1
- /package/src/{kernel → core}/deployment.js +0 -0
- /package/src/{kernel → core}/engine.js +0 -0
- /package/src/{kernel → core}/queue.js +0 -0
- /package/src/{kernel → core}/recruiter.js +0 -0
package/.github/cla.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: "CLA Assistant"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment:
|
|
5
|
+
types: [created]
|
|
6
|
+
pull_request_target:
|
|
7
|
+
types: [opened, synchronize, reopened]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
actions: write
|
|
11
|
+
contents: write
|
|
12
|
+
pull-requests: write
|
|
13
|
+
statuses: write
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
CLA:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
# ⚠️ 必须有这一步!先把代码 Checkout 下来
|
|
20
|
+
- name: Checkout
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
# 2. 运行 CLA 机器人
|
|
24
|
+
- name: "CLA Assistant Check"
|
|
25
|
+
if: (github.event.comment.issue.pull_request != null || github.event_name == 'pull_request_target')
|
|
26
|
+
uses: contributor-assistant/github-action@v2.4.0
|
|
27
|
+
env:
|
|
28
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
29
|
+
with:
|
|
30
|
+
path-to-signatures: '.github/cla.json'
|
|
31
|
+
path-to-document: 'https://github.com/${{ github.repository }}/blob/main/CLA.md'
|
|
32
|
+
branch: 'main'
|
|
33
|
+
allowlist: 'bot*,dependabot[bot],renovate[bot],github-actions[bot],yorha2b-lab'
|
package/CLA.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Contributor License Agreement (CLA) for autodev
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to **autodev** ("the Project").
|
|
4
|
+
|
|
5
|
+
In order to protect the Project, its users, and its maintainers, the Project requires a signed Contributor License Agreement ("CLA") before accepting any Pull Requests or code Contributions.
|
|
6
|
+
|
|
7
|
+
By signing this CLA, You agree to the following legally binding terms:
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
### 1. Definitions
|
|
12
|
+
- **"You" (or "Your")** means the individual or legal entity submitting the Contribution.
|
|
13
|
+
- **"Contribution"** means any code, documentation, bug fixes, features, or other materials submitted by You to the Project via Pull Requests, Commits, Issues, or other communication channels.
|
|
14
|
+
|
|
15
|
+
### 2. Perpetual & Irrevocable License Grant
|
|
16
|
+
You hereby grant to the Project maintainers and all recipients of software distributed by the Project a **perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable** copyright and patent license to reproduce, prepare derivative works of, publicly display, sublicense, and distribute Your Contributions and any derivative works thereof.
|
|
17
|
+
|
|
18
|
+
### 3. Irrevocability
|
|
19
|
+
Once Your Contribution is submitted and accepted into the Project, **this Agreement and the licenses granted herein cannot be revoked, withdrawn, or canceled by You for any reason**.
|
|
20
|
+
|
|
21
|
+
### 4. Representation of Originality & Employer Clearance
|
|
22
|
+
You represent and warrant that:
|
|
23
|
+
- Your Contribution is **Your 100% original creation** and does not infringe upon any third-party copyrights, patents, trademarks, trade secrets, or proprietary rights.
|
|
24
|
+
- If Your employer or company holds rights to intellectual property created by You, You represent that You have received **explicit written permission or a legal waiver from Your employer** to submit this Contribution to the Project.
|
|
25
|
+
|
|
26
|
+
### 5. Future Re-Licensing Authority
|
|
27
|
+
You explicitly agree that the Project maintainers reserve the sole and exclusive right to re-license, dual-license, or update the license terms of the Project (including under AGPL-3.0, MIT, Apache 2.0, or commercial enterprise licenses) in the future without requiring additional consent or notice to You.
|
|
28
|
+
|
|
29
|
+
### 6. Disclaimer of Warranty
|
|
30
|
+
Except as expressly set forth herein, Your Contribution is provided on an **"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND**, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
### 🤖 How to Sign
|
|
35
|
+
|
|
36
|
+
By replying in Your Pull Request with the exact phrase:
|
|
37
|
+
> **I have read the CLA Document and I hereby sign the CLA**
|
|
38
|
+
|
|
39
|
+
You acknowledge that You have read, understood, and agree to be bound by all terms in this Contributor License Agreement.
|
|
40
|
+
|
|
41
|
+
*Glory to Mankind.* 🤖⚔️
|
package/README.md
CHANGED
package/bin/autodev.js
CHANGED
|
@@ -6,7 +6,7 @@ const { program } = require('commander')
|
|
|
6
6
|
const local = Intl.DateTimeFormat().resolvedOptions().locale.toUpperCase()
|
|
7
7
|
|
|
8
8
|
const { matchDialog, matrixEffect } = require('../src/utils/ux')
|
|
9
|
-
const recruiter = require('../src/
|
|
9
|
+
const recruiter = require('../src/core/recruiter')
|
|
10
10
|
const dialogs = recruiter(path.join(__dirname, '../src/dialogs'))
|
|
11
11
|
const dialog = matchDialog(local, dialogs) ?? dialogs['EN-US']
|
|
12
12
|
|
package/package.json
CHANGED
package/src/ai/index.js
CHANGED
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
const askAI = async ({ model, yorha, dialog, openAI, messages, response_format = { type: 'json_object' }, retryCount = 0 }) => {
|
|
2
|
-
|
|
3
|
-
if (retryCount >= 3) {
|
|
4
|
-
yorha.commander.report(dialog.bunker.linkSevered, 'red')
|
|
5
|
-
throw new Error(dialog.bunker.linkSevered)
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
try {
|
|
9
|
-
const response = await openAI.chat.completions.create({
|
|
10
|
-
model,
|
|
11
|
-
messages,
|
|
12
|
-
top_p: 0.1,
|
|
13
|
-
response_format,
|
|
14
|
-
temperature: 0.01,
|
|
15
|
-
})
|
|
16
|
-
let raw = response.choices[0].message.content.trim()
|
|
17
|
-
raw = raw.replace(/^```json\n?/, '').replace(/\n?```$/, '')
|
|
18
|
-
const match = raw.match(/[\{\[][\s\S]*[\}\]]/)
|
|
19
|
-
const JSON5 = require('json5')
|
|
20
|
-
return JSON5.parse(match ? match[0] : raw)
|
|
21
|
-
} catch (err) {
|
|
22
|
-
const statusCode = err.status || err.response?.status
|
|
23
|
-
const isAuthError = [401, 402].includes(statusCode)
|
|
24
|
-
if (isAuthError) {
|
|
25
|
-
yorha.commander.report(dialog.bunker.accessDenied, 'red')
|
|
26
|
-
throw new Error(dialog.bunker.accessDenied)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
yorha.commander.report(dialog.bunker.networkInstability(retryCount + 1))
|
|
30
|
-
|
|
31
|
-
return askAI({ model, yorha, dialog, openAI, messages, response_format, retryCount: retryCount + 1 })
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
1
|
module.exports = ({ utils, yorha, openAI, dialog, prompts }) => {
|
|
36
2
|
|
|
37
3
|
const sharp = require('sharp')
|
|
@@ -40,12 +6,43 @@ module.exports = ({ utils, yorha, openAI, dialog, prompts }) => {
|
|
|
40
6
|
const { UI_DESIGNER, API_DESIGNER, MOCK_DESIGNER } = system
|
|
41
7
|
const { textModel, visionModel } = utils.foundation.getConfig()
|
|
42
8
|
|
|
9
|
+
const askAI = async ({ model, messages, response_format = { type: 'json_object' }, retryCount = 0 }) => {
|
|
10
|
+
|
|
11
|
+
if (retryCount >= 3) {
|
|
12
|
+
yorha.commander.report(dialog.bunker.linkSevered, 'red')
|
|
13
|
+
throw new Error(dialog.bunker.linkSevered)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const response = await openAI.chat.completions.create({
|
|
18
|
+
model,
|
|
19
|
+
messages,
|
|
20
|
+
top_p: 0.1,
|
|
21
|
+
response_format,
|
|
22
|
+
temperature: 0.01,
|
|
23
|
+
})
|
|
24
|
+
let raw = response.choices[0].message.content.trim()
|
|
25
|
+
raw = raw.replace(/^```json\n?/, '').replace(/\n?```$/, '')
|
|
26
|
+
const match = raw.match(/[\{\[][\s\S]*[\}\]]/)
|
|
27
|
+
const JSON5 = require('json5')
|
|
28
|
+
return JSON5.parse(match ? match[0] : raw)
|
|
29
|
+
} catch (err) {
|
|
30
|
+
const statusCode = err.status || err.response?.status
|
|
31
|
+
const isAuthError = [401, 402].includes(statusCode)
|
|
32
|
+
if (isAuthError) {
|
|
33
|
+
yorha.commander.report(dialog.bunker.accessDenied, 'red')
|
|
34
|
+
throw new Error(dialog.bunker.accessDenied)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
yorha.commander.report(dialog.bunker.networkInstability(retryCount + 1))
|
|
38
|
+
|
|
39
|
+
return askAI({ model, yorha, dialog, openAI, messages, response_format, retryCount: retryCount + 1 })
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
43
|
return {
|
|
44
44
|
generateMock: async ({ columns, fileName }) => {
|
|
45
45
|
return askAI({
|
|
46
|
-
yorha,
|
|
47
|
-
openAI,
|
|
48
|
-
dialog,
|
|
49
46
|
model: textModel,
|
|
50
47
|
messages: [
|
|
51
48
|
{ role: 'system', content: MOCK_DESIGNER },
|
|
@@ -55,9 +52,6 @@ module.exports = ({ utils, yorha, openAI, dialog, prompts }) => {
|
|
|
55
52
|
},
|
|
56
53
|
nameSimilarity: async ({ fileName, english }) => {
|
|
57
54
|
return askAI({
|
|
58
|
-
yorha,
|
|
59
|
-
openAI,
|
|
60
|
-
dialog,
|
|
61
55
|
model: textModel,
|
|
62
56
|
messages: [
|
|
63
57
|
{ role: 'system', content: UI_DESIGNER },
|
|
@@ -67,9 +61,6 @@ module.exports = ({ utils, yorha, openAI, dialog, prompts }) => {
|
|
|
67
61
|
},
|
|
68
62
|
apiParser: async ({ bunkerAnchors, realApis }) => {
|
|
69
63
|
return askAI({
|
|
70
|
-
yorha,
|
|
71
|
-
openAI,
|
|
72
|
-
dialog,
|
|
73
64
|
model: textModel,
|
|
74
65
|
messages: [
|
|
75
66
|
{ role: 'system', content: API_DESIGNER },
|
|
@@ -85,9 +76,6 @@ module.exports = ({ utils, yorha, openAI, dialog, prompts }) => {
|
|
|
85
76
|
const base64Image = compressedBuffer.toString('base64')
|
|
86
77
|
|
|
87
78
|
return askAI({
|
|
88
|
-
yorha,
|
|
89
|
-
openAI,
|
|
90
|
-
dialog,
|
|
91
79
|
model: visionModel,
|
|
92
80
|
messages: [
|
|
93
81
|
{ role: 'system', content: UI_DESIGNER },
|
|
@@ -104,9 +92,6 @@ module.exports = ({ utils, yorha, openAI, dialog, prompts }) => {
|
|
|
104
92
|
},
|
|
105
93
|
alignResponseFields: async ({ responseStr, resourceStr }) => {
|
|
106
94
|
return askAI({
|
|
107
|
-
yorha,
|
|
108
|
-
openAI,
|
|
109
|
-
dialog,
|
|
110
95
|
model: textModel,
|
|
111
96
|
messages: [
|
|
112
97
|
{ role: 'system', content: API_DESIGNER },
|
package/src/bootstrap/index.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = {
|
|
|
7
7
|
|
|
8
8
|
init: async ({ template }, dialog, version, local) => {
|
|
9
9
|
|
|
10
|
-
const recruiter = require('../
|
|
10
|
+
const recruiter = require('../core/recruiter')
|
|
11
11
|
const utils = recruiter(path.join(__dirname, '../utils'))
|
|
12
12
|
const yorha = utils.ux.yorha()
|
|
13
13
|
|
|
@@ -23,7 +23,7 @@ module.exports = {
|
|
|
23
23
|
dialog,
|
|
24
24
|
template,
|
|
25
25
|
openAI: require('../ai/openai')(),
|
|
26
|
-
engine: require('../
|
|
26
|
+
engine: require('../core/engine')({ utils, template }),
|
|
27
27
|
handlers: recruiter(path.join(__dirname, '../handlers')),
|
|
28
28
|
prompts: recruiter(path.join(__dirname, `../framework/${template}/prompts`)),
|
|
29
29
|
}
|
|
@@ -31,7 +31,7 @@ module.exports = {
|
|
|
31
31
|
if (version) {
|
|
32
32
|
await utils.ux.bootSequence(version, local)
|
|
33
33
|
}
|
|
34
|
-
require('../
|
|
34
|
+
require('../core/deployment')(accessPoint)
|
|
35
35
|
const llm = require('../ai')(accessPoint)
|
|
36
36
|
const generator = require(generatorPath)(accessPoint)
|
|
37
37
|
const labs = require('../labs')({ llm, ...accessPoint })
|
package/src/commands/watch.js
CHANGED
|
@@ -6,7 +6,7 @@ module.exports = () => {
|
|
|
6
6
|
|
|
7
7
|
const ctx = bootstrap.get()
|
|
8
8
|
const routes = Object.values(ctx.handlers)
|
|
9
|
-
const queue = require('../
|
|
9
|
+
const queue = require('../core/queue')(2, ctx)
|
|
10
10
|
|
|
11
11
|
queue.onIdle(() => ctx.yorha.commander.report(ctx.dialog.bunker.systemStandby, 'gray'))
|
|
12
12
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|