@weapp-agent/cli 0.1.1 → 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/README.md +1 -1
- package/dist/index.mjs +10 -20
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Model-free acceptance and MCP tools for weapp-vite native and Wevu WeChat projects, with an optional independent AI coding mode.
|
|
4
4
|
|
|
5
|
-
Requires Node.js 24.
|
|
5
|
+
Requires Node.js `^22.23.4 || ^24.22.1 || >=26.12.1`. Install the preview package from npm:
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
8
|
npm install --global @weapp-agent/cli@preview
|
package/dist/index.mjs
CHANGED
|
@@ -25,7 +25,7 @@ import { Box, Text, render, useApp, useInput } from "ink";
|
|
|
25
25
|
import TextInput from "ink-text-input";
|
|
26
26
|
import { useRef, useState } from "react";
|
|
27
27
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
-
|
|
28
|
+
// \0rolldown/runtime.js
|
|
29
29
|
var __defProp$1 = Object.defineProperty;
|
|
30
30
|
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
31
31
|
var __getOwnPropNames$1 = Object.getOwnPropertyNames;
|
|
@@ -50,8 +50,7 @@ var __copyProps$1 = (to, from, except, desc) => {
|
|
|
50
50
|
return to;
|
|
51
51
|
};
|
|
52
52
|
var __reExport$1 = (target, mod, secondTarget) => (__copyProps$1(target, mod, "default"), secondTarget && __copyProps$1(secondTarget, mod, "default"));
|
|
53
|
-
|
|
54
|
-
//#region ../agent-core/dist/text-EVMG4Jiq.mjs
|
|
53
|
+
// ../agent-core/dist/text-BiiwJgsr.mjs
|
|
55
54
|
var ApprovalRequired = class extends Error {
|
|
56
55
|
constructor(message) {
|
|
57
56
|
super(message);
|
|
@@ -262,8 +261,7 @@ async function trustProject(root, fingerprint) {
|
|
|
262
261
|
function bounded(text, max = 4e4) {
|
|
263
262
|
return text.length > max ? `${text.slice(0, max)}\n[truncated: ${text.length - max} more characters]` : text;
|
|
264
263
|
}
|
|
265
|
-
|
|
266
|
-
//#region ../agent-core/dist/index.mjs
|
|
264
|
+
// ../agent-core/dist/index.mjs
|
|
267
265
|
/** 图片按固定上下文成本估算,不把图片字节当作文本 token。 */
|
|
268
266
|
function contextSize(messages) {
|
|
269
267
|
return JSON.stringify(messages.map((message) => {
|
|
@@ -1294,8 +1292,7 @@ function fileTools() {
|
|
|
1294
1292
|
}
|
|
1295
1293
|
];
|
|
1296
1294
|
}
|
|
1297
|
-
|
|
1298
|
-
//#region ../agent-mini-program/dist/rolldown-runtime-BBjsoOtd.mjs
|
|
1295
|
+
// ../agent-mini-program/dist/rolldown-runtime-782esTHO.mjs
|
|
1299
1296
|
var __defProp = Object.defineProperty;
|
|
1300
1297
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1301
1298
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -1320,8 +1317,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
1320
1317
|
return to;
|
|
1321
1318
|
};
|
|
1322
1319
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
1323
|
-
|
|
1324
|
-
//#region ../agent-mini-program/dist/index.mjs
|
|
1320
|
+
// ../agent-mini-program/dist/index.mjs
|
|
1325
1321
|
var dist_exports = /* @__PURE__ */ __exportAll$1({
|
|
1326
1322
|
AcceptanceService: () => AcceptanceService,
|
|
1327
1323
|
WeappProjectAdapter: () => WeappProjectAdapter,
|
|
@@ -1506,8 +1502,7 @@ var WeappProjectAdapter = class {
|
|
|
1506
1502
|
}];
|
|
1507
1503
|
}
|
|
1508
1504
|
};
|
|
1509
|
-
|
|
1510
|
-
//#region ../agent-providers/dist/index.mjs
|
|
1505
|
+
// ../agent-providers/dist/index.mjs
|
|
1511
1506
|
function toModelMessages(messages) {
|
|
1512
1507
|
return messages.map((message) => {
|
|
1513
1508
|
if (message.role === "user") return {
|
|
@@ -1631,8 +1626,7 @@ function createModel(config, environment = process.env) {
|
|
|
1631
1626
|
}).responses(config.name);
|
|
1632
1627
|
return new AiSdkAdapter(`${config.provider}/${config.name}`, model);
|
|
1633
1628
|
}
|
|
1634
|
-
|
|
1635
|
-
//#region src/commands/session.ts
|
|
1629
|
+
// src/commands/session.ts
|
|
1636
1630
|
function registerSessionCommands(program, output) {
|
|
1637
1631
|
program.command("sessions").description("List sessions for this project").option("--details", "include prompts, status, usage and pending tool calls").action(async (_local, command) => {
|
|
1638
1632
|
const options = command.optsWithGlobals();
|
|
@@ -1646,16 +1640,14 @@ function registerSessionCommands(program, output) {
|
|
|
1646
1640
|
if (summary.status === "invalid") process.exitCode = 1;
|
|
1647
1641
|
});
|
|
1648
1642
|
}
|
|
1649
|
-
|
|
1650
|
-
//#region src/ui/commands.ts
|
|
1643
|
+
// src/ui/commands.ts
|
|
1651
1644
|
async function runInteractiveTask(runner, prompt, sessionId, signal, onEvent, approve) {
|
|
1652
1645
|
const input = prompt.trim();
|
|
1653
1646
|
const acknowledgement = input.split(/\s/, 1)[0] === "/acknowledge-interrupted";
|
|
1654
1647
|
if (acknowledgement && !sessionId) throw new Error("No session to recover. Start a task before acknowledging interrupted tool calls.");
|
|
1655
1648
|
return runner(acknowledgement ? input.slice(24).trim() || "I inspected the interrupted tool outcomes. Continue after checking the current project state." : prompt, sessionId, signal, onEvent, approve, { acknowledgeInterrupted: Boolean(acknowledgement) });
|
|
1656
1649
|
}
|
|
1657
|
-
|
|
1658
|
-
//#region src/ui.tsx
|
|
1650
|
+
// src/ui.tsx
|
|
1659
1651
|
const cleanPreview = redactor();
|
|
1660
1652
|
function safePreview(input, depth = 0) {
|
|
1661
1653
|
if (depth > 2) return "[nested data omitted]";
|
|
@@ -1809,8 +1801,7 @@ async function interactive(runner, initialSession) {
|
|
|
1809
1801
|
initialSession
|
|
1810
1802
|
}), { exitOnCtrlC: false }).waitUntilExit();
|
|
1811
1803
|
}
|
|
1812
|
-
|
|
1813
|
-
//#region src/index.ts
|
|
1804
|
+
// src/index.ts
|
|
1814
1805
|
const clean = redactor();
|
|
1815
1806
|
const program = new Command().name("weapp-agent").description("AI coding agent for WeChat mini-programs").version("0.1.0").option("-C, --cwd <directory>", "project directory", process.cwd()).option("--trust", "trust this exact project configuration and scripts").option("--json", "emit machine-readable JSON; disable interactive approvals");
|
|
1816
1807
|
async function terminalApproval(summary) {
|
|
@@ -2126,5 +2117,4 @@ try {
|
|
|
2126
2117
|
else process.stderr.write(`${message}\n`);
|
|
2127
2118
|
process.exitCode = error instanceof Error && error.name === "ApprovalRequired" ? 2 : 1;
|
|
2128
2119
|
}
|
|
2129
|
-
//#endregion
|
|
2130
2120
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-agent/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "AI coding agent for WeChat mini-programs",
|
|
7
7
|
"author": "ice breaker <hi@sonofmagic.top>",
|
|
@@ -29,32 +29,32 @@
|
|
|
29
29
|
"skills"
|
|
30
30
|
],
|
|
31
31
|
"engines": {
|
|
32
|
-
"node": "
|
|
32
|
+
"node": "^22.23.4 || ^24.22.1 || >=26.12.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@ai-sdk/anthropic": "4.0.
|
|
36
|
-
"@ai-sdk/openai": "4.0.
|
|
37
|
-
"@ai-sdk/openai-compatible": "3.0.
|
|
38
|
-
"@modelcontextprotocol/client": "^2.
|
|
39
|
-
"@modelcontextprotocol/server": "^2.
|
|
40
|
-
"@weapp-vite/acceptance": "0.
|
|
41
|
-
"@weapp-vite/mcp": "2.
|
|
42
|
-
"ai": "7.0.
|
|
35
|
+
"@ai-sdk/anthropic": "4.0.88",
|
|
36
|
+
"@ai-sdk/openai": "4.0.102",
|
|
37
|
+
"@ai-sdk/openai-compatible": "3.0.78",
|
|
38
|
+
"@modelcontextprotocol/client": "^2.4.0",
|
|
39
|
+
"@modelcontextprotocol/server": "^2.4.0",
|
|
40
|
+
"@weapp-vite/acceptance": "0.2.0",
|
|
41
|
+
"@weapp-vite/mcp": "2.2.0",
|
|
42
|
+
"ai": "7.0.153",
|
|
43
43
|
"commander": "15.0.0",
|
|
44
44
|
"diff": "9.0.0",
|
|
45
|
-
"execa": "10.
|
|
45
|
+
"execa": "10.2.1",
|
|
46
46
|
"ink": "8.0.0",
|
|
47
47
|
"ink-text-input": "6.0.0",
|
|
48
48
|
"react": "19.3.1",
|
|
49
|
-
"weapp-ide-cli": "6.
|
|
49
|
+
"weapp-ide-cli": "6.4.0",
|
|
50
50
|
"zod": "4.6.7"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/react": "^19.3.0",
|
|
54
54
|
"@weapp-agent/core": "0.0.0",
|
|
55
|
-
"@weapp-agent/mini-program": "0.0.
|
|
55
|
+
"@weapp-agent/mini-program": "0.0.3",
|
|
56
56
|
"@weapp-agent/providers": "0.0.0",
|
|
57
|
-
"tsdown": "0.23.
|
|
57
|
+
"tsdown": "0.23.2"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public",
|