@punkcode/cli 0.1.11 → 0.1.12
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/dist/cli.js +32 -6
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -164,6 +164,7 @@ function runClaude(options, callbacks) {
|
|
|
164
164
|
...opts.model && { model: opts.model },
|
|
165
165
|
...opts.allowedTools && { allowedTools: opts.allowedTools },
|
|
166
166
|
...opts.disallowedTools && { disallowedTools: opts.disallowedTools },
|
|
167
|
+
...opts.effort && { effort: opts.effort },
|
|
167
168
|
...opts.maxTurns && { maxTurns: opts.maxTurns },
|
|
168
169
|
systemPrompt: opts.systemPrompt ?? { type: "preset", preset: "claude_code" },
|
|
169
170
|
...options.workingDirectory && { cwd: options.workingDirectory },
|
|
@@ -205,6 +206,8 @@ function runClaude(options, callbacks) {
|
|
|
205
206
|
abort: () => {
|
|
206
207
|
},
|
|
207
208
|
resolvePermission: () => {
|
|
209
|
+
},
|
|
210
|
+
setPermissionMode: async () => {
|
|
208
211
|
}
|
|
209
212
|
};
|
|
210
213
|
}
|
|
@@ -286,6 +289,10 @@ function runClaude(options, callbacks) {
|
|
|
286
289
|
};
|
|
287
290
|
logger.info({ sessionId: sessionInfo.sessionId, commands: sessionInfo.slashCommands.length }, "New chat session info");
|
|
288
291
|
callbacks.onSessionCreated(sessionInfo);
|
|
292
|
+
} else if (sys.subtype === "task_started" && callbacks.onTaskStarted) {
|
|
293
|
+
callbacks.onTaskStarted(sys.task_id, sys.description ?? "", sys.tool_use_id);
|
|
294
|
+
} else if (sys.subtype === "task_notification" && callbacks.onTaskNotification) {
|
|
295
|
+
callbacks.onTaskNotification(sys.task_id, sys.status ?? "completed", sys.summary ?? "", sys.tool_use_id);
|
|
289
296
|
}
|
|
290
297
|
break;
|
|
291
298
|
}
|
|
@@ -316,7 +323,8 @@ function runClaude(options, callbacks) {
|
|
|
316
323
|
},
|
|
317
324
|
resolvePermission: (toolUseId, allow, answers, feedback) => {
|
|
318
325
|
pendingPermissions.get(toolUseId)?.({ allow, answers, feedback });
|
|
319
|
-
}
|
|
326
|
+
},
|
|
327
|
+
setPermissionMode: (mode) => q.setPermissionMode(mode)
|
|
320
328
|
};
|
|
321
329
|
}
|
|
322
330
|
|
|
@@ -1167,6 +1175,16 @@ async function connect(server, options) {
|
|
|
1167
1175
|
socket.emit("register", deviceInfo, (response) => {
|
|
1168
1176
|
if (response.success) {
|
|
1169
1177
|
logger.info({ deviceId }, "Registered");
|
|
1178
|
+
} else {
|
|
1179
|
+
logger.warn("Registration failed, retrying in 2s...");
|
|
1180
|
+
setTimeout(() => {
|
|
1181
|
+
if (socket.connected) {
|
|
1182
|
+
socket.emit("register", collectDeviceInfo(deviceId, options.name, options.tag, defaultCwd), (r) => {
|
|
1183
|
+
if (r.success) logger.info({ deviceId }, "Registered (retry)");
|
|
1184
|
+
else logger.error("Registration failed after retry");
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
}, 2e3);
|
|
1170
1188
|
}
|
|
1171
1189
|
});
|
|
1172
1190
|
});
|
|
@@ -1205,9 +1223,13 @@ async function connect(server, options) {
|
|
|
1205
1223
|
});
|
|
1206
1224
|
socket.on("permission-response", (msg) => {
|
|
1207
1225
|
const log2 = createChildLogger({ sessionId: msg.requestId });
|
|
1208
|
-
log2.info({ toolUseId: msg.toolUseId, allowed: msg.allow }, msg.allow ? "Permission accepted" : "Permission denied");
|
|
1226
|
+
log2.info({ toolUseId: msg.toolUseId, allowed: msg.allow, permissionMode: msg.permissionMode }, msg.allow ? "Permission accepted" : "Permission denied");
|
|
1209
1227
|
const session = activeSessions.get(msg.requestId);
|
|
1210
1228
|
if (session) {
|
|
1229
|
+
if (msg.permissionMode) {
|
|
1230
|
+
session.setPermissionMode(msg.permissionMode).catch(() => {
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1211
1233
|
session.resolvePermission(msg.toolUseId, msg.allow, msg.answers, msg.feedback);
|
|
1212
1234
|
}
|
|
1213
1235
|
});
|
|
@@ -1217,10 +1239,6 @@ async function connect(server, options) {
|
|
|
1217
1239
|
socket.io.on("reconnect_attempt", () => {
|
|
1218
1240
|
logger.info("Reconnecting...");
|
|
1219
1241
|
});
|
|
1220
|
-
socket.on("reconnect", (attemptNumber) => {
|
|
1221
|
-
logger.info({ attemptNumber }, "Reconnected");
|
|
1222
|
-
socket.emit("register", collectDeviceInfo(deviceId, options.name, options.tag, defaultCwd));
|
|
1223
|
-
});
|
|
1224
1242
|
socket.on("connect_error", (err) => {
|
|
1225
1243
|
const { reason, ...detail } = formatConnectionError(err);
|
|
1226
1244
|
logger.error(detail, `Connection error: ${reason}`);
|
|
@@ -1352,6 +1370,14 @@ function handlePrompt(socket, msg, activeSessions) {
|
|
|
1352
1370
|
reason: req.reason,
|
|
1353
1371
|
blockedPath: req.blockedPath
|
|
1354
1372
|
});
|
|
1373
|
+
},
|
|
1374
|
+
onTaskStarted: (taskId, description, toolUseId) => {
|
|
1375
|
+
log2.info({ taskId, toolUseId, description }, "Task started");
|
|
1376
|
+
send(socket, "response", { type: "task_started", taskId, description, toolUseId, requestId: id });
|
|
1377
|
+
},
|
|
1378
|
+
onTaskNotification: (taskId, status, summary, toolUseId) => {
|
|
1379
|
+
log2.info({ taskId, toolUseId, status, summary }, "Task notification");
|
|
1380
|
+
send(socket, "response", { type: "task_notification", taskId, status, summary, toolUseId, requestId: id });
|
|
1355
1381
|
}
|
|
1356
1382
|
}
|
|
1357
1383
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@punkcode/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Control Claude Code from your phone",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"vitest": "^4.0.18"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@anthropic-ai/claude-agent-sdk": "^0.2.
|
|
57
|
-
"@anthropic-ai/sdk": "^0.
|
|
56
|
+
"@anthropic-ai/claude-agent-sdk": "^0.2.49",
|
|
57
|
+
"@anthropic-ai/sdk": "^0.78.0",
|
|
58
58
|
"commander": "^14.0.3",
|
|
59
59
|
"execa": "^9.6.1",
|
|
60
60
|
"pino": "^10.3.1",
|