@greppleai/grip 0.1.3 → 0.1.4
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 +21 -0
- package/dist/core/extensions/types.d.ts +5 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +2 -3
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +2 -3
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +2 -3
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +3 -3
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +1 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +5 -0
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +2 -3
- package/dist/core/tools/write.js.map +1 -1
- package/dist/modes/interactive/components/hook-execution.d.ts +3 -0
- package/dist/modes/interactive/components/hook-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/hook-execution.js +17 -0
- package/dist/modes/interactive/components/hook-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +51 -3
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/extensions.md +3 -0
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
|
@@ -271,6 +271,7 @@ export class InteractiveMode {
|
|
|
271
271
|
hookExecutionSession;
|
|
272
272
|
hookExecutionNotices = [];
|
|
273
273
|
hookExecutionComponents = [];
|
|
274
|
+
pendingStopHookNotifications = [];
|
|
274
275
|
activeToolHookExecutionGroups = new Map();
|
|
275
276
|
hookExecutionTurnActive = false;
|
|
276
277
|
signalCleanupHandlers = [];
|
|
@@ -520,7 +521,41 @@ export class InteractiveMode {
|
|
|
520
521
|
});
|
|
521
522
|
}
|
|
522
523
|
}
|
|
523
|
-
|
|
524
|
+
const base = new CombinedAutocompleteProvider([...slashCommands, ...templateCommands, ...extensionCommands, ...skillCommandList, ...ruleCommandList], this.activeSession.getCwd(), this.fdPath);
|
|
525
|
+
const provider = {
|
|
526
|
+
getSuggestions: async (lines, cursorLine, cursorCol, options) => {
|
|
527
|
+
const beforeCursor = (lines[cursorLine] ?? "").slice(0, cursorCol);
|
|
528
|
+
const nameMatch = beforeCursor.match(/^\/sandbox[ \t]+(start[ \t]+--name(?:[ \t]+([^\s]*))?)$/);
|
|
529
|
+
if (!options.force || !nameMatch)
|
|
530
|
+
return base.getSuggestions(lines, cursorLine, cursorCol, options);
|
|
531
|
+
if (options.signal.aborted)
|
|
532
|
+
return null;
|
|
533
|
+
try {
|
|
534
|
+
const instances = await this.createLimaSandboxService().list({
|
|
535
|
+
workspaceRoot: this.activeSession.getCwd(),
|
|
536
|
+
allWorkspaces: true,
|
|
537
|
+
});
|
|
538
|
+
if (options.signal.aborted)
|
|
539
|
+
return null;
|
|
540
|
+
const prefix = nameMatch[2] ?? "";
|
|
541
|
+
const items = instances
|
|
542
|
+
.filter((instance) => /^[a-z0-9][a-z0-9-]*$/.test(instance.name) && instance.name.startsWith(prefix))
|
|
543
|
+
.map((instance) => ({
|
|
544
|
+
value: `start --name ${instance.name}`,
|
|
545
|
+
label: instance.name,
|
|
546
|
+
description: instance.status,
|
|
547
|
+
}));
|
|
548
|
+
return items.length > 0 ? { items, prefix: nameMatch[1] } : null;
|
|
549
|
+
}
|
|
550
|
+
catch {
|
|
551
|
+
// A failed Lima lookup must not fall back to directory suggestions.
|
|
552
|
+
return null;
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
applyCompletion: (lines, cursorLine, cursorCol, item, prefix) => base.applyCompletion(lines, cursorLine, cursorCol, item, prefix),
|
|
556
|
+
shouldTriggerFileCompletion: (lines, cursorLine, cursorCol) => base.shouldTriggerFileCompletion(lines, cursorLine, cursorCol),
|
|
557
|
+
};
|
|
558
|
+
return provider;
|
|
524
559
|
}
|
|
525
560
|
setupAutocompleteProvider() {
|
|
526
561
|
let provider = this.createBaseAutocompleteProvider();
|
|
@@ -1919,7 +1954,7 @@ export class InteractiveMode {
|
|
|
1919
1954
|
select: (title, options, opts) => this.showExtensionSelector(title, options, opts),
|
|
1920
1955
|
confirm: (title, message, opts) => this.showExtensionConfirm(title, message, opts),
|
|
1921
1956
|
input: (title, placeholder, opts) => this.showExtensionInput(title, placeholder, opts),
|
|
1922
|
-
notify: (message, type) => this.showExtensionNotify(message, type),
|
|
1957
|
+
notify: (message, type, options) => this.showExtensionNotify(message, type, options),
|
|
1923
1958
|
onTerminalInput: (handler) => this.addExtensionTerminalInputListener(handler),
|
|
1924
1959
|
setStatus: (key, text) => this.setExtensionStatus(key, text),
|
|
1925
1960
|
setWorkingMessage: (message) => {
|
|
@@ -2149,7 +2184,11 @@ export class InteractiveMode {
|
|
|
2149
2184
|
/**
|
|
2150
2185
|
* Show a notification for extensions.
|
|
2151
2186
|
*/
|
|
2152
|
-
showExtensionNotify(message, type) {
|
|
2187
|
+
showExtensionNotify(message, type, options) {
|
|
2188
|
+
if (options?.hookEvent === "Stop") {
|
|
2189
|
+
this.pendingStopHookNotifications.push({ message, type });
|
|
2190
|
+
return;
|
|
2191
|
+
}
|
|
2153
2192
|
if (type === "error") {
|
|
2154
2193
|
this.showError(message);
|
|
2155
2194
|
}
|
|
@@ -2684,6 +2723,11 @@ export class InteractiveMode {
|
|
|
2684
2723
|
const group = [notice];
|
|
2685
2724
|
this.hookExecutionNotices.push(group);
|
|
2686
2725
|
const component = new HookExecutionComponent(notice, this.getMarkdownThemeWithSettings());
|
|
2726
|
+
if (notice.event === "Stop") {
|
|
2727
|
+
for (const notification of this.pendingStopHookNotifications)
|
|
2728
|
+
component.appendAnnotation(notification.message);
|
|
2729
|
+
this.pendingStopHookNotifications = [];
|
|
2730
|
+
}
|
|
2687
2731
|
component.setExpanded(this.toolOutputExpanded);
|
|
2688
2732
|
this.hookExecutionComponents.push(component);
|
|
2689
2733
|
this.chatContainer.addChild(component);
|
|
@@ -3069,6 +3113,10 @@ export class InteractiveMode {
|
|
|
3069
3113
|
this.handleAgentEnd();
|
|
3070
3114
|
break;
|
|
3071
3115
|
case "agent_settled":
|
|
3116
|
+
for (const notification of this.pendingStopHookNotifications) {
|
|
3117
|
+
this.showExtensionNotify(notification.message, notification.type);
|
|
3118
|
+
}
|
|
3119
|
+
this.pendingStopHookNotifications = [];
|
|
3072
3120
|
await this.checkShutdownRequested();
|
|
3073
3121
|
this.ui.requestRender();
|
|
3074
3122
|
break;
|