@bastani/atomic 0.9.16-alpha.8 → 0.9.16-alpha.9
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/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/index.bundle.mjs +66 -2
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/index.bundle.mjs +66 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +66 -2
- package/dist/builtin/web-access/index.bundle.mjs +66 -2
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/builtin/{chunk-5n10x7j2.js → chunk-17zk6ffd.js} +67 -3
- package/dist/builtin/workflows/builtin/{chunk-cdtd3m3w.js → chunk-8v8wmb7z.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-zf28603f.js → chunk-h5e65g7g.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-v04c5qmd.js → chunk-qe6bfpbd.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-hdpj1dkw.js → chunk-rbnj9621.js} +1 -1
- package/dist/builtin/workflows/builtin/goal.js +3 -3
- package/dist/builtin/workflows/builtin/index.js +4 -4
- package/dist/builtin/workflows/builtin/open-claude-design.js +1 -1
- package/dist/builtin/workflows/builtin/ralph.js +3 -3
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +66 -2
- package/dist/builtin/workflows/src/index.js +66 -2
- package/dist/core/extensions/agent-events.d.ts +15 -0
- package/dist/core/extensions/agent-events.d.ts.map +1 -1
- package/dist/core/extensions/agent-events.js.map +1 -1
- package/dist/core/extensions/api-types.d.ts +3 -1
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/event-types.d.ts +2 -2
- package/dist/core/extensions/event-types.d.ts.map +1 -1
- package/dist/core/extensions/event-types.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +6 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +65 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/docs/extensions.md +19 -0
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.9.16-alpha.9] - 2026-08-27
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added `ui_prompt_start` and `ui_prompt_end` extension events around blocking `ctx.ui` prompts so integrations can distinguish active agent work from waiting for user input. Nested and overlapping prompts form one balanced outer span, and prompt failures or UI-context replacement still emit the matching end notification without delaying the prompt UI. ([#5329](https://github.com/earendil-works/pi/issues/5329))
|
|
10
|
+
|
|
5
11
|
## [0.9.16-alpha.8] - 2026-08-27
|
|
6
12
|
|
|
7
13
|
### Breaking Changes
|
|
@@ -12236,6 +12236,8 @@ class ExtensionRunner {
|
|
|
12236
12236
|
shortcutDiagnostics = [];
|
|
12237
12237
|
commandDiagnostics = [];
|
|
12238
12238
|
staleMessage;
|
|
12239
|
+
uiPromptBinding = 0;
|
|
12240
|
+
activeUIPrompt;
|
|
12239
12241
|
constructor(extensions, runtime, cwd, sessionManager, modelRegistry, orchestrationContext, subagentPolicy) {
|
|
12240
12242
|
this.extensions = extensions;
|
|
12241
12243
|
this.runtime = runtime;
|
|
@@ -12330,9 +12332,71 @@ class ExtensionRunner {
|
|
|
12330
12332
|
this.reloadHandler = async () => {};
|
|
12331
12333
|
}
|
|
12332
12334
|
setUIContext(uiContext, mode = "print") {
|
|
12333
|
-
this.
|
|
12335
|
+
this.endActiveUIPrompt();
|
|
12336
|
+
const binding = ++this.uiPromptBinding;
|
|
12337
|
+
this.uiContext = uiContext ? this.wrapUIPromptContext(uiContext, binding) : noOpUIContext;
|
|
12334
12338
|
this.mode = mode;
|
|
12335
12339
|
}
|
|
12340
|
+
wrapUIPromptContext(ui, binding) {
|
|
12341
|
+
return {
|
|
12342
|
+
...ui,
|
|
12343
|
+
select: (title, options, opts) => this.withUIPrompt(binding, "select", title, () => ui.select(title, options, opts)),
|
|
12344
|
+
confirm: (title, message, opts) => this.withUIPrompt(binding, "confirm", title, () => ui.confirm(title, message, opts)),
|
|
12345
|
+
input: (title, placeholder, opts) => this.withUIPrompt(binding, "input", title, () => ui.input(title, placeholder, opts)),
|
|
12346
|
+
editor: (title, prefill, opts) => this.withUIPrompt(binding, "editor", title, () => ui.editor(title, prefill, opts)),
|
|
12347
|
+
custom: (factory, options) => this.withUIPrompt(binding, "custom", undefined, () => ui.custom(factory, options))
|
|
12348
|
+
};
|
|
12349
|
+
}
|
|
12350
|
+
withUIPrompt(binding, kind, title, run) {
|
|
12351
|
+
if (binding !== this.uiPromptBinding)
|
|
12352
|
+
return run();
|
|
12353
|
+
let prompt = this.activeUIPrompt;
|
|
12354
|
+
if (!prompt) {
|
|
12355
|
+
prompt = { depth: 0, kind, title };
|
|
12356
|
+
this.activeUIPrompt = prompt;
|
|
12357
|
+
this.emitUIPromptEvent({
|
|
12358
|
+
type: "ui_prompt_start",
|
|
12359
|
+
reason: "ui_prompt",
|
|
12360
|
+
kind,
|
|
12361
|
+
...title === undefined ? {} : { title }
|
|
12362
|
+
});
|
|
12363
|
+
}
|
|
12364
|
+
prompt.depth += 1;
|
|
12365
|
+
let finished = false;
|
|
12366
|
+
const finish = () => {
|
|
12367
|
+
if (finished)
|
|
12368
|
+
return;
|
|
12369
|
+
finished = true;
|
|
12370
|
+
if (this.activeUIPrompt !== prompt)
|
|
12371
|
+
return;
|
|
12372
|
+
prompt.depth -= 1;
|
|
12373
|
+
if (prompt.depth === 0)
|
|
12374
|
+
this.endActiveUIPrompt(prompt);
|
|
12375
|
+
};
|
|
12376
|
+
try {
|
|
12377
|
+
return run().finally(finish);
|
|
12378
|
+
} catch (error) {
|
|
12379
|
+
finish();
|
|
12380
|
+
throw error;
|
|
12381
|
+
}
|
|
12382
|
+
}
|
|
12383
|
+
endActiveUIPrompt(prompt = this.activeUIPrompt) {
|
|
12384
|
+
if (!prompt || this.activeUIPrompt !== prompt)
|
|
12385
|
+
return;
|
|
12386
|
+
this.activeUIPrompt = undefined;
|
|
12387
|
+
prompt.depth = 0;
|
|
12388
|
+
this.emitUIPromptEvent({
|
|
12389
|
+
type: "ui_prompt_end",
|
|
12390
|
+
reason: "ui_prompt",
|
|
12391
|
+
kind: prompt.kind,
|
|
12392
|
+
...prompt.title === undefined ? {} : { title: prompt.title }
|
|
12393
|
+
});
|
|
12394
|
+
}
|
|
12395
|
+
emitUIPromptEvent(event) {
|
|
12396
|
+
queueMicrotask(() => {
|
|
12397
|
+
this.emit(event);
|
|
12398
|
+
});
|
|
12399
|
+
}
|
|
12336
12400
|
getUIContext() {
|
|
12337
12401
|
return this.uiContext;
|
|
12338
12402
|
}
|
|
@@ -51454,7 +51518,7 @@ var init_interactive_extension_runtime = __esm(() => {
|
|
|
51454
51518
|
if (shortcuts.size === 0)
|
|
51455
51519
|
return;
|
|
51456
51520
|
const createContext = () => ({
|
|
51457
|
-
ui:
|
|
51521
|
+
ui: extensionRunner.getUIContext(),
|
|
51458
51522
|
mode: "tui",
|
|
51459
51523
|
hasUI: true,
|
|
51460
51524
|
cwd: this.sessionManager.getCwd(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/intercom",
|
|
3
|
-
"version": "0.9.16-alpha.
|
|
3
|
+
"version": "0.9.16-alpha.9",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension providing a private coordination channel between parent and child agent sessions. Fork of: https://github.com/nicobailon/pi-intercom",
|
|
6
6
|
"contributors": [
|
|
@@ -12236,6 +12236,8 @@ class ExtensionRunner {
|
|
|
12236
12236
|
shortcutDiagnostics = [];
|
|
12237
12237
|
commandDiagnostics = [];
|
|
12238
12238
|
staleMessage;
|
|
12239
|
+
uiPromptBinding = 0;
|
|
12240
|
+
activeUIPrompt;
|
|
12239
12241
|
constructor(extensions, runtime, cwd, sessionManager, modelRegistry, orchestrationContext, subagentPolicy) {
|
|
12240
12242
|
this.extensions = extensions;
|
|
12241
12243
|
this.runtime = runtime;
|
|
@@ -12330,9 +12332,71 @@ class ExtensionRunner {
|
|
|
12330
12332
|
this.reloadHandler = async () => {};
|
|
12331
12333
|
}
|
|
12332
12334
|
setUIContext(uiContext, mode = "print") {
|
|
12333
|
-
this.
|
|
12335
|
+
this.endActiveUIPrompt();
|
|
12336
|
+
const binding = ++this.uiPromptBinding;
|
|
12337
|
+
this.uiContext = uiContext ? this.wrapUIPromptContext(uiContext, binding) : noOpUIContext;
|
|
12334
12338
|
this.mode = mode;
|
|
12335
12339
|
}
|
|
12340
|
+
wrapUIPromptContext(ui, binding) {
|
|
12341
|
+
return {
|
|
12342
|
+
...ui,
|
|
12343
|
+
select: (title, options, opts) => this.withUIPrompt(binding, "select", title, () => ui.select(title, options, opts)),
|
|
12344
|
+
confirm: (title, message, opts) => this.withUIPrompt(binding, "confirm", title, () => ui.confirm(title, message, opts)),
|
|
12345
|
+
input: (title, placeholder, opts) => this.withUIPrompt(binding, "input", title, () => ui.input(title, placeholder, opts)),
|
|
12346
|
+
editor: (title, prefill, opts) => this.withUIPrompt(binding, "editor", title, () => ui.editor(title, prefill, opts)),
|
|
12347
|
+
custom: (factory, options) => this.withUIPrompt(binding, "custom", undefined, () => ui.custom(factory, options))
|
|
12348
|
+
};
|
|
12349
|
+
}
|
|
12350
|
+
withUIPrompt(binding, kind, title, run) {
|
|
12351
|
+
if (binding !== this.uiPromptBinding)
|
|
12352
|
+
return run();
|
|
12353
|
+
let prompt = this.activeUIPrompt;
|
|
12354
|
+
if (!prompt) {
|
|
12355
|
+
prompt = { depth: 0, kind, title };
|
|
12356
|
+
this.activeUIPrompt = prompt;
|
|
12357
|
+
this.emitUIPromptEvent({
|
|
12358
|
+
type: "ui_prompt_start",
|
|
12359
|
+
reason: "ui_prompt",
|
|
12360
|
+
kind,
|
|
12361
|
+
...title === undefined ? {} : { title }
|
|
12362
|
+
});
|
|
12363
|
+
}
|
|
12364
|
+
prompt.depth += 1;
|
|
12365
|
+
let finished = false;
|
|
12366
|
+
const finish = () => {
|
|
12367
|
+
if (finished)
|
|
12368
|
+
return;
|
|
12369
|
+
finished = true;
|
|
12370
|
+
if (this.activeUIPrompt !== prompt)
|
|
12371
|
+
return;
|
|
12372
|
+
prompt.depth -= 1;
|
|
12373
|
+
if (prompt.depth === 0)
|
|
12374
|
+
this.endActiveUIPrompt(prompt);
|
|
12375
|
+
};
|
|
12376
|
+
try {
|
|
12377
|
+
return run().finally(finish);
|
|
12378
|
+
} catch (error) {
|
|
12379
|
+
finish();
|
|
12380
|
+
throw error;
|
|
12381
|
+
}
|
|
12382
|
+
}
|
|
12383
|
+
endActiveUIPrompt(prompt = this.activeUIPrompt) {
|
|
12384
|
+
if (!prompt || this.activeUIPrompt !== prompt)
|
|
12385
|
+
return;
|
|
12386
|
+
this.activeUIPrompt = undefined;
|
|
12387
|
+
prompt.depth = 0;
|
|
12388
|
+
this.emitUIPromptEvent({
|
|
12389
|
+
type: "ui_prompt_end",
|
|
12390
|
+
reason: "ui_prompt",
|
|
12391
|
+
kind: prompt.kind,
|
|
12392
|
+
...prompt.title === undefined ? {} : { title: prompt.title }
|
|
12393
|
+
});
|
|
12394
|
+
}
|
|
12395
|
+
emitUIPromptEvent(event) {
|
|
12396
|
+
queueMicrotask(() => {
|
|
12397
|
+
this.emit(event);
|
|
12398
|
+
});
|
|
12399
|
+
}
|
|
12336
12400
|
getUIContext() {
|
|
12337
12401
|
return this.uiContext;
|
|
12338
12402
|
}
|
|
@@ -51593,7 +51657,7 @@ var init_interactive_extension_runtime = __esm(() => {
|
|
|
51593
51657
|
if (shortcuts.size === 0)
|
|
51594
51658
|
return;
|
|
51595
51659
|
const createContext = () => ({
|
|
51596
|
-
ui:
|
|
51660
|
+
ui: extensionRunner.getUIContext(),
|
|
51597
51661
|
mode: "tui",
|
|
51598
51662
|
hasUI: true,
|
|
51599
51663
|
cwd: this.sessionManager.getCwd(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/mcp",
|
|
3
|
-
"version": "0.9.16-alpha.
|
|
3
|
+
"version": "0.9.16-alpha.9",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension that adapts MCP (Model Context Protocol) servers into the coding agent. Fork of: https://github.com/nicobailon/pi-mcp-adapter",
|
|
6
6
|
"contributors": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/subagents",
|
|
3
|
-
"version": "0.9.16-alpha.
|
|
3
|
+
"version": "0.9.16-alpha.9",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for delegating tasks to subagents with parallel execution. Fork of: https://github.com/nicobailon/pi-subagents",
|
|
6
6
|
"contributors": [
|
|
@@ -13317,6 +13317,8 @@ class ExtensionRunner {
|
|
|
13317
13317
|
shortcutDiagnostics = [];
|
|
13318
13318
|
commandDiagnostics = [];
|
|
13319
13319
|
staleMessage;
|
|
13320
|
+
uiPromptBinding = 0;
|
|
13321
|
+
activeUIPrompt;
|
|
13320
13322
|
constructor(extensions, runtime, cwd, sessionManager, modelRegistry, orchestrationContext, subagentPolicy) {
|
|
13321
13323
|
this.extensions = extensions;
|
|
13322
13324
|
this.runtime = runtime;
|
|
@@ -13411,9 +13413,71 @@ class ExtensionRunner {
|
|
|
13411
13413
|
this.reloadHandler = async () => {};
|
|
13412
13414
|
}
|
|
13413
13415
|
setUIContext(uiContext, mode = "print") {
|
|
13414
|
-
this.
|
|
13416
|
+
this.endActiveUIPrompt();
|
|
13417
|
+
const binding = ++this.uiPromptBinding;
|
|
13418
|
+
this.uiContext = uiContext ? this.wrapUIPromptContext(uiContext, binding) : noOpUIContext;
|
|
13415
13419
|
this.mode = mode;
|
|
13416
13420
|
}
|
|
13421
|
+
wrapUIPromptContext(ui, binding) {
|
|
13422
|
+
return {
|
|
13423
|
+
...ui,
|
|
13424
|
+
select: (title, options, opts) => this.withUIPrompt(binding, "select", title, () => ui.select(title, options, opts)),
|
|
13425
|
+
confirm: (title, message, opts) => this.withUIPrompt(binding, "confirm", title, () => ui.confirm(title, message, opts)),
|
|
13426
|
+
input: (title, placeholder, opts) => this.withUIPrompt(binding, "input", title, () => ui.input(title, placeholder, opts)),
|
|
13427
|
+
editor: (title, prefill, opts) => this.withUIPrompt(binding, "editor", title, () => ui.editor(title, prefill, opts)),
|
|
13428
|
+
custom: (factory, options) => this.withUIPrompt(binding, "custom", undefined, () => ui.custom(factory, options))
|
|
13429
|
+
};
|
|
13430
|
+
}
|
|
13431
|
+
withUIPrompt(binding, kind, title, run) {
|
|
13432
|
+
if (binding !== this.uiPromptBinding)
|
|
13433
|
+
return run();
|
|
13434
|
+
let prompt = this.activeUIPrompt;
|
|
13435
|
+
if (!prompt) {
|
|
13436
|
+
prompt = { depth: 0, kind, title };
|
|
13437
|
+
this.activeUIPrompt = prompt;
|
|
13438
|
+
this.emitUIPromptEvent({
|
|
13439
|
+
type: "ui_prompt_start",
|
|
13440
|
+
reason: "ui_prompt",
|
|
13441
|
+
kind,
|
|
13442
|
+
...title === undefined ? {} : { title }
|
|
13443
|
+
});
|
|
13444
|
+
}
|
|
13445
|
+
prompt.depth += 1;
|
|
13446
|
+
let finished = false;
|
|
13447
|
+
const finish = () => {
|
|
13448
|
+
if (finished)
|
|
13449
|
+
return;
|
|
13450
|
+
finished = true;
|
|
13451
|
+
if (this.activeUIPrompt !== prompt)
|
|
13452
|
+
return;
|
|
13453
|
+
prompt.depth -= 1;
|
|
13454
|
+
if (prompt.depth === 0)
|
|
13455
|
+
this.endActiveUIPrompt(prompt);
|
|
13456
|
+
};
|
|
13457
|
+
try {
|
|
13458
|
+
return run().finally(finish);
|
|
13459
|
+
} catch (error) {
|
|
13460
|
+
finish();
|
|
13461
|
+
throw error;
|
|
13462
|
+
}
|
|
13463
|
+
}
|
|
13464
|
+
endActiveUIPrompt(prompt = this.activeUIPrompt) {
|
|
13465
|
+
if (!prompt || this.activeUIPrompt !== prompt)
|
|
13466
|
+
return;
|
|
13467
|
+
this.activeUIPrompt = undefined;
|
|
13468
|
+
prompt.depth = 0;
|
|
13469
|
+
this.emitUIPromptEvent({
|
|
13470
|
+
type: "ui_prompt_end",
|
|
13471
|
+
reason: "ui_prompt",
|
|
13472
|
+
kind: prompt.kind,
|
|
13473
|
+
...prompt.title === undefined ? {} : { title: prompt.title }
|
|
13474
|
+
});
|
|
13475
|
+
}
|
|
13476
|
+
emitUIPromptEvent(event) {
|
|
13477
|
+
queueMicrotask(() => {
|
|
13478
|
+
this.emit(event);
|
|
13479
|
+
});
|
|
13480
|
+
}
|
|
13417
13481
|
getUIContext() {
|
|
13418
13482
|
return this.uiContext;
|
|
13419
13483
|
}
|
|
@@ -64912,7 +64976,7 @@ var init_interactive_extension_runtime = __esm(() => {
|
|
|
64912
64976
|
if (shortcuts.size === 0)
|
|
64913
64977
|
return;
|
|
64914
64978
|
const createContext = () => ({
|
|
64915
|
-
ui:
|
|
64979
|
+
ui: extensionRunner.getUIContext(),
|
|
64916
64980
|
mode: "tui",
|
|
64917
64981
|
hasUI: true,
|
|
64918
64982
|
cwd: this.sessionManager.getCwd(),
|
|
@@ -12242,6 +12242,8 @@ class ExtensionRunner {
|
|
|
12242
12242
|
shortcutDiagnostics = [];
|
|
12243
12243
|
commandDiagnostics = [];
|
|
12244
12244
|
staleMessage;
|
|
12245
|
+
uiPromptBinding = 0;
|
|
12246
|
+
activeUIPrompt;
|
|
12245
12247
|
constructor(extensions, runtime, cwd, sessionManager, modelRegistry, orchestrationContext, subagentPolicy) {
|
|
12246
12248
|
this.extensions = extensions;
|
|
12247
12249
|
this.runtime = runtime;
|
|
@@ -12336,9 +12338,71 @@ class ExtensionRunner {
|
|
|
12336
12338
|
this.reloadHandler = async () => {};
|
|
12337
12339
|
}
|
|
12338
12340
|
setUIContext(uiContext, mode = "print") {
|
|
12339
|
-
this.
|
|
12341
|
+
this.endActiveUIPrompt();
|
|
12342
|
+
const binding = ++this.uiPromptBinding;
|
|
12343
|
+
this.uiContext = uiContext ? this.wrapUIPromptContext(uiContext, binding) : noOpUIContext;
|
|
12340
12344
|
this.mode = mode;
|
|
12341
12345
|
}
|
|
12346
|
+
wrapUIPromptContext(ui, binding) {
|
|
12347
|
+
return {
|
|
12348
|
+
...ui,
|
|
12349
|
+
select: (title, options, opts) => this.withUIPrompt(binding, "select", title, () => ui.select(title, options, opts)),
|
|
12350
|
+
confirm: (title, message, opts) => this.withUIPrompt(binding, "confirm", title, () => ui.confirm(title, message, opts)),
|
|
12351
|
+
input: (title, placeholder, opts) => this.withUIPrompt(binding, "input", title, () => ui.input(title, placeholder, opts)),
|
|
12352
|
+
editor: (title, prefill, opts) => this.withUIPrompt(binding, "editor", title, () => ui.editor(title, prefill, opts)),
|
|
12353
|
+
custom: (factory, options) => this.withUIPrompt(binding, "custom", undefined, () => ui.custom(factory, options))
|
|
12354
|
+
};
|
|
12355
|
+
}
|
|
12356
|
+
withUIPrompt(binding, kind, title, run) {
|
|
12357
|
+
if (binding !== this.uiPromptBinding)
|
|
12358
|
+
return run();
|
|
12359
|
+
let prompt = this.activeUIPrompt;
|
|
12360
|
+
if (!prompt) {
|
|
12361
|
+
prompt = { depth: 0, kind, title };
|
|
12362
|
+
this.activeUIPrompt = prompt;
|
|
12363
|
+
this.emitUIPromptEvent({
|
|
12364
|
+
type: "ui_prompt_start",
|
|
12365
|
+
reason: "ui_prompt",
|
|
12366
|
+
kind,
|
|
12367
|
+
...title === undefined ? {} : { title }
|
|
12368
|
+
});
|
|
12369
|
+
}
|
|
12370
|
+
prompt.depth += 1;
|
|
12371
|
+
let finished = false;
|
|
12372
|
+
const finish = () => {
|
|
12373
|
+
if (finished)
|
|
12374
|
+
return;
|
|
12375
|
+
finished = true;
|
|
12376
|
+
if (this.activeUIPrompt !== prompt)
|
|
12377
|
+
return;
|
|
12378
|
+
prompt.depth -= 1;
|
|
12379
|
+
if (prompt.depth === 0)
|
|
12380
|
+
this.endActiveUIPrompt(prompt);
|
|
12381
|
+
};
|
|
12382
|
+
try {
|
|
12383
|
+
return run().finally(finish);
|
|
12384
|
+
} catch (error) {
|
|
12385
|
+
finish();
|
|
12386
|
+
throw error;
|
|
12387
|
+
}
|
|
12388
|
+
}
|
|
12389
|
+
endActiveUIPrompt(prompt = this.activeUIPrompt) {
|
|
12390
|
+
if (!prompt || this.activeUIPrompt !== prompt)
|
|
12391
|
+
return;
|
|
12392
|
+
this.activeUIPrompt = undefined;
|
|
12393
|
+
prompt.depth = 0;
|
|
12394
|
+
this.emitUIPromptEvent({
|
|
12395
|
+
type: "ui_prompt_end",
|
|
12396
|
+
reason: "ui_prompt",
|
|
12397
|
+
kind: prompt.kind,
|
|
12398
|
+
...prompt.title === undefined ? {} : { title: prompt.title }
|
|
12399
|
+
});
|
|
12400
|
+
}
|
|
12401
|
+
emitUIPromptEvent(event) {
|
|
12402
|
+
queueMicrotask(() => {
|
|
12403
|
+
this.emit(event);
|
|
12404
|
+
});
|
|
12405
|
+
}
|
|
12342
12406
|
getUIContext() {
|
|
12343
12407
|
return this.uiContext;
|
|
12344
12408
|
}
|
|
@@ -51453,7 +51517,7 @@ var init_interactive_extension_runtime = __esm(() => {
|
|
|
51453
51517
|
if (shortcuts.size === 0)
|
|
51454
51518
|
return;
|
|
51455
51519
|
const createContext = () => ({
|
|
51456
|
-
ui:
|
|
51520
|
+
ui: extensionRunner.getUIContext(),
|
|
51457
51521
|
mode: "tui",
|
|
51458
51522
|
hasUI: true,
|
|
51459
51523
|
cwd: this.sessionManager.getCwd(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/web-access",
|
|
3
|
-
"version": "0.9.16-alpha.
|
|
3
|
+
"version": "0.9.16-alpha.9",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for web search, URL fetching, GitHub repo cloning, PDF/video extraction. Fork of: https://github.com/nicobailon/pi-web-access",
|
|
6
6
|
"contributors": [
|
|
@@ -8558,6 +8558,8 @@ class ExtensionRunner {
|
|
|
8558
8558
|
shortcutDiagnostics = [];
|
|
8559
8559
|
commandDiagnostics = [];
|
|
8560
8560
|
staleMessage;
|
|
8561
|
+
uiPromptBinding = 0;
|
|
8562
|
+
activeUIPrompt;
|
|
8561
8563
|
constructor(extensions, runtime, cwd, sessionManager, modelRegistry, orchestrationContext, subagentPolicy) {
|
|
8562
8564
|
this.extensions = extensions;
|
|
8563
8565
|
this.runtime = runtime;
|
|
@@ -8652,9 +8654,71 @@ class ExtensionRunner {
|
|
|
8652
8654
|
this.reloadHandler = async () => {};
|
|
8653
8655
|
}
|
|
8654
8656
|
setUIContext(uiContext, mode = "print") {
|
|
8655
|
-
this.
|
|
8657
|
+
this.endActiveUIPrompt();
|
|
8658
|
+
const binding = ++this.uiPromptBinding;
|
|
8659
|
+
this.uiContext = uiContext ? this.wrapUIPromptContext(uiContext, binding) : noOpUIContext;
|
|
8656
8660
|
this.mode = mode;
|
|
8657
8661
|
}
|
|
8662
|
+
wrapUIPromptContext(ui, binding) {
|
|
8663
|
+
return {
|
|
8664
|
+
...ui,
|
|
8665
|
+
select: (title, options, opts) => this.withUIPrompt(binding, "select", title, () => ui.select(title, options, opts)),
|
|
8666
|
+
confirm: (title, message, opts) => this.withUIPrompt(binding, "confirm", title, () => ui.confirm(title, message, opts)),
|
|
8667
|
+
input: (title, placeholder, opts) => this.withUIPrompt(binding, "input", title, () => ui.input(title, placeholder, opts)),
|
|
8668
|
+
editor: (title, prefill, opts) => this.withUIPrompt(binding, "editor", title, () => ui.editor(title, prefill, opts)),
|
|
8669
|
+
custom: (factory, options) => this.withUIPrompt(binding, "custom", undefined, () => ui.custom(factory, options))
|
|
8670
|
+
};
|
|
8671
|
+
}
|
|
8672
|
+
withUIPrompt(binding, kind, title, run) {
|
|
8673
|
+
if (binding !== this.uiPromptBinding)
|
|
8674
|
+
return run();
|
|
8675
|
+
let prompt = this.activeUIPrompt;
|
|
8676
|
+
if (!prompt) {
|
|
8677
|
+
prompt = { depth: 0, kind, title };
|
|
8678
|
+
this.activeUIPrompt = prompt;
|
|
8679
|
+
this.emitUIPromptEvent({
|
|
8680
|
+
type: "ui_prompt_start",
|
|
8681
|
+
reason: "ui_prompt",
|
|
8682
|
+
kind,
|
|
8683
|
+
...title === undefined ? {} : { title }
|
|
8684
|
+
});
|
|
8685
|
+
}
|
|
8686
|
+
prompt.depth += 1;
|
|
8687
|
+
let finished = false;
|
|
8688
|
+
const finish = () => {
|
|
8689
|
+
if (finished)
|
|
8690
|
+
return;
|
|
8691
|
+
finished = true;
|
|
8692
|
+
if (this.activeUIPrompt !== prompt)
|
|
8693
|
+
return;
|
|
8694
|
+
prompt.depth -= 1;
|
|
8695
|
+
if (prompt.depth === 0)
|
|
8696
|
+
this.endActiveUIPrompt(prompt);
|
|
8697
|
+
};
|
|
8698
|
+
try {
|
|
8699
|
+
return run().finally(finish);
|
|
8700
|
+
} catch (error) {
|
|
8701
|
+
finish();
|
|
8702
|
+
throw error;
|
|
8703
|
+
}
|
|
8704
|
+
}
|
|
8705
|
+
endActiveUIPrompt(prompt = this.activeUIPrompt) {
|
|
8706
|
+
if (!prompt || this.activeUIPrompt !== prompt)
|
|
8707
|
+
return;
|
|
8708
|
+
this.activeUIPrompt = undefined;
|
|
8709
|
+
prompt.depth = 0;
|
|
8710
|
+
this.emitUIPromptEvent({
|
|
8711
|
+
type: "ui_prompt_end",
|
|
8712
|
+
reason: "ui_prompt",
|
|
8713
|
+
kind: prompt.kind,
|
|
8714
|
+
...prompt.title === undefined ? {} : { title: prompt.title }
|
|
8715
|
+
});
|
|
8716
|
+
}
|
|
8717
|
+
emitUIPromptEvent(event) {
|
|
8718
|
+
queueMicrotask(() => {
|
|
8719
|
+
this.emit(event);
|
|
8720
|
+
});
|
|
8721
|
+
}
|
|
8658
8722
|
getUIContext() {
|
|
8659
8723
|
return this.uiContext;
|
|
8660
8724
|
}
|
|
@@ -14311,7 +14375,7 @@ async function loadVirtualModules() {
|
|
|
14311
14375
|
import("@bastani/pi-ai/oauth"),
|
|
14312
14376
|
import("@bastani/pi-ai/api/cloudflare-gateway-binding"),
|
|
14313
14377
|
import("proper-lockfile"),
|
|
14314
|
-
import("./chunk-
|
|
14378
|
+
import("./chunk-8v8wmb7z.js")
|
|
14315
14379
|
]);
|
|
14316
14380
|
return {
|
|
14317
14381
|
typebox,
|
|
@@ -58628,7 +58692,7 @@ InteractiveModeBase.prototype.setupExtensionShortcuts = function(extensionRunner
|
|
|
58628
58692
|
if (shortcuts.size === 0)
|
|
58629
58693
|
return;
|
|
58630
58694
|
const createContext = () => ({
|
|
58631
|
-
ui:
|
|
58695
|
+
ui: extensionRunner.getUIContext(),
|
|
58632
58696
|
mode: "tui",
|
|
58633
58697
|
hasUI: true,
|
|
58634
58698
|
cwd: this.sessionManager.getCwd(),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
goal_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import"./chunk-
|
|
3
|
+
} from "./chunk-qe6bfpbd.js";
|
|
4
|
+
import"./chunk-rbnj9621.js";
|
|
5
5
|
import"./chunk-7at6dnkr.js";
|
|
6
6
|
import"./chunk-7430zyas.js";
|
|
7
7
|
import"./chunk-6fqs7c01.js";
|
|
8
8
|
import"./chunk-cg9tmks0.js";
|
|
9
|
-
import"./chunk-
|
|
9
|
+
import"./chunk-17zk6ffd.js";
|
|
10
10
|
import"./chunk-x2ghn0je.js";
|
|
11
11
|
import"./chunk-bfkmzv9h.js";
|
|
12
12
|
import"./chunk-0x6e303p.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ralph_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-h5e65g7g.js";
|
|
4
4
|
import {
|
|
5
5
|
tournament_default
|
|
6
6
|
} from "./chunk-2dqb5s2q.js";
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
} from "./chunk-hzzn6adg.js";
|
|
19
19
|
import {
|
|
20
20
|
goal_default
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import"./chunk-
|
|
21
|
+
} from "./chunk-qe6bfpbd.js";
|
|
22
|
+
import"./chunk-rbnj9621.js";
|
|
23
23
|
import"./chunk-7at6dnkr.js";
|
|
24
24
|
import"./chunk-7430zyas.js";
|
|
25
25
|
import {
|
|
@@ -31,7 +31,7 @@ import"./chunk-cg9tmks0.js";
|
|
|
31
31
|
import {
|
|
32
32
|
open_claude_design_default
|
|
33
33
|
} from "./chunk-nqr34qp3.js";
|
|
34
|
-
import"./chunk-
|
|
34
|
+
import"./chunk-17zk6ffd.js";
|
|
35
35
|
import"./chunk-x2ghn0je.js";
|
|
36
36
|
import"./chunk-bfkmzv9h.js";
|
|
37
37
|
import"./chunk-0x6e303p.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ralph_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import"./chunk-
|
|
3
|
+
} from "./chunk-h5e65g7g.js";
|
|
4
|
+
import"./chunk-rbnj9621.js";
|
|
5
5
|
import"./chunk-7at6dnkr.js";
|
|
6
6
|
import"./chunk-7430zyas.js";
|
|
7
7
|
import"./chunk-6fqs7c01.js";
|
|
8
8
|
import"./chunk-cg9tmks0.js";
|
|
9
|
-
import"./chunk-
|
|
9
|
+
import"./chunk-17zk6ffd.js";
|
|
10
10
|
import"./chunk-x2ghn0je.js";
|
|
11
11
|
import"./chunk-bfkmzv9h.js";
|
|
12
12
|
import"./chunk-0x6e303p.js";
|