pi2dsh 0.15.0 → 0.15.1
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/host.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{runtime-BN4E4OtI.mjs → runtime-D1DI60RQ.mjs} +38 -13
- package/dist/runtime-D1DI60RQ.mjs.map +1 -0
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +1 -1
- package/package.json +1 -1
- package/dist/runtime-BN4E4OtI.mjs.map +0 -1
package/dist/host.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as registerVisionCompanions, t as applyPiPackage } from "./runtime-
|
|
2
|
+
import { a as registerVisionCompanions, t as applyPiPackage } from "./runtime-D1DI60RQ.mjs";
|
|
3
3
|
import { t as resolvePiPackage } from "./source-0sA5z08z.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as registerVisionCompanions } from "./runtime-
|
|
2
|
+
import { a as registerVisionCompanions } from "./runtime-D1DI60RQ.mjs";
|
|
3
3
|
import { t as resolvePiPackage } from "./source-0sA5z08z.mjs";
|
|
4
4
|
import { applyPiHost, applyPreparedPiHost, manifestForInstalled, preparePiHost } from "./host.mjs";
|
|
5
5
|
import { a as PI_AI_PACKAGES, c as UI_CONTEXT_RULES, d as ruleForEvent, f as ruleForHostImport, i as HOST_IMPORT_RULES, l as ruleForApi, n as CONTEXT_RULES, o as PI_CODING_AGENT_PACKAGES, p as ruleForUiContextProperty, r as EVENT_RULES, s as PI_TUI_PACKAGES, t as API_RULES, u as ruleForContextProperty } from "./compatibility-DH_Gi96X.mjs";
|
|
@@ -3126,11 +3126,16 @@ function answerText(answer) {
|
|
|
3126
3126
|
async function askOne(ctx, agent, signal, question) {
|
|
3127
3127
|
const service = optionalService(ctx, "userQuestions");
|
|
3128
3128
|
if (service === void 0) unsupported("ctx.ui AskUser");
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3129
|
+
try {
|
|
3130
|
+
return answerText((await service.ask({
|
|
3131
|
+
questions: [question],
|
|
3132
|
+
...agent !== void 0 ? { agent } : {},
|
|
3133
|
+
signal
|
|
3134
|
+
})).answers.find((answer) => answer.id === question.id));
|
|
3135
|
+
} catch (error) {
|
|
3136
|
+
if (signal?.aborted === true) return void 0;
|
|
3137
|
+
throw error;
|
|
3138
|
+
}
|
|
3134
3139
|
}
|
|
3135
3140
|
function agentSession(agent) {
|
|
3136
3141
|
const session = agent?.session;
|
|
@@ -3229,6 +3234,26 @@ async function summarizeAbandonedBranch(ctx, state, agent, events, boundary, opt
|
|
|
3229
3234
|
}
|
|
3230
3235
|
return result.summary;
|
|
3231
3236
|
}
|
|
3237
|
+
/** Resolve Pi's official `ExtensionUIDialogOptions` third argument
|
|
3238
|
+
* (`{ signal?, timeout? }`, types.ts:96 at the pinned upstream) into one
|
|
3239
|
+
* abort signal. A bare AbortSignal is also accepted — pi-ai's OAuth prompt
|
|
3240
|
+
* callbacks hand the signal directly. Anything else resolves to undefined.
|
|
3241
|
+
* The `timeout` field is realized with AbortSignal.timeout, so a dialog the
|
|
3242
|
+
* package wants auto-dismissed really leaves the screen. Silently ignoring
|
|
3243
|
+
* the options object is what left the OAuth paste box on screen after the
|
|
3244
|
+
* browser callback had already won (pi-mcp-adapter passes
|
|
3245
|
+
* `ui.input(title, undefined, { signal })` and cancels it in its
|
|
3246
|
+
* waitForAuthorizationResponse finally block). */
|
|
3247
|
+
function dialogAbortSignal(opts) {
|
|
3248
|
+
if (opts instanceof AbortSignal) return opts;
|
|
3249
|
+
if (typeof opts !== "object" || opts === null) return void 0;
|
|
3250
|
+
const record = opts;
|
|
3251
|
+
const signals = [];
|
|
3252
|
+
if (record.signal instanceof AbortSignal) signals.push(record.signal);
|
|
3253
|
+
if (typeof record.timeout === "number" && Number.isFinite(record.timeout) && record.timeout > 0) signals.push(AbortSignal.timeout(record.timeout));
|
|
3254
|
+
if (signals.length === 0) return void 0;
|
|
3255
|
+
return signals.length === 1 ? signals[0] : AbortSignal.any(signals);
|
|
3256
|
+
}
|
|
3232
3257
|
function contextFor(ctx, state, agent, signal, command = false, sessionOverride) {
|
|
3233
3258
|
const notices = [];
|
|
3234
3259
|
const userQuestions = optionalService(ctx, "userQuestions");
|
|
@@ -3240,30 +3265,30 @@ function contextFor(ctx, state, agent, signal, command = false, sessionOverride)
|
|
|
3240
3265
|
const level = type === "warning" || type === "error" ? "warn" : "info";
|
|
3241
3266
|
logger(ctx)[level](`[pi2dsh] ${text}`);
|
|
3242
3267
|
},
|
|
3243
|
-
select: async (title, options,
|
|
3268
|
+
select: async (title, options, opts) => {
|
|
3244
3269
|
const labels = options.map((option) => String(option));
|
|
3245
|
-
const answered = await askOne(ctx, agent, joinSignals(signal,
|
|
3270
|
+
const answered = await askOne(ctx, agent, joinSignals(signal, dialogAbortSignal(opts)), {
|
|
3246
3271
|
id: "pi2dsh-select",
|
|
3247
3272
|
question: String(title),
|
|
3248
3273
|
options: labels.map((label) => ({ label }))
|
|
3249
3274
|
});
|
|
3250
3275
|
return answered === void 0 ? void 0 : resolveOfferedChoice(answered, labels);
|
|
3251
3276
|
},
|
|
3252
|
-
async confirm(title, message) {
|
|
3253
|
-
return await askOne(ctx, agent, signal, {
|
|
3277
|
+
async confirm(title, message, opts) {
|
|
3278
|
+
return await askOne(ctx, agent, joinSignals(signal, dialogAbortSignal(opts)), {
|
|
3254
3279
|
id: "pi2dsh-confirm",
|
|
3255
3280
|
question: String(title),
|
|
3256
3281
|
detail: String(message),
|
|
3257
3282
|
options: [{ label: "Yes" }, { label: "No" }]
|
|
3258
3283
|
}) === "Yes";
|
|
3259
3284
|
},
|
|
3260
|
-
input: (title, placeholder,
|
|
3285
|
+
input: (title, placeholder, opts) => askOne(ctx, agent, joinSignals(signal, dialogAbortSignal(opts)), {
|
|
3261
3286
|
id: "pi2dsh-input",
|
|
3262
3287
|
question: String(title),
|
|
3263
3288
|
...placeholder === void 0 ? {} : { detail: String(placeholder) }
|
|
3264
3289
|
}),
|
|
3265
|
-
deviceCode: async (title, detail,
|
|
3266
|
-
await askOne(ctx, agent, joinSignals(signal,
|
|
3290
|
+
deviceCode: async (title, detail, opts) => {
|
|
3291
|
+
await askOne(ctx, agent, joinSignals(signal, dialogAbortSignal(opts)), {
|
|
3267
3292
|
id: "pi2dsh-device-code",
|
|
3268
3293
|
question: String(title),
|
|
3269
3294
|
detail: String(detail),
|
|
@@ -6206,4 +6231,4 @@ const runtimeInternals = {
|
|
|
6206
6231
|
//#endregion
|
|
6207
6232
|
export { registerVisionCompanions as a, overlayProviderConfig as i, mergeProviderRegistration as n, runtimeInternals as o, normalizeToolSchema as r, applyPiPackage as t };
|
|
6208
6233
|
|
|
6209
|
-
//# sourceMappingURL=runtime-
|
|
6234
|
+
//# sourceMappingURL=runtime-D1DI60RQ.mjs.map
|