History

show tasks that were run

Rhys Sullivan committed 9 months ago

Commit b3ff5f51 parent 1dd6c598 files · +120 −7Browse files

Unified · Split

8 files
  1. executor/apps/web/src/components/app-shell.tsx +2 −1
  2. executor/apps/web/src/frontend/app.tsx +2 −1
  3. executor/packages/core/src/tool-discovery.test.ts +19 −2
  4. executor/packages/core/src/tool-discovery.ts +9 −2
  5. executor/packages/core/src/tool-discovery/formatting.ts +11 −0
  6. executor/packages/core/src/tool-discovery/indexing.ts +14 −1
  7. executor/packages/core/src/tool-discovery/types.ts +2 −0
  8. executor/packages/core/src/type-hints.ts +61 −0
executor/apps/web/src/components/app-shell.tsx+2−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22
33 import { Suspense, useEffect, useState } from "react";
44 import { Link, useLocation, useNavigate } from "react-router";
5−import { ExternalLink, Github, LayoutDashboard, ShieldCheck, Wrench, Menu, X } from "lucide-react";
5+import { ExternalLink, Github, LayoutDashboard, ListTodo, ShieldCheck, Wrench, Menu, X } from "lucide-react";
66 import { Button } from "@/components/ui/button";
77 import { Sheet, SheetContent, SheetTrigger, SheetTitle } from "@/components/ui/sheet";
88 import { useSession } from "@/lib/session-context";
@@ -15,6 +15,7 @@ import { cn } from "@/lib/utils"; · 6 unmodified lines
1515
1616 const NAV_ITEMS = [
1717 { href: "/", label: "Home", icon: LayoutDashboard },
18+ { href: "/tasks", label: "Tasks", icon: ListTodo },
1819 { href: "/approvals", label: "Approvals", icon: ShieldCheck },
1920 { href: "/tools", label: "Tools", icon: Wrench },
2021 ];
executor/apps/web/src/frontend/app.tsx+2−1
@@ -7,6 +7,7 @@ import { DashboardView } from "@/components/dashboard/view"; · 6 unmodified lines
77 import { MenubarMvpView } from "@/components/menubar/mvp-view";
88 import { OnboardingView } from "@/components/organization/onboarding-view";
99 import { OrganizationSettingsView } from "@/components/organization/organization-settings-view";
10+import { TasksView } from "@/components/tasks/tasks-view";
1011 import { ToolsView } from "@/components/tools/view";
1112
1213 function ToolsRoute() {
@@ -37,7 +38,7 @@ export default function FrontendApp() { · 24 unmodified lines
3738 <Route element={<ShellLayout />}>
3839 <Route path="/" element={<DashboardView />} />
3940 <Route path="/static-app-shell" element={<DashboardView />} />
40− <Route path="/tasks" element={<Navigate to="/tools?tab=editor" replace />} />
41+ <Route path="/tasks" element={<TasksView />} />
4142 <Route path="/approvals" element={<ApprovalsView />} />
4243 <Route path="/tools" element={<ToolsRoute />} />
4344 <Route path="/organization" element={<OrganizationSettingsView />} />
executor/packages/core/src/tool-discovery.test.ts+19−2
@@ -30,6 +30,8 @@ test("discover returns aliases and example calls", async () => { · 29 unmodified lines
3030 aliases: string[];
3131 exampleCall: string;
3232 signature: string;
33+ canonicalSignature: string;
34+ expandedShape: { input: string; output: string };
3335 }>;
3436 total: number;
3537 };
@@ -41,6 +43,9 @@ test("discover returns aliases and example calls", async () => { · 5 unmodified lines
4143 expect(result.results[0]?.aliases).toContain("calc.math.addnumbers");
4244 expect(result.results[0]?.exampleCall).toBe("await tools.calc.math.add_numbers({ a: ..., b: ... });");
4345 expect(result.results[0]?.signature).toContain("Promise<{ sum: number }>");
46+ expect(result.results[0]?.canonicalSignature).toContain("Promise<{ sum: number }>");
47+ expect(result.results[0]?.expandedShape.input).toContain("a:");
48+ expect(result.results[0]?.expandedShape.output).toContain("sum");
4449 });
4550
4651 test("discover example call handles input-shaped args", async () => {
@@ -92,7 +97,12 @@ test("discover uses compact signatures by default and allows full mode", async ( · 45 unmodified lines
9297 { taskId: "t", workspaceId: TEST_WORKSPACE_ID, isToolAllowed: () => true },
9398 ) as {
9499 bestPath: string | null;
95− results: Array<{ description: string; signature: string }>;
100+ results: Array<{
101+ description: string;
102+ signature: string;
103+ canonicalSignature: string;
104+ expandedShape: { input: string; output: string };
105+ }>;
96106 };
97107
98108 const fullResult = await tool.run(
@@ -100,12 +110,19 @@ test("discover uses compact signatures by default and allows full mode", async ( · 1 unmodified line
100110 { taskId: "t", workspaceId: TEST_WORKSPACE_ID, isToolAllowed: () => true },
101111 ) as {
102112 bestPath: string | null;
103− results: Array<{ description: string; signature: string }>;
113+ results: Array<{
114+ description: string;
115+ signature: string;
116+ canonicalSignature: string;
117+ expandedShape: { input: string; output: string };
118+ }>;
104119 };
105120
106121 expect(compactResult.bestPath).toBe("linear.query.teams");
107122 expect(fullResult.bestPath).toBe("linear.query.teams");
108123 expect(compactResult.results[0]?.signature).toContain("Promise<{ data: ...; errors: unknown[] }>");
124+ expect(compactResult.results[0]?.canonicalSignature).toContain("TeamConnection");
125+ expect(compactResult.results[0]?.expandedShape.input).toContain("filter");
109126 expect(compactResult.results[0]?.description).not.toContain("TRAILING_MARKER_TEXT");
110127
111128 expect(fullResult.results[0]?.signature).toContain("TeamFilter");
executor/packages/core/src/tool-discovery.ts+9−2
@@ -2,7 +2,12 @@ import type { ToolDefinition } from "./types"; · 1 unmodified line
22 import {
33 compactDescriptionLine,
44 } from "./type-hints";
5−import { buildExampleCall, formatSignature } from "./tool-discovery/formatting";
5+import {
6+ buildExampleCall,
7+ buildExpandedShape,
8+ formatCanonicalSignature,
9+ formatSignature,
10+} from "./tool-discovery/formatting";
611 import { buildIndex, getTopLevelNamespace, listIndexForContext } from "./tool-discovery/indexing";
712 import { chooseBestPath, deriveIntentPhrase, extractNamespaceHints, scoreEntry } from "./tool-discovery/ranking";
813
@@ -119,7 +124,7 @@ export function createDiscoverTool(tools: ToolDefinition[]): ToolDefinition { · 110 unmodified lines
119124 metadata: {
120125 argsType: "{ query: string; depth?: number; limit?: number; compact?: boolean }",
121126 returnsType:
122− "{ bestPath: string | null; results: Array<{ path: string; aliases: string[]; source: string; approval: 'auto' | 'required'; description: string; signature: string; exampleCall: string }>; total: number }",
127+ "{ bestPath: string | null; results: Array<{ path: string; aliases: string[]; source: string; approval: 'auto' | 'required'; description: string; signature: string; canonicalSignature: string; expandedShape: { input: string; output: string }; exampleCall: string }>; total: number }",
123128 },
124129 run: async (input: unknown, context) => {
125130 const payload = input && typeof input === "object" ? (input as Record<string, unknown>) : {};
@@ -151,6 +156,8 @@ export function createDiscoverTool(tools: ToolDefinition[]): ToolDefinition { · 25 unmodified lines
151156 approval: entry.approval,
152157 description: compact ? compactDescriptionLine(entry.description) : entry.description,
153158 signature: formatSignature(entry, depth, compact),
159+ canonicalSignature: formatCanonicalSignature(entry),
160+ expandedShape: buildExpandedShape(entry),
154161 exampleCall: buildExampleCall(entry),
155162 }));
156163
executor/packages/core/src/tool-discovery/formatting.ts+11−0
@@ -52,3 +52,14 @@ export function formatSignature(entry: DiscoverIndexEntry, depth: number, compac · 51 unmodified lines
5252
5353 return `(input: ${entry.argsType}): Promise<${entry.returnsType}> [source=${entry.source}]`;
5454 }
55+
56+export function formatCanonicalSignature(entry: DiscoverIndexEntry): string {
57+ return `(input: ${entry.argsType}): Promise<${entry.returnsType}>`;
58+}
59+
60+export function buildExpandedShape(entry: DiscoverIndexEntry): { input: string; output: string } {
61+ return {
62+ input: entry.expandedArgsShape,
63+ output: entry.expandedReturnsShape,
64+ };
65+}
executor/packages/core/src/tool-discovery/indexing.ts+14−1
@@ -1,5 +1,10 @@
11 import type { ToolDefinition } from "../types";
2−import { compactArgDisplayHint, compactReturnTypeHint } from "../type-hints";
2+import {
3+ compactArgDisplayHint,
4+ compactReturnTypeHint,
5+ llmExpandedArgShapeHint,
6+ llmExpandedReturnShapeHint,
7+} from "../type-hints";
38 import type { DiscoverIndexEntry } from "./types";
49
510 const GENERIC_NAMESPACE_SUFFIXES = new Set([
@@ -107,6 +112,12 @@ export function buildIndex(tools: ToolDefinition[]): DiscoverIndexEntry[] { · 101 unmodified lines
107112 tool.metadata?.displayReturnsType
108113 ?? compactReturnTypeHint(returnsType),
109114 );
115+ const expandedArgsShape = normalizeType(
116+ llmExpandedArgShapeHint(argsType, argPreviewKeys),
117+ );
118+ const expandedReturnsShape = normalizeType(
119+ llmExpandedReturnShapeHint(returnsType),
120+ );
110121
111122 return {
112123 path: tool.path,
@@ -119,6 +130,8 @@ export function buildIndex(tools: ToolDefinition[]): DiscoverIndexEntry[] { · 6 unmodified lines
119130 returnsType,
120131 displayArgsType,
121132 displayReturnsType,
133+ expandedArgsShape,
134+ expandedReturnsShape,
122135 argPreviewKeys,
123136 searchText,
124137 normalizedPath: normalizeSearchToken(tool.path),
executor/packages/core/src/tool-discovery/types.ts+2−0
@@ -11,6 +11,8 @@ export interface DiscoverIndexEntry { · 10 unmodified lines
1111 returnsType: string;
1212 displayArgsType: string;
1313 displayReturnsType: string;
14+ expandedArgsShape: string;
15+ expandedReturnsShape: string;
1416 argPreviewKeys: string[];
1517 searchText: string;
1618 normalizedPath: string;
executor/packages/core/src/type-hints.ts+61−0
@@ -43,6 +43,16 @@ function splitTopLevelBy(value: string, separator: string): string[] { · 42 unmodified lines
4343 return parts;
4444 }
4545
46+function dedupeStrings(values: string[]): string[] {
47+ const unique: string[] = [];
48+ for (const value of values) {
49+ const trimmed = value.trim();
50+ if (!trimmed) continue;
51+ if (!unique.includes(trimmed)) unique.push(trimmed);
52+ }
53+ return unique;
54+}
55+
4656 function normalizeSimpleUnion(typeExpression: string): string {
4757 const parts = splitTopLevelBy(typeExpression, "|")
4858 .map((part) => part.trim())
@@ -178,6 +188,21 @@ export function extractTopLevelTypeKeys(typeHint: string): string[] { · 129 unmodified lines
178188 return keys;
179189 }
180190
191+export function extractTopLevelTypeKeysFromExpression(typeHint: string): string[] {
192+ const direct = extractTopLevelTypeKeys(typeHint);
193+ if (direct.length > 0) return direct;
194+
195+ const fromIntersections = splitTopLevelBy(typeHint, "&")
196+ .flatMap((part) => extractTopLevelTypeKeys(part));
197+ if (fromIntersections.length > 0) {
198+ return dedupeStrings(fromIntersections);
199+ }
200+
201+ const fromUnions = splitTopLevelBy(typeHint, "|")
202+ .flatMap((part) => extractTopLevelTypeKeys(part));
203+ return dedupeStrings(fromUnions);
204+}
205+
181206 export function compactArgKeysHint(keys: string[]): string {
182207 const normalized = keys
183208 .map((key) => key.trim())
@@ -272,6 +297,42 @@ export function compactReturnTypeHint(returnsType: string): string { · 88 unmodified lines
272297 return truncateInline(normalized, 130);
273298 }
274299
300+export function llmExpandedArgShapeHint(argsType: string, argPreviewKeys: string[] = []): string {
301+ const normalized = argsType.replace(/\s+/g, " ").trim();
302+ if (!normalized || normalized === "{}") return "{}";
303+
304+ const simpleInline = normalized.length <= 480 && !normalized.includes('components["schemas"]');
305+ if (simpleInline) return normalized;
306+
307+ const keys = dedupeStrings(argPreviewKeys.length > 0
308+ ? argPreviewKeys
309+ : extractTopLevelTypeKeysFromExpression(argsType));
310+ if (keys.length > 0) {
311+ const shown = keys.slice(0, 12).map((key) => `${key}: ...`);
312+ const suffix = keys.length > 12 ? "; ..." : "";
313+ return `{ ${shown.join("; ")}${suffix} }`;
314+ }
315+
316+ return truncateInline(normalized, 260);
317+}
318+
319+export function llmExpandedReturnShapeHint(returnsType: string): string {
320+ const normalized = returnsType.replace(/\s+/g, " ").trim();
321+ if (!normalized) return "unknown";
322+
323+ const simpleInline = normalized.length <= 560 && !normalized.includes('components["schemas"]');
324+ if (simpleInline) return normalized;
325+
326+ const keys = extractTopLevelTypeKeysFromExpression(returnsType);
327+ if (keys.length > 0) {
328+ const shown = keys.slice(0, 12).map((key) => `${key}: ...`);
329+ const suffix = keys.length > 12 ? "; ..." : "";
330+ return `{ ${shown.join("; ")}${suffix} }`;
331+ }
332+
333+ return truncateInline(normalized, 280);
334+}
335+
275336 export function compactDescriptionLine(description: string): string {
276337 const firstLine = description.split("\n")[0] ?? description;
277338 return truncateInline(firstLine, 180);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t