@staff0rd/assist 0.974.0 → 0.974.2
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/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.974.
|
|
9
|
+
version: "0.974.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -15312,6 +15312,17 @@ var askQuestionInputSchema = z9.object({
|
|
|
15312
15312
|
)
|
|
15313
15313
|
});
|
|
15314
15314
|
|
|
15315
|
+
// src/commands/sessions/shared/isLiveDaemonSession.ts
|
|
15316
|
+
var LIVE_TIMEOUT_MS = 1e3;
|
|
15317
|
+
async function isLiveDaemonSession(sessionId) {
|
|
15318
|
+
const reply2 = await requestDaemonReply(
|
|
15319
|
+
{ type: "session-live", sessionId },
|
|
15320
|
+
"session-live",
|
|
15321
|
+
LIVE_TIMEOUT_MS
|
|
15322
|
+
);
|
|
15323
|
+
return reply2?.live === true;
|
|
15324
|
+
}
|
|
15325
|
+
|
|
15315
15326
|
// src/commands/askQuestion.ts
|
|
15316
15327
|
function useBuiltIn(reason4) {
|
|
15317
15328
|
console.error(`Error: ${reason4}; use the built-in AskUserQuestion tool.`);
|
|
@@ -15328,6 +15339,10 @@ async function askQuestion(options2) {
|
|
|
15328
15339
|
useBuiltIn("not running in an assist session");
|
|
15329
15340
|
if (!loadConfig().sessions?.askQuestion)
|
|
15330
15341
|
useBuiltIn("assist ask-question is disabled (sessions.askQuestion)");
|
|
15342
|
+
if (!await isLiveDaemonSession(sessionId))
|
|
15343
|
+
useBuiltIn(
|
|
15344
|
+
`session ${sessionId} is not live in the assist daemon, so no preview pane can show the form`
|
|
15345
|
+
);
|
|
15331
15346
|
const title = questions.length === 1 ? "Claude is asking a question" : `Claude is asking ${questions.length} questions`;
|
|
15332
15347
|
const decision = await awaitPreviewApproval(
|
|
15333
15348
|
title,
|
|
@@ -21322,10 +21337,17 @@ function decideCommand(toolName, rawCommand) {
|
|
|
21322
21337
|
return findRestrictedPathDenyRaw(rawCommand) ?? findTruncatedReadDenyRaw(rawCommand) ?? findDeny(toolName, [rawCommand]);
|
|
21323
21338
|
}
|
|
21324
21339
|
|
|
21340
|
+
// src/commands/sessions/shared/inWebSession.ts
|
|
21341
|
+
function inWebSession() {
|
|
21342
|
+
return process.env.ASSIST_SESSION === "1" && !!process.env.ASSIST_SESSION_ID;
|
|
21343
|
+
}
|
|
21344
|
+
|
|
21325
21345
|
// src/commands/cliHook/findAskQuestionDeny.ts
|
|
21326
|
-
function findAskQuestionDeny(questionsJson) {
|
|
21327
|
-
if (
|
|
21346
|
+
async function findAskQuestionDeny(questionsJson) {
|
|
21347
|
+
if (!inWebSession()) return void 0;
|
|
21328
21348
|
if (!loadConfig().sessions?.askQuestion) return void 0;
|
|
21349
|
+
if (!await isLiveDaemonSession(process.env.ASSIST_SESSION_ID))
|
|
21350
|
+
return void 0;
|
|
21329
21351
|
return {
|
|
21330
21352
|
permissionDecision: "deny",
|
|
21331
21353
|
permissionDecisionReason: `Do not use AskUserQuestion in assist sessions: the user answers from the web preview pane, which cannot drive the terminal prompt. Write the same input as JSON to a scratch file and run \`assist ask-question --json - < <file>\` as a background task, doing no other work until it returns. It prints the same answer text AskUserQuestion would. The input to write:
|
|
@@ -21464,7 +21486,7 @@ async function decideBash(toolName, command) {
|
|
|
21464
21486
|
async function cliHook() {
|
|
21465
21487
|
const input = tryParseInput(await readStdin());
|
|
21466
21488
|
if (!input) return;
|
|
21467
|
-
const decision = input.kind === "command" ? await decideBash(input.toolName, input.command) : input.kind === "question" ? findAskQuestionDeny(input.command) : findRestrictedPathDeny(input.paths);
|
|
21489
|
+
const decision = input.kind === "command" ? await decideBash(input.toolName, input.command) : input.kind === "question" ? await findAskQuestionDeny(input.command) : findRestrictedPathDeny(input.paths);
|
|
21468
21490
|
if (!decision) return;
|
|
21469
21491
|
console.log(
|
|
21470
21492
|
JSON.stringify({
|
|
@@ -28085,11 +28107,6 @@ The project scope is needed for --project: gh auth refresh -h github.com -s proj
|
|
|
28085
28107
|
internalCommand(createCommand, "/github create");
|
|
28086
28108
|
}
|
|
28087
28109
|
|
|
28088
|
-
// src/commands/sessions/shared/inWebSession.ts
|
|
28089
|
-
function inWebSession() {
|
|
28090
|
-
return process.env.ASSIST_SESSION === "1" && !!process.env.ASSIST_SESSION_ID;
|
|
28091
|
-
}
|
|
28092
|
-
|
|
28093
28110
|
// src/commands/github/issue/fetchIssue.ts
|
|
28094
28111
|
import { execFileSync as execFileSync12 } from "child_process";
|
|
28095
28112
|
function fetchIssue2(number, repo) {
|
|
@@ -52854,6 +52871,7 @@ var SessionManager = class {
|
|
|
52854
52871
|
usedPct
|
|
52855
52872
|
);
|
|
52856
52873
|
}
|
|
52874
|
+
hasSession = (id) => this.sessions.has(id);
|
|
52857
52875
|
localSessions = () => [...this.sessions.values()].map(toSessionInfo);
|
|
52858
52876
|
listSessions = () => this.localSessions().concat(this.links.sessions());
|
|
52859
52877
|
notify = () => {
|
|
@@ -53854,6 +53872,11 @@ var messageHandlers = {
|
|
|
53854
53872
|
"verify-started": routed(
|
|
53855
53873
|
(client, m, d) => m.verify.start(client, d.sessionId)
|
|
53856
53874
|
),
|
|
53875
|
+
"session-live": (client, m, d) => {
|
|
53876
|
+
const live = m.hasSession(d.sessionId);
|
|
53877
|
+
if (!live) daemonLog(`session-live: unknown session id=${d.sessionId}`);
|
|
53878
|
+
sendTo(client, { type: "session-live", live });
|
|
53879
|
+
},
|
|
53857
53880
|
"pr-preview": (client, m, d) => m.prPreview.set(client, d),
|
|
53858
53881
|
"pr-decision": routed((_client, m, d) => m.prPreview.decide(d)),
|
|
53859
53882
|
"ui-status": (_client, _m, d) => daemonLog(`ui rendered: id=${d.sessionId} status=${d.status}`)
|