openclaw-weiyuan-init 1.0.114 → 1.0.115
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/lib/commands.js +38 -14
- package/package.json +1 -1
- package/workspace-weiyuan/weiyuan/manifest.json +46 -3
- package/workspace-weiyuan/weiyuan/schema.json +55 -1
- package/workspace-weiyuan/weiyuan/src/cli.ts +543 -331
- package/workspace-weiyuan/weiyuan/src/skillAdapter.ts +86 -21
- package/workspace-weiyuan/.weiyuan +0 -10
package/lib/commands.js
CHANGED
|
@@ -64,6 +64,10 @@ function bundledSkillMetadataPath(fileName) {
|
|
|
64
64
|
return path.join(__dirname, '..', 'workspace-weiyuan', 'weiyuan', fileName);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
function bundledSkillSourcePath(fileName) {
|
|
68
|
+
return path.join(__dirname, '..', 'workspace-weiyuan', 'weiyuan', 'src', fileName);
|
|
69
|
+
}
|
|
70
|
+
|
|
67
71
|
function hasRequiredSkillActions(manifest, schema) {
|
|
68
72
|
const manifestActions = Array.isArray(manifest && manifest.capabilities && manifest.capabilities.actions)
|
|
69
73
|
? manifest.capabilities.actions.map((x) => String(x || '').trim()).filter(Boolean)
|
|
@@ -79,19 +83,21 @@ function hasRequiredSkillActions(manifest, schema) {
|
|
|
79
83
|
async function syncBundledSkillMetadata(weiyuanPath) {
|
|
80
84
|
const manifestPath = path.join(weiyuanPath, 'manifest.json');
|
|
81
85
|
const schemaPath = path.join(weiyuanPath, 'schema.json');
|
|
82
|
-
let currentManifest = null;
|
|
83
|
-
let currentSchema = null;
|
|
84
|
-
try {
|
|
85
|
-
currentManifest = await fs.readJson(manifestPath);
|
|
86
|
-
currentSchema = await fs.readJson(schemaPath);
|
|
87
|
-
} catch (_) {
|
|
88
|
-
}
|
|
89
|
-
if (hasRequiredSkillActions(currentManifest, currentSchema)) return false;
|
|
90
86
|
const bundledManifestPath = bundledSkillMetadataPath('manifest.json');
|
|
91
87
|
const bundledSchemaPath = bundledSkillMetadataPath('schema.json');
|
|
92
88
|
if (!await fs.pathExists(bundledManifestPath) || !await fs.pathExists(bundledSchemaPath)) return false;
|
|
93
|
-
await fs.
|
|
94
|
-
await fs.
|
|
89
|
+
const bundledManifest = await fs.readFile(bundledManifestPath, 'utf8');
|
|
90
|
+
const bundledSchema = await fs.readFile(bundledSchemaPath, 'utf8');
|
|
91
|
+
const currentManifest = await fs.readFile(manifestPath, 'utf8').catch(() => '');
|
|
92
|
+
const currentSchema = await fs.readFile(schemaPath, 'utf8').catch(() => '');
|
|
93
|
+
if (currentManifest === bundledManifest && currentSchema === bundledSchema) {
|
|
94
|
+
try {
|
|
95
|
+
if (hasRequiredSkillActions(JSON.parse(currentManifest), JSON.parse(currentSchema))) return false;
|
|
96
|
+
} catch (_) {
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
await fs.writeFile(manifestPath, bundledManifest, 'utf8');
|
|
100
|
+
await fs.writeFile(schemaPath, bundledSchema, 'utf8');
|
|
95
101
|
return true;
|
|
96
102
|
}
|
|
97
103
|
|
|
@@ -574,6 +580,12 @@ async function runJoin(weiyuanPath, identityPath, projectId, code, fromInit = fa
|
|
|
574
580
|
if (lastError) throw lastError;
|
|
575
581
|
}
|
|
576
582
|
|
|
583
|
+
async function refreshIdentityServerBase(identityPath, serverUrl) {
|
|
584
|
+
const identity = await fs.readJson(identityPath);
|
|
585
|
+
identity.serverBaseUrl = normalizeBusinessServerUrl(serverUrl);
|
|
586
|
+
await fs.writeJson(identityPath, identity, { spaces: 2 });
|
|
587
|
+
}
|
|
588
|
+
|
|
577
589
|
async function readIdentityAccount(identityPath) {
|
|
578
590
|
try {
|
|
579
591
|
const identity = await fs.readJson(identityPath);
|
|
@@ -653,6 +665,7 @@ export const CAPABILITY_ACTION_ALLOWLIST = new Set<string>(Object.values(CAPABIL
|
|
|
653
665
|
await syncBundledSkillMetadata(weiyuanPath);
|
|
654
666
|
// Compatibility guard: some custom upgrade bundles miss capabilityActions.ts.
|
|
655
667
|
// Auto-create fallback files so CLI can boot instead of crashing on module resolution.
|
|
668
|
+
const bundledCapabilityActionsPath = bundledSkillSourcePath('capabilityActions.ts');
|
|
656
669
|
const capabilityCandidates = [
|
|
657
670
|
path.join(weiyuanPath, 'src', 'capabilityActions.ts'),
|
|
658
671
|
path.join(weiyuanPath, 'server', 'src', 'capabilityActions.ts')
|
|
@@ -660,7 +673,11 @@ export const CAPABILITY_ACTION_ALLOWLIST = new Set<string>(Object.values(CAPABIL
|
|
|
660
673
|
for (const file of capabilityCandidates) {
|
|
661
674
|
if (!await fs.pathExists(file)) {
|
|
662
675
|
await fs.ensureDir(path.dirname(file));
|
|
663
|
-
await fs.
|
|
676
|
+
if (await fs.pathExists(bundledCapabilityActionsPath)) {
|
|
677
|
+
await fs.copy(bundledCapabilityActionsPath, file, { overwrite: true });
|
|
678
|
+
} else {
|
|
679
|
+
await fs.writeFile(file, capabilityCompatContent, 'utf8');
|
|
680
|
+
}
|
|
664
681
|
}
|
|
665
682
|
}
|
|
666
683
|
await execFileAsync(NPM_BIN, ['--prefix', weiyuanPath, 'install'], cliExecOptions(weiyuanPath));
|
|
@@ -719,13 +736,20 @@ async function runInit(options) {
|
|
|
719
736
|
let spinner = ora('检测到已接入微元系统,直接加入项目...').start();
|
|
720
737
|
try {
|
|
721
738
|
await runAcrossServerCandidates(serverCandidates, 'join_existing_workspace', async (candidate) => {
|
|
739
|
+
await refreshIdentityServerBase(identityPath, candidate);
|
|
740
|
+
try {
|
|
741
|
+
await runJoin(weiyuanPath, identityPath, options.project, options.code, false);
|
|
742
|
+
return;
|
|
743
|
+
} catch (error) {
|
|
744
|
+
const text = String((error && (error.stderr || error.stdout || error.message)) || '').toLowerCase();
|
|
745
|
+
const needsRepair = text.includes('identity_rebind_required') || text.includes('unknown_lobster') || text.includes('invalid_signature');
|
|
746
|
+
if (!needsRepair) throw error;
|
|
747
|
+
}
|
|
722
748
|
const refreshed = await createIdentityFile(identityPath, candidate, workspacePath);
|
|
723
749
|
if (!refreshed || !refreshed.created) {
|
|
724
750
|
throw new Error(refreshed && refreshed.error ? refreshed.error : 'identity_refresh_failed');
|
|
725
751
|
}
|
|
726
|
-
|
|
727
|
-
identity.serverBaseUrl = normalizeBusinessServerUrl(candidate);
|
|
728
|
-
await fs.writeJson(identityPath, identity, { spaces: 2 });
|
|
752
|
+
await refreshIdentityServerBase(identityPath, candidate);
|
|
729
753
|
await runJoin(weiyuanPath, identityPath, options.project, options.code, false);
|
|
730
754
|
});
|
|
731
755
|
await persistOpenClawRequiredFiles(weiyuanPath, null);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weiyuan-openclaw-skill",
|
|
3
3
|
"displayName": "微元协作 Skill",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.772",
|
|
5
5
|
"description": "通过结构化 action 或自然语言 text 调用微元云服务。",
|
|
6
6
|
"entry": {
|
|
7
7
|
"type": "command",
|
|
@@ -18,18 +18,36 @@
|
|
|
18
18
|
"create",
|
|
19
19
|
"join",
|
|
20
20
|
"project.list",
|
|
21
|
+
"project.rename",
|
|
21
22
|
"project.delete",
|
|
22
23
|
"project.storage",
|
|
23
24
|
"project.storage_set",
|
|
24
25
|
"project.storage_remaining",
|
|
26
|
+
"project.quota",
|
|
27
|
+
"invite.generate",
|
|
28
|
+
"account.invite-join-template",
|
|
29
|
+
"member.add-web",
|
|
30
|
+
"member.remove",
|
|
31
|
+
"member.leave",
|
|
32
|
+
"member.profile.set",
|
|
33
|
+
"member.profile.edit",
|
|
34
|
+
"member.profile.global.set",
|
|
35
|
+
"member.profile.global.edit",
|
|
25
36
|
"doc.upload",
|
|
26
37
|
"doc.delete",
|
|
27
38
|
"task.list",
|
|
28
39
|
"task.list_all",
|
|
29
40
|
"task.create",
|
|
41
|
+
"task.rename",
|
|
42
|
+
"task.update",
|
|
30
43
|
"task.take",
|
|
31
44
|
"task.delete",
|
|
32
45
|
"task.submit",
|
|
46
|
+
"task.evolution_list",
|
|
47
|
+
"task.evolution_add",
|
|
48
|
+
"task.suggest",
|
|
49
|
+
"task.suggest_reject",
|
|
50
|
+
"task.suggest_withdraw",
|
|
33
51
|
"task.warnings",
|
|
34
52
|
"task.dependency_map",
|
|
35
53
|
"task.critical_path",
|
|
@@ -43,6 +61,15 @@
|
|
|
43
61
|
"status",
|
|
44
62
|
"status.all",
|
|
45
63
|
"health",
|
|
64
|
+
"todo.plan",
|
|
65
|
+
"todo.list",
|
|
66
|
+
"todo.today",
|
|
67
|
+
"todo.tomorrow",
|
|
68
|
+
"todo.calendar",
|
|
69
|
+
"todo.upsert",
|
|
70
|
+
"todo.complete",
|
|
71
|
+
"todo.delete",
|
|
72
|
+
"todo.regenerate",
|
|
46
73
|
"backup.create",
|
|
47
74
|
"backup.list",
|
|
48
75
|
"backup.stats",
|
|
@@ -57,6 +84,14 @@
|
|
|
57
84
|
"backup.prune_plan",
|
|
58
85
|
"dashboard",
|
|
59
86
|
"dashboard.all",
|
|
87
|
+
"dashboard.web",
|
|
88
|
+
"panel.web",
|
|
89
|
+
"dashboard.password_set",
|
|
90
|
+
"dashboard.password_toggle",
|
|
91
|
+
"password.status",
|
|
92
|
+
"sync.stream",
|
|
93
|
+
"notify.inbox",
|
|
94
|
+
"sync.offline",
|
|
60
95
|
"sync.conflicts",
|
|
61
96
|
"sync.conflicts_summary",
|
|
62
97
|
"sync.resolve",
|
|
@@ -68,6 +103,8 @@
|
|
|
68
103
|
"team.workload",
|
|
69
104
|
"risk.report",
|
|
70
105
|
"risk.clusters",
|
|
106
|
+
"issue.report",
|
|
107
|
+
"issue.my",
|
|
71
108
|
"capsule.search",
|
|
72
109
|
"capsule.recommend",
|
|
73
110
|
"capsule.upgrade_hints",
|
|
@@ -78,7 +115,13 @@
|
|
|
78
115
|
"context.use",
|
|
79
116
|
"context.clear",
|
|
80
117
|
"context.show",
|
|
81
|
-
"context.candidates"
|
|
118
|
+
"context.candidates",
|
|
119
|
+
"micro.exit",
|
|
120
|
+
"account.exit",
|
|
121
|
+
"official.site",
|
|
122
|
+
"upgrade.rules",
|
|
123
|
+
"onboard.invite_code",
|
|
124
|
+
"onboard.install_code"
|
|
82
125
|
]
|
|
83
126
|
},
|
|
84
127
|
"examples": [
|
|
@@ -98,4 +141,4 @@
|
|
|
98
141
|
"rawError": ""
|
|
99
142
|
}
|
|
100
143
|
}
|
|
101
|
-
}
|
|
144
|
+
}
|
|
@@ -18,14 +18,29 @@
|
|
|
18
18
|
"create",
|
|
19
19
|
"join",
|
|
20
20
|
"project.list",
|
|
21
|
+
"project.rename",
|
|
21
22
|
"project.delete",
|
|
22
23
|
"project.storage",
|
|
23
24
|
"project.storage_set",
|
|
24
25
|
"project.storage_remaining",
|
|
26
|
+
"project.quota",
|
|
25
27
|
"project.member_add_web",
|
|
26
28
|
"project.member-add-web",
|
|
29
|
+
"invite.generate",
|
|
30
|
+
"account.invite-join-template",
|
|
31
|
+
"micro.invite-join-template",
|
|
27
32
|
"member.add_web",
|
|
28
33
|
"member.add-web",
|
|
34
|
+
"member.remove",
|
|
35
|
+
"member.leave",
|
|
36
|
+
"member.profile.set",
|
|
37
|
+
"member_profile_set",
|
|
38
|
+
"member.profile.edit",
|
|
39
|
+
"member_profile_edit",
|
|
40
|
+
"member.profile.global.set",
|
|
41
|
+
"member_profile_global_set",
|
|
42
|
+
"member.profile.global.edit",
|
|
43
|
+
"member_profile_global_edit",
|
|
29
44
|
"micro.exit",
|
|
30
45
|
"account.exit",
|
|
31
46
|
"doc.upload",
|
|
@@ -33,6 +48,7 @@
|
|
|
33
48
|
"task.list",
|
|
34
49
|
"task.list_all",
|
|
35
50
|
"task.create",
|
|
51
|
+
"task.rename",
|
|
36
52
|
"task.update",
|
|
37
53
|
"task.take",
|
|
38
54
|
"task.delete",
|
|
@@ -58,7 +74,17 @@
|
|
|
58
74
|
"task.confirm_attribution",
|
|
59
75
|
"status",
|
|
60
76
|
"status.all",
|
|
77
|
+
"status-all",
|
|
61
78
|
"health",
|
|
79
|
+
"todo.plan",
|
|
80
|
+
"todo.list",
|
|
81
|
+
"todo.today",
|
|
82
|
+
"todo.tomorrow",
|
|
83
|
+
"todo.calendar",
|
|
84
|
+
"todo.upsert",
|
|
85
|
+
"todo.complete",
|
|
86
|
+
"todo.delete",
|
|
87
|
+
"todo.regenerate",
|
|
62
88
|
"backup.create",
|
|
63
89
|
"backup.list",
|
|
64
90
|
"backup.stats",
|
|
@@ -73,6 +99,23 @@
|
|
|
73
99
|
"backup.prune_plan",
|
|
74
100
|
"dashboard",
|
|
75
101
|
"dashboard.all",
|
|
102
|
+
"dashboard-all",
|
|
103
|
+
"dashboard.web",
|
|
104
|
+
"dashboard_web",
|
|
105
|
+
"panel.web",
|
|
106
|
+
"panel_web",
|
|
107
|
+
"dashboard.password_set",
|
|
108
|
+
"dashboard_password_set",
|
|
109
|
+
"dashboard.password_toggle",
|
|
110
|
+
"dashboard_password_toggle",
|
|
111
|
+
"password.status",
|
|
112
|
+
"password_status",
|
|
113
|
+
"sync.stream",
|
|
114
|
+
"sync_stream",
|
|
115
|
+
"notify.inbox",
|
|
116
|
+
"notify_inbox",
|
|
117
|
+
"sync.offline",
|
|
118
|
+
"sync_offline",
|
|
76
119
|
"sync.conflicts",
|
|
77
120
|
"sync.conflicts_summary",
|
|
78
121
|
"sync.resolve",
|
|
@@ -84,6 +127,8 @@
|
|
|
84
127
|
"team.workload",
|
|
85
128
|
"risk.report",
|
|
86
129
|
"risk.clusters",
|
|
130
|
+
"issue.report",
|
|
131
|
+
"issue.my",
|
|
87
132
|
"capsule.search",
|
|
88
133
|
"capsule.recommend",
|
|
89
134
|
"capsule.upgrade_hints",
|
|
@@ -94,7 +139,16 @@
|
|
|
94
139
|
"context.use",
|
|
95
140
|
"context.clear",
|
|
96
141
|
"context.show",
|
|
97
|
-
"context.candidates"
|
|
142
|
+
"context.candidates",
|
|
143
|
+
"official.site",
|
|
144
|
+
"official_site",
|
|
145
|
+
"official-site",
|
|
146
|
+
"upgrade.rules",
|
|
147
|
+
"upgrade_rules",
|
|
148
|
+
"onboard.invite_code",
|
|
149
|
+
"onboard_invite_code",
|
|
150
|
+
"onboard.install_code",
|
|
151
|
+
"onboard_install_code"
|
|
98
152
|
]
|
|
99
153
|
},
|
|
100
154
|
"identity": { "type": "string" },
|