context-mode 1.0.161 → 1.0.163

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 (153) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/.openclaw-plugin/openclaw.plugin.json +1 -1
  5. package/.openclaw-plugin/package.json +1 -1
  6. package/README.md +142 -28
  7. package/bin/statusline.mjs +24 -4
  8. package/build/adapters/antigravity/index.d.ts +1 -1
  9. package/build/adapters/antigravity-cli/index.d.ts +51 -0
  10. package/build/adapters/antigravity-cli/index.js +341 -0
  11. package/build/adapters/claude-code/hooks.d.ts +1 -0
  12. package/build/adapters/claude-code/hooks.js +3 -0
  13. package/build/adapters/claude-code/index.js +24 -5
  14. package/build/adapters/client-map.js +5 -0
  15. package/build/adapters/codex/hooks.d.ts +5 -1
  16. package/build/adapters/codex/hooks.js +5 -1
  17. package/build/adapters/codex/index.d.ts +9 -1
  18. package/build/adapters/codex/index.js +87 -5
  19. package/build/adapters/copilot-cli/hooks.d.ts +33 -0
  20. package/build/adapters/copilot-cli/hooks.js +64 -0
  21. package/build/adapters/copilot-cli/index.d.ts +48 -0
  22. package/build/adapters/copilot-cli/index.js +341 -0
  23. package/build/adapters/detect.d.ts +1 -1
  24. package/build/adapters/detect.js +71 -3
  25. package/build/adapters/openclaw/mcp-tools.js +1 -1
  26. package/build/adapters/opencode/index.js +31 -17
  27. package/build/adapters/opencode/zod3tov4.js +27 -6
  28. package/build/adapters/pi/extension.d.ts +2 -12
  29. package/build/adapters/pi/extension.js +114 -96
  30. package/build/adapters/types.d.ts +5 -4
  31. package/build/adapters/types.js +4 -3
  32. package/build/cache-heal.d.ts +48 -0
  33. package/build/cache-heal.js +150 -0
  34. package/build/cli.js +37 -97
  35. package/build/executor.d.ts +25 -0
  36. package/build/executor.js +143 -22
  37. package/build/opencode-plugin.js +5 -2
  38. package/build/routing-block.d.ts +8 -0
  39. package/build/routing-block.js +86 -0
  40. package/build/runtime.d.ts +0 -36
  41. package/build/runtime.js +107 -27
  42. package/build/search/flood-guard.d.ts +57 -0
  43. package/build/search/flood-guard.js +80 -0
  44. package/build/security.d.ts +8 -3
  45. package/build/security.js +155 -29
  46. package/build/server.d.ts +14 -0
  47. package/build/server.js +368 -350
  48. package/build/session/analytics.d.ts +8 -8
  49. package/build/session/analytics.js +18 -13
  50. package/build/session/db.d.ts +1 -0
  51. package/build/session/db.js +37 -4
  52. package/build/session/extract.d.ts +46 -0
  53. package/build/session/extract.js +764 -13
  54. package/build/session/project-attribution.js +14 -0
  55. package/build/store.d.ts +1 -1
  56. package/build/store.js +139 -25
  57. package/build/tool-naming.d.ts +4 -0
  58. package/build/tool-naming.js +24 -0
  59. package/build/util/jsonc.d.ts +14 -0
  60. package/build/util/jsonc.js +104 -0
  61. package/cli.bundle.mjs +260 -254
  62. package/configs/antigravity/GEMINI.md +2 -2
  63. package/configs/antigravity-cli/hooks/hooks.json +37 -0
  64. package/configs/antigravity-cli/hooks.json +37 -0
  65. package/configs/antigravity-cli/mcp_config.json +10 -0
  66. package/configs/antigravity-cli/plugin.json +14 -0
  67. package/configs/antigravity-cli/rules/context-mode.md +77 -0
  68. package/configs/antigravity-cli/skills/context-mode/SKILL.md +77 -0
  69. package/configs/claude-code/CLAUDE.md +2 -2
  70. package/configs/codex/AGENTS.md +2 -2
  71. package/configs/copilot-cli/.github/plugin/plugin.json +23 -0
  72. package/configs/copilot-cli/.mcp.json +12 -0
  73. package/configs/copilot-cli/README.md +47 -0
  74. package/configs/copilot-cli/hooks.json +41 -0
  75. package/configs/copilot-cli/skills/context-mode/SKILL.md +38 -0
  76. package/configs/gemini-cli/GEMINI.md +2 -2
  77. package/configs/jetbrains-copilot/copilot-instructions.md +2 -2
  78. package/configs/kilo/AGENTS.md +2 -2
  79. package/configs/kiro/KIRO.md +2 -2
  80. package/configs/omp/SYSTEM.md +2 -2
  81. package/configs/openclaw/AGENTS.md +2 -2
  82. package/configs/opencode/AGENTS.md +2 -2
  83. package/configs/qwen-code/QWEN.md +2 -2
  84. package/configs/vscode-copilot/copilot-instructions.md +2 -2
  85. package/configs/zed/AGENTS.md +2 -2
  86. package/hooks/antigravity-cli/payload.mjs +98 -0
  87. package/hooks/antigravity-cli/posttooluse.mjs +138 -0
  88. package/hooks/antigravity-cli/pretooluse.mjs +78 -0
  89. package/hooks/antigravity-cli/stop.mjs +58 -0
  90. package/hooks/codex/pretooluse.mjs +14 -4
  91. package/hooks/codex/stop.mjs +12 -4
  92. package/hooks/copilot-cli/posttooluse.mjs +79 -0
  93. package/hooks/copilot-cli/precompact.mjs +66 -0
  94. package/hooks/copilot-cli/pretooluse.mjs +41 -0
  95. package/hooks/copilot-cli/sessionstart.mjs +121 -0
  96. package/hooks/copilot-cli/stop.mjs +59 -0
  97. package/hooks/copilot-cli/userpromptsubmit.mjs +77 -0
  98. package/hooks/core/codex-caps.mjs +112 -0
  99. package/hooks/core/formatters.mjs +158 -7
  100. package/hooks/core/mcp-ready.mjs +37 -8
  101. package/hooks/core/routing.mjs +94 -8
  102. package/hooks/core/tool-naming.mjs +3 -0
  103. package/hooks/hooks.json +12 -1
  104. package/hooks/pretooluse.mjs +6 -2
  105. package/hooks/routing-block.mjs +2 -2
  106. package/hooks/security.bundle.mjs +2 -1
  107. package/hooks/session-db.bundle.mjs +11 -7
  108. package/hooks/session-directive.mjs +88 -20
  109. package/hooks/session-extract.bundle.mjs +2 -2
  110. package/hooks/session-helpers.mjs +21 -0
  111. package/hooks/session-loaders.mjs +8 -5
  112. package/hooks/sessionstart.mjs +53 -7
  113. package/hooks/stop.mjs +49 -0
  114. package/hooks/userpromptsubmit.mjs +9 -2
  115. package/openclaw.plugin.json +1 -1
  116. package/package.json +4 -10
  117. package/scripts/install-antigravity-cli-plugin.mjs +141 -0
  118. package/server.bundle.mjs +214 -205
  119. package/skills/ctx-insight/SKILL.md +12 -17
  120. package/build/util/db-lock.d.ts +0 -65
  121. package/build/util/db-lock.js +0 -166
  122. package/insight/index.html +0 -13
  123. package/insight/package.json +0 -55
  124. package/insight/server.mjs +0 -1265
  125. package/insight/src/components/analytics.tsx +0 -112
  126. package/insight/src/components/ui/badge.tsx +0 -52
  127. package/insight/src/components/ui/button.tsx +0 -58
  128. package/insight/src/components/ui/card.tsx +0 -103
  129. package/insight/src/components/ui/chart.tsx +0 -371
  130. package/insight/src/components/ui/collapsible.tsx +0 -19
  131. package/insight/src/components/ui/input.tsx +0 -20
  132. package/insight/src/components/ui/progress.tsx +0 -83
  133. package/insight/src/components/ui/scroll-area.tsx +0 -55
  134. package/insight/src/components/ui/separator.tsx +0 -23
  135. package/insight/src/components/ui/table.tsx +0 -114
  136. package/insight/src/components/ui/tabs.tsx +0 -82
  137. package/insight/src/components/ui/tooltip.tsx +0 -64
  138. package/insight/src/lib/api.ts +0 -144
  139. package/insight/src/lib/utils.ts +0 -6
  140. package/insight/src/main.tsx +0 -22
  141. package/insight/src/routeTree.gen.ts +0 -189
  142. package/insight/src/router.tsx +0 -19
  143. package/insight/src/routes/__root.tsx +0 -55
  144. package/insight/src/routes/enterprise.tsx +0 -316
  145. package/insight/src/routes/index.tsx +0 -1482
  146. package/insight/src/routes/knowledge.tsx +0 -221
  147. package/insight/src/routes/knowledge_.$dbHash.$sourceId.tsx +0 -137
  148. package/insight/src/routes/search.tsx +0 -97
  149. package/insight/src/routes/sessions.tsx +0 -179
  150. package/insight/src/routes/sessions_.$dbHash.$sessionId.tsx +0 -181
  151. package/insight/src/styles.css +0 -104
  152. package/insight/tsconfig.json +0 -29
  153. package/insight/vite.config.ts +0 -19
@@ -1,181 +0,0 @@
1
- import { createFileRoute, Link } from "@tanstack/react-router";
2
- import { useEffect, useState } from "react";
3
- import { api, type SessionEventData } from "@/lib/api";
4
- import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
5
- import { Badge } from "@/components/ui/badge";
6
- import { ScrollArea } from "@/components/ui/scroll-area";
7
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
8
- import { RatioBar, formatDuration, COLORS } from "@/components/analytics";
9
- import { ArrowLeft, ChevronDown, ChevronRight, Zap, Clock, Layers } from "lucide-react";
10
-
11
- export const Route = createFileRoute("/sessions_/$dbHash/$sessionId")({ component: EventView });
12
-
13
- function EventRow({ e }: { e: { id: number; type: string; priority: number; data: string | null; created_at: string | null } }) {
14
- const [expanded, setExpanded] = useState(false);
15
- const raw = e.data || "-";
16
- const truncated = raw.length > 100 ? raw.slice(0, 100) + "..." : raw;
17
- const needsExpand = raw.length > 100;
18
-
19
- return (
20
- <div
21
- className={`flex gap-3 py-2 border-b border-border/50 text-sm ${needsExpand ? "cursor-pointer hover:bg-accent/30" : ""}`}
22
- onClick={() => needsExpand && setExpanded(prev => !prev)}
23
- >
24
- <span className="text-xs text-muted-foreground font-mono whitespace-nowrap min-w-[130px]">
25
- {e.created_at || "-"}
26
- </span>
27
- <Badge variant={e.priority >= 3 ? "default" : "secondary"} className="text-[10px] shrink-0 h-5">
28
- {e.type}
29
- </Badge>
30
- <div className="flex-1 min-w-0">
31
- <span className={`text-xs ${expanded ? "whitespace-pre-wrap break-words" : "block truncate"} ${
32
- e.priority >= 4 ? "text-red-500 font-semibold" : e.priority >= 3 ? "text-amber-500" : "text-muted-foreground"
33
- }`}>
34
- {expanded ? raw : truncated}
35
- </span>
36
- </div>
37
- {needsExpand && (
38
- <span className="shrink-0 text-muted-foreground">
39
- {expanded ? <ChevronDown className="h-3 w-3" /> : <ChevronRight className="h-3 w-3" />}
40
- </span>
41
- )}
42
- </div>
43
- );
44
- }
45
-
46
- function EventView() {
47
- const { dbHash, sessionId } = Route.useParams();
48
- const [data, setData] = useState<SessionEventData | null>(null);
49
- const [loading, setLoading] = useState(true);
50
-
51
- useEffect(() => {
52
- api.events(dbHash, sessionId).then(d => { setData(d); setLoading(false); });
53
- }, [dbHash, sessionId]);
54
-
55
- if (loading || !data) return <p className="text-muted-foreground animate-pulse">Loading session...</p>;
56
-
57
- // Compute type counts
58
- const typeCounts: Record<string, number> = {};
59
- data.events.forEach(e => { typeCounts[e.type] = (typeCounts[e.type] || 0) + 1; });
60
- const typeEntries = Object.entries(typeCounts).sort((a, b) => b[1] - a[1]);
61
- const uniqueTypes = typeEntries.length;
62
-
63
- // Compute duration from first to last event
64
- let durationMin = 0;
65
- if (data.events.length >= 2) {
66
- const first = data.events[0]?.created_at;
67
- const last = data.events[data.events.length - 1]?.created_at;
68
- if (first && last) {
69
- const start = new Date(first).getTime();
70
- const end = new Date(last).getTime();
71
- if (!isNaN(start) && !isNaN(end) && end > start) {
72
- durationMin = (end - start) / 60000;
73
- }
74
- }
75
- }
76
-
77
- return (
78
- <div className="space-y-6">
79
- <Link to="/sessions" className="flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors">
80
- <ArrowLeft className="h-4 w-4" /> Back to Sessions
81
- </Link>
82
-
83
- <div className="flex items-center gap-3">
84
- <h2 className="text-2xl font-semibold">Session Detail</h2>
85
- {data.resume && <Badge variant="outline" className="text-emerald-500 border-emerald-500/30">Resume available</Badge>}
86
- </div>
87
-
88
- {/* KPI Strip */}
89
- <div className="grid grid-cols-3 gap-3">
90
- <Card>
91
- <CardHeader className="flex flex-row items-center justify-between pb-2">
92
- <CardTitle className="text-[10px] font-medium text-muted-foreground uppercase tracking-wider">Events</CardTitle>
93
- <Zap className="h-4 w-4 text-blue-500" />
94
- </CardHeader>
95
- <CardContent>
96
- <div className="text-2xl font-bold tabular-nums">{data.events.length}</div>
97
- <p className="text-[11px] text-muted-foreground mt-0.5">total in session</p>
98
- </CardContent>
99
- </Card>
100
- <Card>
101
- <CardHeader className="flex flex-row items-center justify-between pb-2">
102
- <CardTitle className="text-[10px] font-medium text-muted-foreground uppercase tracking-wider">Duration</CardTitle>
103
- <Clock className="h-4 w-4 text-purple-500" />
104
- </CardHeader>
105
- <CardContent>
106
- <div className="text-2xl font-bold tabular-nums">{formatDuration(durationMin)}</div>
107
- <p className="text-[11px] text-muted-foreground mt-0.5">first to last event</p>
108
- </CardContent>
109
- </Card>
110
- <Card>
111
- <CardHeader className="flex flex-row items-center justify-between pb-2">
112
- <CardTitle className="text-[10px] font-medium text-muted-foreground uppercase tracking-wider">Types</CardTitle>
113
- <Layers className="h-4 w-4 text-emerald-500" />
114
- </CardHeader>
115
- <CardContent>
116
- <div className="text-2xl font-bold tabular-nums">{uniqueTypes}</div>
117
- <p className="text-[11px] text-muted-foreground mt-0.5">unique event types</p>
118
- </CardContent>
119
- </Card>
120
- </div>
121
-
122
- {/* Event type breakdown as ratio bar */}
123
- {typeEntries.length > 0 && (
124
- <Card>
125
- <CardHeader>
126
- <CardTitle className="text-sm">Event Breakdown</CardTitle>
127
- </CardHeader>
128
- <CardContent>
129
- <RatioBar items={typeEntries.slice(0, 8).map(([ type, count ], i) => ({
130
- label: type, value: count, color: COLORS[i % COLORS.length],
131
- }))} />
132
- </CardContent>
133
- </Card>
134
- )}
135
-
136
- {/* Event type badges */}
137
- <div className="flex flex-wrap gap-1.5">
138
- {typeEntries.map(([type, count]) => (
139
- <Badge key={type} variant="secondary" className="text-[10px]">{type}: {count}</Badge>
140
- ))}
141
- </div>
142
-
143
- {/* Event list */}
144
- <Card>
145
- <CardContent className="pt-4">
146
- <ScrollArea className="h-[600px]">
147
- <div className="space-y-0">
148
- {data.events.map(e => (
149
- <EventRow key={e.id} e={e} />
150
- ))}
151
- </div>
152
- </ScrollArea>
153
- </CardContent>
154
- </Card>
155
-
156
- {data.resume?.snapshot && (
157
- <Collapsible>
158
- <Card>
159
- <CollapsibleTrigger className="w-full">
160
- <CardHeader className="flex flex-row items-center justify-between cursor-pointer hover:bg-accent/50 transition-colors">
161
- <CardTitle className="text-sm">
162
- Resume Snapshot ({data.resume.event_count} events, {data.resume.consumed ? "consumed" : "pending"})
163
- </CardTitle>
164
- <ChevronDown className="h-4 w-4 text-muted-foreground" />
165
- </CardHeader>
166
- </CollapsibleTrigger>
167
- <CollapsibleContent>
168
- <CardContent>
169
- <ScrollArea className="max-h-96">
170
- <pre className="text-xs text-muted-foreground whitespace-pre-wrap break-words font-mono">
171
- {data.resume.snapshot}
172
- </pre>
173
- </ScrollArea>
174
- </CardContent>
175
- </CollapsibleContent>
176
- </Card>
177
- </Collapsible>
178
- )}
179
- </div>
180
- );
181
- }
@@ -1,104 +0,0 @@
1
- @import "tailwindcss";
2
- @import "tw-animate-css";
3
- @import "shadcn/tailwind.css";
4
- @import "@fontsource-variable/geist";
5
-
6
- @custom-variant dark (&:is(.dark *));
7
-
8
- @theme inline {
9
- --font-heading: var(--font-sans);
10
- --font-sans: 'Geist Variable', sans-serif;
11
- --color-sidebar-ring: var(--sidebar-ring);
12
- --color-sidebar-border: var(--sidebar-border);
13
- --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
14
- --color-sidebar-accent: var(--sidebar-accent);
15
- --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
16
- --color-sidebar-primary: var(--sidebar-primary);
17
- --color-sidebar-foreground: var(--sidebar-foreground);
18
- --color-sidebar: var(--sidebar);
19
- --color-chart-5: var(--chart-5);
20
- --color-chart-4: var(--chart-4);
21
- --color-chart-3: var(--chart-3);
22
- --color-chart-2: var(--chart-2);
23
- --color-chart-1: var(--chart-1);
24
- --color-ring: var(--ring);
25
- --color-input: var(--input);
26
- --color-border: var(--border);
27
- --color-destructive: var(--destructive);
28
- --color-accent-foreground: var(--accent-foreground);
29
- --color-accent: var(--accent);
30
- --color-muted-foreground: var(--muted-foreground);
31
- --color-muted: var(--muted);
32
- --color-secondary-foreground: var(--secondary-foreground);
33
- --color-secondary: var(--secondary);
34
- --color-primary-foreground: var(--primary-foreground);
35
- --color-primary: var(--primary);
36
- --color-popover-foreground: var(--popover-foreground);
37
- --color-popover: var(--popover);
38
- --color-card-foreground: var(--card-foreground);
39
- --color-card: var(--card);
40
- --color-foreground: var(--foreground);
41
- --color-background: var(--background);
42
- --radius-sm: calc(var(--radius) * 0.6);
43
- --radius-md: calc(var(--radius) * 0.8);
44
- --radius-lg: var(--radius);
45
- --radius-xl: calc(var(--radius) * 1.4);
46
- --radius-2xl: calc(var(--radius) * 1.8);
47
- --radius-3xl: calc(var(--radius) * 2.2);
48
- --radius-4xl: calc(var(--radius) * 2.6);
49
- }
50
-
51
- :root {
52
- --background: oklch(1 0 0);
53
- --foreground: oklch(0.145 0 0);
54
- --card: oklch(1 0 0);
55
- --card-foreground: oklch(0.145 0 0);
56
- --popover: oklch(1 0 0);
57
- --popover-foreground: oklch(0.145 0 0);
58
- --primary: oklch(0.205 0 0);
59
- --primary-foreground: oklch(0.985 0 0);
60
- --secondary: oklch(0.97 0 0);
61
- --secondary-foreground: oklch(0.205 0 0);
62
- --muted: oklch(0.97 0 0);
63
- --muted-foreground: oklch(0.556 0 0);
64
- --accent: oklch(0.97 0 0);
65
- --accent-foreground: oklch(0.205 0 0);
66
- --destructive: oklch(0.577 0.245 27.325);
67
- --border: oklch(0.922 0 0);
68
- --input: oklch(0.922 0 0);
69
- --ring: oklch(0.708 0 0);
70
- --radius: 0.625rem;
71
- }
72
-
73
- .dark {
74
- --background: oklch(0.145 0 0);
75
- --foreground: oklch(0.985 0 0);
76
- --card: oklch(0.205 0 0);
77
- --card-foreground: oklch(0.985 0 0);
78
- --popover: oklch(0.205 0 0);
79
- --popover-foreground: oklch(0.985 0 0);
80
- --primary: oklch(0.922 0 0);
81
- --primary-foreground: oklch(0.205 0 0);
82
- --secondary: oklch(0.269 0 0);
83
- --secondary-foreground: oklch(0.985 0 0);
84
- --muted: oklch(0.269 0 0);
85
- --muted-foreground: oklch(0.708 0 0);
86
- --accent: oklch(0.269 0 0);
87
- --accent-foreground: oklch(0.985 0 0);
88
- --destructive: oklch(0.704 0.191 22.216);
89
- --border: oklch(1 0 0 / 10%);
90
- --input: oklch(1 0 0 / 15%);
91
- --ring: oklch(0.556 0 0);
92
- }
93
-
94
- @layer base {
95
- * {
96
- @apply border-border outline-ring/50;
97
- }
98
- body {
99
- @apply bg-background text-foreground;
100
- }
101
- html {
102
- @apply font-sans;
103
- }
104
- }
@@ -1,29 +0,0 @@
1
- {
2
- "include": ["**/*.ts", "**/*.tsx"],
3
- "compilerOptions": {
4
- "target": "ES2022",
5
- "jsx": "react-jsx",
6
- "module": "ESNext",
7
- "baseUrl": ".",
8
- "paths": {
9
- "#/*": ["./src/*"],
10
- "@/*": ["./src/*"]
11
- },
12
- "lib": ["ES2022", "DOM", "DOM.Iterable"],
13
- "types": ["vite/client"],
14
-
15
- /* Bundler mode */
16
- "moduleResolution": "bundler",
17
- "allowImportingTsExtensions": true,
18
- "verbatimModuleSyntax": true,
19
- "noEmit": true,
20
-
21
- /* Linting */
22
- "skipLibCheck": true,
23
- "strict": true,
24
- "noUnusedLocals": true,
25
- "noUnusedParameters": true,
26
- "noFallthroughCasesInSwitch": true,
27
- "noUncheckedSideEffectImports": true
28
- }
29
- }
@@ -1,19 +0,0 @@
1
- import { defineConfig } from 'vite'
2
- import { devtools } from '@tanstack/devtools-vite'
3
-
4
- import { tanstackRouter } from '@tanstack/router-plugin/vite'
5
-
6
- import viteReact from '@vitejs/plugin-react'
7
- import tailwindcss from '@tailwindcss/vite'
8
-
9
- const config = defineConfig({
10
- resolve: { tsconfigPaths: true },
11
- plugins: [
12
- devtools(),
13
- tailwindcss(),
14
- tanstackRouter({ target: 'react', autoCodeSplitting: true }),
15
- viteReact(),
16
- ],
17
- })
18
-
19
- export default config