@hienlh/ppm 0.13.75 → 0.13.77

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/assets/skills/ppm/SKILL.md +1 -1
  3. package/assets/skills/ppm/references/http-api.md +1 -1
  4. package/dist/web/assets/{audio-preview-BQUzmaMW.js → audio-preview-CAkLsTgJ.js} +1 -1
  5. package/dist/web/assets/{chat-tab-B80a21gx.js → chat-tab-DNSelhRT.js} +5 -5
  6. package/dist/web/assets/{code-editor-hFO6vAKT.js → code-editor-ClG-6IDZ.js} +2 -2
  7. package/dist/web/assets/{conflict-editor-CrpXDFE1.js → conflict-editor-CcmoCxAD.js} +1 -1
  8. package/dist/web/assets/{database-viewer-CAjJc7bL.js → database-viewer-C57quEhw.js} +1 -1
  9. package/dist/web/assets/{diff-viewer-CdZ15fOk.js → diff-viewer-1ETGHhmC.js} +1 -1
  10. package/dist/web/assets/{docx-preview-AgoO5zwo.js → docx-preview-CSIdvMph.js} +1 -1
  11. package/dist/web/assets/{extension-webview-C4D4PnO3.js → extension-webview-DyapNP2E.js} +1 -1
  12. package/dist/web/assets/{git-log-panel-J0pVWvZl.js → git-log-panel-BSNVzOrq.js} +1 -1
  13. package/dist/web/assets/glide-data-grid-CZVrZJpS.js +138 -0
  14. package/dist/web/assets/{image-preview-CyL9Lj_O.js → image-preview-DprBBsHy.js} +1 -1
  15. package/dist/web/assets/{index-Dd6YEaE6.js → index-BlRGbnAE.js} +3 -3
  16. package/dist/web/assets/keybindings-store-CqcGrKcu.js +1 -0
  17. package/dist/web/assets/{markdown-renderer-Cat4uT8B.js → markdown-renderer-pJFF8cN8.js} +1 -1
  18. package/dist/web/assets/notification-store-DQprLwk6.js +1 -0
  19. package/dist/web/assets/{pdf-preview-BSrz_N0g.js → pdf-preview-D4iOenvs.js} +1 -1
  20. package/dist/web/assets/{port-forwarding-tab-BpeFzbAM.js → port-forwarding-tab-Hkq3Oj4T.js} +1 -1
  21. package/dist/web/assets/{postgres-viewer-GpXLzmnT.js → postgres-viewer-BG4CkX-_.js} +1 -1
  22. package/dist/web/assets/{settings-tab-Cjiu2egJ.js → settings-tab-Dwcs9hK5.js} +1 -1
  23. package/dist/web/assets/sql-query-editor-DRON0V_j.js +1 -0
  24. package/dist/web/assets/{sqlite-viewer-ONh1tmxh.js → sqlite-viewer-BabBjC5D.js} +1 -1
  25. package/dist/web/assets/{system-monitor-tab-BznIBj8p.js → system-monitor-tab-9fc9tob6.js} +1 -1
  26. package/dist/web/assets/{terminal-tab-D2OwQv1h.js → terminal-tab-c-SljqL9.js} +1 -1
  27. package/dist/web/assets/{video-preview-49zZk7VQ.js → video-preview-C8lRIJQT.js} +1 -1
  28. package/dist/web/index.html +1 -1
  29. package/dist/web/sw.js +1 -1
  30. package/package.json +1 -1
  31. package/src/providers/claude-agent-sdk.ts +6 -2
  32. package/src/server/routes/chat.ts +7 -6
  33. package/src/web/components/chat/chat-tab.tsx +10 -0
  34. package/src/web/components/database/sql-completion-provider.ts +28 -1
  35. package/src/web/components/database/sql-query-editor.tsx +1 -30
  36. package/dist/web/assets/glide-data-grid-BfXnM2CC.js +0 -136
  37. package/dist/web/assets/keybindings-store-C1yHwKEc.js +0 -1
  38. package/dist/web/assets/notification-store-CBTVrgEf.js +0 -1
  39. package/dist/web/assets/sql-query-editor-PFN7evxv.js +0 -3
@@ -22,6 +22,32 @@ export const AGGREGATE_FNS = ["COUNT", "SUM", "AVG", "MIN", "MAX"];
22
22
  export const OPERATORS = ["=", "!=", "<>", ">", "<", ">=", "<=", "LIKE", "ILIKE", "IN", "NOT IN", "BETWEEN", "IS NULL", "IS NOT NULL"];
23
23
  export const SORT_DIRS = ["ASC", "DESC"];
24
24
 
25
+ /** Find the SQL statement surrounding the cursor line (split by ;) */
26
+ export function getStatementAtCursor(text: string, cursorLine: number): string {
27
+ const lines = text.split("\n");
28
+ let stmtStart = 0;
29
+ for (let i = 0; i < lines.length; i++) {
30
+ const trimmed = lines[i]!.trim();
31
+ if (i < cursorLine - 1 && trimmed.endsWith(";")) {
32
+ stmtStart = i + 1;
33
+ }
34
+ }
35
+ let stmtEnd = lines.length - 1;
36
+ for (let i = cursorLine - 1; i < lines.length; i++) {
37
+ const trimmed = lines[i]!.trim();
38
+ if (trimmed.endsWith(";")) {
39
+ stmtEnd = i;
40
+ break;
41
+ }
42
+ }
43
+ while (stmtStart <= stmtEnd) {
44
+ const t = lines[stmtStart]!.trim();
45
+ if (t && !t.startsWith("--")) break;
46
+ stmtStart++;
47
+ }
48
+ return lines.slice(stmtStart, stmtEnd + 1).join("\n").trim();
49
+ }
50
+
25
51
  /** Client-side column cache to avoid redundant fetches */
26
52
  const columnCache = new Map<string, { name: string; type: string }[]>();
27
53
 
@@ -153,7 +179,8 @@ export function createSqlCompletionProvider(
153
179
  startColumn: word.startColumn, endColumn: word.endColumn,
154
180
  };
155
181
  const fullText = model.getValue();
156
- const { tableRefs, aliasMap } = extractTableRefs(fullText);
182
+ const currentStmt = getStatementAtCursor(fullText, position.lineNumber);
183
+ const { tableRefs, aliasMap } = extractTableRefs(currentStmt);
157
184
  const suggestions: MonacoType.languages.CompletionItem[] = [];
158
185
  const ctx = getCompletionContext(textUntilPosition);
159
186
 
@@ -2,7 +2,7 @@ import { useState, useCallback, useRef, useEffect } from "react";
2
2
  import Editor, { type OnMount } from "@monaco-editor/react";
3
3
  import type * as MonacoType from "monaco-editor";
4
4
  import { useMonacoTheme } from "@/lib/use-monaco-theme";
5
- import { createSqlCompletionProvider, clearCompletionCache, type SchemaInfo } from "./sql-completion-provider";
5
+ import { createSqlCompletionProvider, clearCompletionCache, getStatementAtCursor, type SchemaInfo } from "./sql-completion-provider";
6
6
 
7
7
  interface SqlQueryEditorProps {
8
8
  onExecute: (sql: string) => void;
@@ -15,35 +15,6 @@ interface SqlQueryEditorProps {
15
15
  persistedSql?: string;
16
16
  }
17
17
 
18
- /** Find the SQL statement surrounding the cursor line (split by ;) */
19
- export function getStatementAtCursor(text: string, cursorLine: number): string {
20
- const lines = text.split("\n");
21
- // Find statement boundaries (lines where a statement ends with ;)
22
- let stmtStart = 0;
23
- for (let i = 0; i < lines.length; i++) {
24
- const trimmed = lines[i]!.trim();
25
- if (i < cursorLine - 1 && trimmed.endsWith(";")) {
26
- stmtStart = i + 1;
27
- }
28
- }
29
- // Find statement end
30
- let stmtEnd = lines.length - 1;
31
- for (let i = cursorLine - 1; i < lines.length; i++) {
32
- const trimmed = lines[i]!.trim();
33
- if (trimmed.endsWith(";")) {
34
- stmtEnd = i;
35
- break;
36
- }
37
- }
38
- // Skip leading empty/comment lines
39
- while (stmtStart <= stmtEnd) {
40
- const t = lines[stmtStart]!.trim();
41
- if (t && !t.startsWith("--")) break;
42
- stmtStart++;
43
- }
44
- return lines.slice(stmtStart, stmtEnd + 1).join("\n").trim();
45
- }
46
-
47
18
  /** Shared Monaco-based SQL query editor (editor only, no results) */
48
19
  export function SqlQueryEditor({ onExecute, loading, defaultValue = "SELECT * FROM ", schemaInfo, onSqlChange, persistedSql }: SqlQueryEditorProps) {
49
20
  const [query, setQuery] = useState(() => persistedSql ?? defaultValue);