neural-loom 0.2.13 → 0.2.14

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 (139) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +2 -0
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/cache/.previewinfo +1 -1
  5. package/.next/cache/.rscinfo +1 -1
  6. package/.next/cache/.tsbuildinfo +1 -1
  7. package/.next/diagnostics/route-bundle-stats.json +2 -2
  8. package/.next/fallback-build-manifest.json +3 -3
  9. package/.next/prerender-manifest.json +3 -3
  10. package/.next/routes-manifest.json +12 -0
  11. package/.next/server/app/_global-error.html +1 -1
  12. package/.next/server/app/_global-error.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  17. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.html +1 -1
  19. package/.next/server/app/_not-found.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  23. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  24. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  25. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  26. package/.next/server/app/api/context/aider/route.js +1 -1
  27. package/.next/server/app/api/context/aider/route.js.nft.json +1 -1
  28. package/.next/server/app/api/context/claude/route.js +1 -1
  29. package/.next/server/app/api/context/claude/route.js.nft.json +1 -1
  30. package/.next/server/app/api/recents/route/app-paths-manifest.json +3 -0
  31. package/.next/server/app/api/recents/route/build-manifest.json +9 -0
  32. package/.next/server/app/api/recents/route/server-reference-manifest.json +4 -0
  33. package/.next/server/app/api/recents/route.js +6 -0
  34. package/.next/server/app/api/recents/route.js.map +5 -0
  35. package/.next/server/app/api/recents/route.js.nft.json +1 -0
  36. package/.next/server/app/api/recents/route_client-reference-manifest.js +3 -0
  37. package/.next/server/app/api/sessions/inject/route.js +1 -1
  38. package/.next/server/app/api/sessions/inject/route.js.nft.json +1 -1
  39. package/.next/server/app/api/sessions/input/route.js +1 -1
  40. package/.next/server/app/api/sessions/input/route.js.nft.json +1 -1
  41. package/.next/server/app/api/sessions/launch/route.js +1 -1
  42. package/.next/server/app/api/sessions/launch/route.js.nft.json +1 -1
  43. package/.next/server/app/api/sessions/route.js +1 -1
  44. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  45. package/.next/server/app/api/sessions/scope/route/app-paths-manifest.json +3 -0
  46. package/.next/server/app/api/sessions/scope/route/build-manifest.json +9 -0
  47. package/.next/server/app/api/sessions/scope/route/server-reference-manifest.json +4 -0
  48. package/.next/server/app/api/sessions/scope/route.js +7 -0
  49. package/.next/server/app/api/sessions/scope/route.js.map +5 -0
  50. package/.next/server/app/api/sessions/scope/route.js.nft.json +1 -0
  51. package/.next/server/app/api/sessions/scope/route_client-reference-manifest.js +3 -0
  52. package/.next/server/app/api/sessions/stats/route.js +1 -1
  53. package/.next/server/app/api/sessions/stats/route.js.nft.json +1 -1
  54. package/.next/server/app/api/sessions/stop/route.js +1 -1
  55. package/.next/server/app/api/sessions/stop/route.js.nft.json +1 -1
  56. package/.next/server/app/index.html +1 -1
  57. package/.next/server/app/index.rsc +2 -2
  58. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  59. package/.next/server/app/index.segments/_full.segment.rsc +2 -2
  60. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  61. package/.next/server/app/index.segments/_index.segment.rsc +1 -1
  62. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  63. package/.next/server/app/page/react-loadable-manifest.json +4 -3
  64. package/.next/server/app/page_client-reference-manifest.js +1 -1
  65. package/.next/server/app-paths-manifest.json +2 -0
  66. package/.next/server/chunks/[root-of-the-server]__0_2_i_q._.js +15 -0
  67. package/.next/server/chunks/{[root-of-the-server]__0rd5ojc._.js.map → [root-of-the-server]__0_2_i_q._.js.map} +1 -1
  68. package/.next/server/chunks/[root-of-the-server]__0__9rdk._.js +15 -0
  69. package/.next/server/chunks/{[root-of-the-server]__0m7xwu2._.js.map → [root-of-the-server]__0__9rdk._.js.map} +1 -1
  70. package/.next/server/chunks/[root-of-the-server]__0bi3d5z._.js +15 -0
  71. package/.next/server/chunks/{[root-of-the-server]__0ezygp7._.js.map → [root-of-the-server]__0bi3d5z._.js.map} +1 -1
  72. package/.next/server/chunks/[root-of-the-server]__0d0pykb._.js +3 -3
  73. package/.next/server/chunks/[root-of-the-server]__0d0pykb._.js.map +1 -1
  74. package/.next/server/chunks/[root-of-the-server]__0iqaxhx._.js +15 -0
  75. package/.next/server/chunks/[root-of-the-server]__0iqaxhx._.js.map +1 -0
  76. package/.next/server/chunks/{[root-of-the-server]__12-x1lx._.js → [root-of-the-server]__0m91xif._.js} +3 -3
  77. package/.next/server/chunks/{[root-of-the-server]__12-x1lx._.js.map → [root-of-the-server]__0m91xif._.js.map} +1 -1
  78. package/.next/server/chunks/[root-of-the-server]__0p~u94k._.js +3 -0
  79. package/.next/server/chunks/[root-of-the-server]__0p~u94k._.js.map +1 -0
  80. package/.next/server/chunks/[root-of-the-server]__0qyrt6_._.js +3 -0
  81. package/.next/server/chunks/[root-of-the-server]__0qyrt6_._.js.map +1 -0
  82. package/.next/server/chunks/[root-of-the-server]__0qz~w0~._.js +15 -0
  83. package/.next/server/chunks/[root-of-the-server]__0qz~w0~._.js.map +1 -0
  84. package/.next/server/chunks/[root-of-the-server]__0ty8hwz._.js +15 -0
  85. package/.next/server/chunks/{[root-of-the-server]__0tl2n51._.js.map → [root-of-the-server]__0ty8hwz._.js.map} +1 -1
  86. package/.next/server/chunks/[root-of-the-server]__0ylcu31._.js +3 -0
  87. package/.next/server/chunks/[root-of-the-server]__0ylcu31._.js.map +1 -0
  88. package/.next/server/chunks/_next-internal_server_app_api_recents_route_actions_0wmi3sl.js +3 -0
  89. package/.next/server/chunks/_next-internal_server_app_api_recents_route_actions_0wmi3sl.js.map +1 -0
  90. package/.next/server/chunks/_next-internal_server_app_api_sessions_scope_route_actions_0g112ee.js +3 -0
  91. package/.next/server/chunks/_next-internal_server_app_api_sessions_scope_route_actions_0g112ee.js.map +1 -0
  92. package/.next/server/chunks/ssr/_0t7oqy6._.js +1 -1
  93. package/.next/server/chunks/ssr/_0t7oqy6._.js.map +1 -1
  94. package/.next/server/middleware-build-manifest.js +3 -3
  95. package/.next/server/pages/404.html +1 -1
  96. package/.next/server/pages/500.html +1 -1
  97. package/.next/server/server-reference-manifest.js +1 -1
  98. package/.next/server/server-reference-manifest.json +1 -1
  99. package/.next/static/chunks/0b89ti7ob.09t.js +1 -0
  100. package/.next/static/chunks/0eidfx-s54367.js +1 -0
  101. package/.next/static/chunks/0ew-ei_k3d-qg.js +1 -0
  102. package/.next/static/chunks/0g45rn_9mbzt6.js +1 -0
  103. package/.next/static/chunks/0jxar8nsw_py3.js +1 -0
  104. package/.next/trace +1 -1
  105. package/.next/trace-build +1 -1
  106. package/.next/types/routes.d.ts +3 -1
  107. package/.next/types/validator.ts +18 -0
  108. package/package.json +1 -1
  109. package/src/app/api/context/aider/route.ts +37 -22
  110. package/src/app/api/context/claude/route.ts +28 -16
  111. package/src/app/api/recents/route.ts +34 -0
  112. package/src/app/api/sessions/launch/route.ts +12 -0
  113. package/src/app/api/sessions/scope/route.ts +139 -0
  114. package/src/app/components/AiderWizard.tsx +70 -4
  115. package/src/app/components/ClaudeWizard.tsx +70 -4
  116. package/src/app/components/IdeLayout.tsx +86 -12
  117. package/src/app/page.tsx +1 -0
  118. package/src/lib/agents/AgentRunner.ts +2 -0
  119. package/src/lib/agents/SessionManager.ts +60 -2
  120. package/src/lib/agents/SessionPersister.ts +4 -2
  121. package/src/lib/recents.ts +57 -0
  122. package/src/lib/workspaceParser.ts +40 -0
  123. package/.next/server/chunks/[root-of-the-server]__0e5cwnx._.js +0 -3
  124. package/.next/server/chunks/[root-of-the-server]__0e5cwnx._.js.map +0 -1
  125. package/.next/server/chunks/[root-of-the-server]__0efi5cr._.js +0 -3
  126. package/.next/server/chunks/[root-of-the-server]__0efi5cr._.js.map +0 -1
  127. package/.next/server/chunks/[root-of-the-server]__0ezygp7._.js +0 -15
  128. package/.next/server/chunks/[root-of-the-server]__0m7xwu2._.js +0 -15
  129. package/.next/server/chunks/[root-of-the-server]__0rd5ojc._.js +0 -15
  130. package/.next/server/chunks/[root-of-the-server]__0tl2n51._.js +0 -15
  131. package/.next/server/chunks/[root-of-the-server]__0y-63z8._.js +0 -15
  132. package/.next/server/chunks/[root-of-the-server]__0y-63z8._.js.map +0 -1
  133. package/.next/static/chunks/095uz52in_39t.js +0 -1
  134. package/.next/static/chunks/0ayrw9yot-bjb.js +0 -1
  135. package/.next/static/chunks/0wdcf.26dj03~.js +0 -1
  136. package/.next/static/chunks/178yphwi3n~oc.js +0 -1
  137. /package/.next/static/{w0G47Es9qpUItx3l4uJ_v → g7S_nNTPWKtmCY0Va4YcB}/_buildManifest.js +0 -0
  138. /package/.next/static/{w0G47Es9qpUItx3l4uJ_v → g7S_nNTPWKtmCY0Va4YcB}/_clientMiddlewareManifest.js +0 -0
  139. /package/.next/static/{w0G47Es9qpUItx3l4uJ_v → g7S_nNTPWKtmCY0Va4YcB}/_ssgManifest.js +0 -0
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { useEffect, useState, useCallback } from "react";
4
4
  import TerminalConsole from "./TerminalConsole";
5
+ import DirectoryBrowserModal from "./DirectoryBrowserModal";
5
6
 
6
7
  interface FileNode {
7
8
  name: string;
@@ -71,6 +72,7 @@ interface IdeLayoutProps {
71
72
  onClose: () => void;
72
73
  sessions: RunnerStatus[];
73
74
  onSwitchSession: (id: string) => void;
75
+ onRefreshSessions?: () => void;
74
76
  }
75
77
 
76
78
  interface OpenFile {
@@ -80,10 +82,53 @@ interface OpenFile {
80
82
  isModified: boolean;
81
83
  }
82
84
 
83
- export default function IdeLayout({ sessionId, workspaceRoot, scopedDirs, onClose, sessions, onSwitchSession }: IdeLayoutProps) {
85
+ export default function IdeLayout({ sessionId, workspaceRoot, scopedDirs, onClose, sessions, onSwitchSession, onRefreshSessions }: IdeLayoutProps) {
84
86
  const scopedDirsStr = JSON.stringify(scopedDirs);
85
87
  const [workspace, setWorkspace] = useState<WorkspaceData | null>(null);
86
88
  const [scoped, setScoped] = useState<ScopedData[]>([]);
89
+ const [isBrowsingScope, setIsBrowsingScope] = useState(false);
90
+
91
+ const handleAddScopedFolder = async (pathToAdd: string) => {
92
+ try {
93
+ const res = await fetch("/api/sessions/scope", {
94
+ method: "POST",
95
+ headers: { "Content-Type": "application/json" },
96
+ body: JSON.stringify({ sessionId, path: pathToAdd, action: "add" }),
97
+ });
98
+ if (res.ok) {
99
+ if (onRefreshSessions) {
100
+ onRefreshSessions();
101
+ }
102
+ } else {
103
+ const errData = await res.json();
104
+ alert(errData.error || "Failed to add scoped folder.");
105
+ }
106
+ } catch (e) {
107
+ console.error(e);
108
+ alert("Network error: failed to add scoped folder.");
109
+ }
110
+ };
111
+
112
+ const handleRemoveScopedFolder = async (pathToRemove: string) => {
113
+ try {
114
+ const res = await fetch("/api/sessions/scope", {
115
+ method: "POST",
116
+ headers: { "Content-Type": "application/json" },
117
+ body: JSON.stringify({ sessionId, path: pathToRemove, action: "remove" }),
118
+ });
119
+ if (res.ok) {
120
+ if (onRefreshSessions) {
121
+ onRefreshSessions();
122
+ }
123
+ } else {
124
+ const errData = await res.json();
125
+ alert(errData.error || "Failed to remove scoped folder.");
126
+ }
127
+ } catch (e) {
128
+ console.error(e);
129
+ alert("Network error: failed to remove scoped folder.");
130
+ }
131
+ };
87
132
 
88
133
  // Track open files and active files per session to preserve state on tab swap
89
134
  const [sessionOpenFiles, setSessionOpenFiles] = useState<{ [sessionId: string]: OpenFile[] }>({});
@@ -759,15 +804,29 @@ export default function IdeLayout({ sessionId, workspaceRoot, scopedDirs, onClos
759
804
  )}
760
805
 
761
806
  {/* Scoped Directories Section */}
762
- {scoped.length > 0 && (
763
- <div>
764
- <div style={{ ...treeSectionHeaderStyle, borderTop: "1px solid var(--border)", paddingTop: "1rem" }}>
765
- 🔍 Scoped Folders ({scoped.length})
766
- </div>
767
- {scoped.map((scope) => (
807
+ <div>
808
+ <div style={{ ...treeSectionHeaderStyle, borderTop: "1px solid var(--border)", paddingTop: "1rem" }}>
809
+ <span>🔍 Scoped Folders ({scoped.length})</span>
810
+ <button
811
+ onClick={() => setIsBrowsingScope(true)}
812
+ style={iconButtonStyle}
813
+ title="Add Scoped Folder..."
814
+ >
815
+
816
+ </button>
817
+ </div>
818
+ {scoped.length > 0 ? (
819
+ scoped.map((scope) => (
768
820
  <div key={scope.path} style={{ marginTop: "0.75rem", padding: "0 0.5rem" }}>
769
- <div style={{ ...itemHeaderStyle, display: "flex", gap: "0.25rem", color: "#a855f7", fontSize: "0.75rem", fontWeight: 700, padding: "0.25rem" }} title={scope.path}>
770
- 🔗 {scope.name}/
821
+ <div style={{ ...itemHeaderStyle, display: "flex", gap: "0.25rem", color: "#a855f7", fontSize: "0.75rem", fontWeight: 700, padding: "0.25rem", justifyContent: "space-between", alignItems: "center" }} title={scope.path}>
822
+ <span style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: 1 }}>🔗 {scope.name}/</span>
823
+ <button
824
+ onClick={() => handleRemoveScopedFolder(scope.path)}
825
+ style={{ background: "none", border: "none", color: "var(--danger)", cursor: "pointer", fontSize: "0.75rem", padding: "0 0.25rem" }}
826
+ title="Remove Scoped Folder"
827
+ >
828
+
829
+ </button>
771
830
  </div>
772
831
  <div style={{ paddingLeft: "0.25rem" }}>
773
832
  {scope.tree.map((node) => (
@@ -783,9 +842,13 @@ export default function IdeLayout({ sessionId, workspaceRoot, scopedDirs, onClos
783
842
  ))}
784
843
  </div>
785
844
  </div>
786
- ))}
787
- </div>
788
- )}
845
+ ))
846
+ ) : (
847
+ <div style={{ padding: "0.5rem 1rem", color: "var(--muted)", fontSize: "0.75rem", fontStyle: "italic" }}>
848
+ No extra scoped folders. Click [+] to mount a folder.
849
+ </div>
850
+ )}
851
+ </div>
789
852
  </>
790
853
  )}
791
854
 
@@ -1455,6 +1518,17 @@ export default function IdeLayout({ sessionId, workspaceRoot, scopedDirs, onClos
1455
1518
  </div>
1456
1519
  </div>
1457
1520
  )}
1521
+ {isBrowsingScope && (
1522
+ <DirectoryBrowserModal
1523
+ title="Add Scoped Directory"
1524
+ initialPath={workspaceRoot}
1525
+ onClose={() => setIsBrowsingScope(false)}
1526
+ onSelect={(selectedPath) => {
1527
+ handleAddScopedFolder(selectedPath);
1528
+ setIsBrowsingScope(false);
1529
+ }}
1530
+ />
1531
+ )}
1458
1532
  </div>
1459
1533
  );
1460
1534
  }
package/src/app/page.tsx CHANGED
@@ -225,6 +225,7 @@ export default function Home() {
225
225
  onClose={() => setActiveSessionId(null)}
226
226
  sessions={sessions}
227
227
  onSwitchSession={(id) => setActiveSessionId(id)}
228
+ onRefreshSessions={fetchSessions}
228
229
  />
229
230
  </div>
230
231
  ) : (
@@ -7,6 +7,7 @@ export interface RunnerStatus {
7
7
  logsCount: number;
8
8
  workspaceRoot?: string;
9
9
  scopedDirs?: string[];
10
+ lastSyncedWorkspaceFolders?: string[];
10
11
  tokenUsage?: { input: number; output: number; cost: number };
11
12
  }
12
13
 
@@ -19,6 +20,7 @@ export abstract class AgentRunner {
19
20
  abstract logs: string[];
20
21
  workspaceRoot?: string;
21
22
  scopedDirs?: string[];
23
+ lastSyncedWorkspaceFolders?: string[];
22
24
  tokenUsage: { input: number; output: number; cost: number } = { input: 0, output: 0, cost: 0 };
23
25
 
24
26
  protected parseTokenUsage(data: string): void {
@@ -8,6 +8,7 @@ import { AiderRunner } from "./AiderRunner";
8
8
  import { initWebSocketServer } from "./WebSocketServer";
9
9
  import { ContextManager } from "./ContextManager";
10
10
  import { SessionPersister } from "./SessionPersister";
11
+ import { getWorkspaceFileFolders } from "../workspaceParser";
11
12
 
12
13
  export class SessionManager {
13
14
  private static instance: SessionManager | null = null;
@@ -40,6 +41,7 @@ export class SessionManager {
40
41
  runner.logs = data.logs;
41
42
  runner.workspaceRoot = data.workspaceRoot;
42
43
  runner.scopedDirs = data.scopedDirs;
44
+ runner.lastSyncedWorkspaceFolders = data.lastSyncedWorkspaceFolders;
43
45
 
44
46
  // Auto-resume mock runner if running
45
47
  if (data.type === "mock" && data.status === "running") {
@@ -97,11 +99,67 @@ export class SessionManager {
97
99
  }
98
100
 
99
101
  public getSession(id: string): AgentRunner | undefined {
100
- return this.sessions.get(id);
102
+ const runner = this.sessions.get(id);
103
+ if (runner) {
104
+ this.syncWorkspaceFolders(runner);
105
+ }
106
+ return runner;
101
107
  }
102
108
 
103
109
  public listSessions(): RunnerStatus[] {
104
- return Array.from(this.sessions.values()).map(runner => runner.getStatus());
110
+ return Array.from(this.sessions.values()).map(runner => {
111
+ this.syncWorkspaceFolders(runner);
112
+ return runner.getStatus();
113
+ });
114
+ }
115
+
116
+ public syncWorkspaceFolders(session: AgentRunner) {
117
+ if (session.type === 'mock') return;
118
+ const root = session.workspaceRoot || process.env.ORIGINAL_CWD || process.cwd();
119
+ const currentWorkspaceFolders = getWorkspaceFileFolders(root);
120
+
121
+ const lastSynced = session.lastSyncedWorkspaceFolders || [];
122
+
123
+ // Check if the folders list from .code-workspace has changed since last sync
124
+ const hasChanged =
125
+ currentWorkspaceFolders.length !== lastSynced.length ||
126
+ currentWorkspaceFolders.some(f => !lastSynced.includes(f)) ||
127
+ lastSynced.some(f => !currentWorkspaceFolders.includes(f));
128
+
129
+ if (hasChanged) {
130
+ console.log(`[SessionManager] Code workspace folders changed for session ${session.id}. Re-syncing...`);
131
+
132
+ if (!session.scopedDirs) session.scopedDirs = [];
133
+
134
+ // 1. Remove folders that were in the previous sync but are no longer in .code-workspace
135
+ session.scopedDirs = session.scopedDirs.filter(dir => {
136
+ if (lastSynced.includes(dir) && !currentWorkspaceFolders.includes(dir)) {
137
+ return false;
138
+ }
139
+ return true;
140
+ });
141
+
142
+ // 2. Add new folders that are in .code-workspace
143
+ for (const dir of currentWorkspaceFolders) {
144
+ if (!session.scopedDirs.includes(dir)) {
145
+ session.scopedDirs.push(dir);
146
+ }
147
+ }
148
+
149
+ // 3. Update last synced flag
150
+ session.lastSyncedWorkspaceFolders = currentWorkspaceFolders;
151
+
152
+ // 4. Save session status
153
+ SessionPersister.saveSession(session, true);
154
+
155
+ // 5. Re-compile context
156
+ ContextManager.compileSessionContext(root, session.scopedDirs);
157
+
158
+ // 6. Auto-inject mount context command if active
159
+ if (session.status === 'running') {
160
+ this.injectCommand(session.id, "/ccc");
161
+ }
162
+ }
105
163
  }
106
164
 
107
165
  public async stopSession(id: string): Promise<boolean> {
@@ -10,6 +10,7 @@ export interface PersistedSession {
10
10
  logs: string[];
11
11
  workspaceRoot?: string;
12
12
  scopedDirs?: string[];
13
+ lastSyncedWorkspaceFolders?: string[];
13
14
  }
14
15
 
15
16
  export class SessionPersister {
@@ -29,7 +30,7 @@ export class SessionPersister {
29
30
  }
30
31
 
31
32
  public static saveSession(
32
- session: { id: string; name: string; type: string; status: string; createdAt: string; logs: string[]; workspaceRoot?: string; scopedDirs?: string[] },
33
+ session: { id: string; name: string; type: string; status: string; createdAt: string; logs: string[]; workspaceRoot?: string; scopedDirs?: string[]; lastSyncedWorkspaceFolders?: string[] },
33
34
  immediate = false
34
35
  ) {
35
36
  const data: PersistedSession = {
@@ -40,7 +41,8 @@ export class SessionPersister {
40
41
  createdAt: session.createdAt,
41
42
  logs: session.logs,
42
43
  workspaceRoot: session.workspaceRoot,
43
- scopedDirs: session.scopedDirs
44
+ scopedDirs: session.scopedDirs,
45
+ lastSyncedWorkspaceFolders: session.lastSyncedWorkspaceFolders
44
46
  };
45
47
 
46
48
  if (immediate) {
@@ -0,0 +1,57 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ const configDir = path.join(process.env.ORIGINAL_CWD || process.cwd(), ".ai", "neural-loom");
5
+ const recentsPath = path.join(configDir, "recents.json");
6
+
7
+ function ensureDir() {
8
+ if (!fs.existsSync(configDir)) {
9
+ fs.mkdirSync(configDir, { recursive: true });
10
+ }
11
+ }
12
+
13
+ export function loadRecents() {
14
+ if (fs.existsSync(recentsPath)) {
15
+ try {
16
+ const data = JSON.parse(fs.readFileSync(recentsPath, "utf8"));
17
+ return {
18
+ workspaces: Array.isArray(data.workspaces) ? (data.workspaces as string[]) : [],
19
+ scopes: Array.isArray(data.scopes) ? (data.scopes as string[]) : []
20
+ };
21
+ } catch (e) {
22
+ console.error("[Recents] Failed to parse recents.json:", e);
23
+ }
24
+ }
25
+ return { workspaces: [], scopes: [] };
26
+ }
27
+
28
+ export function addRecent(type: "workspace" | "scope", folderPath: string) {
29
+ if (!folderPath) return;
30
+
31
+ // Resolve absolute path and normalize slashes
32
+ const resolvedPath = path.resolve(folderPath).replace(/\\/g, "/");
33
+
34
+ // Quick safety check: only add if the directory exists
35
+ if (!fs.existsSync(resolvedPath)) return;
36
+
37
+ const recents = loadRecents();
38
+
39
+ if (type === "workspace") {
40
+ recents.workspaces = [
41
+ resolvedPath,
42
+ ...recents.workspaces.filter(p => p !== resolvedPath)
43
+ ].slice(0, 10);
44
+ } else if (type === "scope") {
45
+ recents.scopes = [
46
+ resolvedPath,
47
+ ...recents.scopes.filter(p => p !== resolvedPath)
48
+ ].slice(0, 15);
49
+ }
50
+
51
+ try {
52
+ ensureDir();
53
+ fs.writeFileSync(recentsPath, JSON.stringify(recents, null, 2), "utf8");
54
+ } catch (err) {
55
+ console.error("[Recents] Failed to write recents.json:", err);
56
+ }
57
+ }
@@ -0,0 +1,40 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ export function getWorkspaceFileFolders(workspaceRoot: string): string[] {
5
+ try {
6
+ if (!workspaceRoot || !fs.existsSync(workspaceRoot)) return [];
7
+
8
+ // Normalize workspaceRoot path
9
+ const normRoot = path.resolve(workspaceRoot).replace(/\\/g, "/");
10
+
11
+ const files = fs.readdirSync(normRoot);
12
+ const workspaceFile = files.find(f => f.endsWith(".code-workspace"));
13
+ if (!workspaceFile) return [];
14
+
15
+ const filePath = path.join(normRoot, workspaceFile);
16
+ const content = fs.readFileSync(filePath, "utf8");
17
+ const json = JSON.parse(content);
18
+
19
+ if (!json.folders || !Array.isArray(json.folders)) return [];
20
+
21
+ const folders: string[] = [];
22
+ for (const folder of json.folders) {
23
+ if (folder.path) {
24
+ // Resolve relative to workspace root (where the workspace file resides)
25
+ const resolved = path.resolve(normRoot, folder.path).replace(/\\/g, "/");
26
+
27
+ // Exclude the workspace root folder itself
28
+ if (resolved !== normRoot) {
29
+ if (fs.existsSync(resolved)) {
30
+ folders.push(resolved);
31
+ }
32
+ }
33
+ }
34
+ }
35
+ return folders;
36
+ } catch (err) {
37
+ console.error("[WorkspaceParser] Failed to parse code-workspace file:", err);
38
+ return [];
39
+ }
40
+ }
@@ -1,3 +0,0 @@
1
- module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},81243,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),o=e.i(74677),i=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),x=e.i(70101),h=e.i(26937),R=e.i(10372),f=e.i(93695);e.i(52474);var v=e.i(220),g=e.i(89171),m=e.i(22734),w=e.i(14747);let y=w.default.join(process.env.ORIGINAL_CWD||process.cwd(),".ai","neural-loom"),E=w.default.join(y,"claude.json");async function C(){try{if(m.default.existsSync(E)){let e=m.default.readFileSync(E,"utf8"),t=JSON.parse(e);return g.NextResponse.json({success:!0,config:{name:t.name||"Claude Local",workspaceRoot:t.workspaceRoot||"",scopedDirs:t.scopedDirs||[],extraFlags:t.extraFlags||""}})}return g.NextResponse.json({success:!0,config:{name:"Claude Local",workspaceRoot:"",scopedDirs:[],extraFlags:""}})}catch(t){let e=t instanceof Error?t.message:"Unknown error";return g.NextResponse.json({success:!1,error:e},{status:500})}}async function N(e){try{let{name:t,workspaceRoot:r,scopedDirs:a,extraFlags:n}=await e.json();return m.default.existsSync(y)||m.default.mkdirSync(y,{recursive:!0}),m.default.writeFileSync(E,JSON.stringify({name:t||"Claude Local",workspaceRoot:r||"",scopedDirs:a||[],extraFlags:n||""},null,2),"utf8"),g.NextResponse.json({success:!0,message:"Claude configuration saved successfully!"})}catch(t){let e=t instanceof Error?t.message:"Unknown error";return g.NextResponse.json({success:!1,error:e},{status:500})}}e.s(["GET",0,C,"POST",0,N],82294);var A=e.i(82294);let S=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/context/claude/route",pathname:"/api/context/claude",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/context/claude/route.ts",nextConfigOutput:"",userland:A,...{}}),{workAsyncStorage:b,workUnitAsyncStorage:k,serverHooks:T}=S;async function j(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),S.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/context/claude/route";g=g.replace(/\/index$/,"")||"/";let m=await S.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!m)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:w,deploymentId:y,params:E,nextConfig:C,parsedUrl:N,isDraftMode:A,prerenderManifest:b,routerServerContext:k,isOnDemandRevalidate:T,revalidateOnlyGenerated:j,resolvedPathname:q,clientReferenceManifest:O,serverActionsManifest:P}=m,_=(0,i.normalizeAppPath)(g),D=!!(b.dynamicRoutes[_]||b.routes[q]),I=async()=>((null==k?void 0:k.render404)?await k.render404(e,t,N,!1):t.end("This page could not be found"),null);if(D&&!A){let e=!!b.routes[q],t=b.dynamicRoutes[_];if(t&&!1===t.fallback&&!e){if(C.adapterPath)return await I();throw new f.NoFallbackError}}let U=null;!D||S.isDev||A||(U="/index"===(U=q)?"/":U);let H=!0===S.isDev||!D,M=D&&!H;P&&O&&(0,o.setManifestsSingleton)({page:g,clientReferenceManifest:O,serverActionsManifest:P});let F=e.method||"GET",L=(0,s.getTracer)(),$=L.getActiveScopeSpan(),K=!!(null==k?void 0:k.isWrappedByNextServer),B=!!(0,n.getRequestMeta)(e,"minimalMode"),G=(0,n.getRequestMeta)(e,"incrementalCache")||await S.getIncrementalCache(e,C,b,B);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let W={params:E,previewProps:b.preview,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts},cacheComponents:!!C.cacheComponents,supportsDynamicResponse:H,incrementalCache:G,cacheLifeProfiles:C.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>S.onRequestError(e,t,a,n,k)},sharedContext:{buildId:w,deploymentId:y}},V=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),J=u.NextRequestAdapter.fromNodeNextRequest(V,(0,u.signalFromNodeResponse)(t));try{let n,o=async e=>S.handle(J,W).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=L.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${F} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${F} ${g}`)}),i=async n=>{var s,i;let l=async({previousCacheEntry:r})=>{try{if(!B&&T&&j&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await o(n);e.fetchMetrics=W.renderOpts.fetchMetrics;let i=W.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let l=W.renderOpts.collectedTags;if(!D)return await (0,p.sendResponse)(V,X,s,W.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,x.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[R.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=R.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,a=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=R.INFINITE_CACHE?void 0:W.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await S.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:T})},!1,k),t}},u=await S.handleResponse({req:e,nextConfig:C,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:j,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:B});if(!D)return null;if((null==u||null==(s=u.value)?void 0:s.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(i=u.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});B||t.setHeader("x-nextjs-cache",T?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,x.fromNodeOutgoingHttpHeaders)(u.value.headers);return B&&D||d.delete(R.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,h.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(V,X,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};K&&$?await i($):(n=L.getActiveScopeSpan(),await L.withPropagatedContext(e.headers,()=>L.trace(d.BaseServerSpan.handleRequest,{spanName:`${F} ${g}`,kind:s.SpanKind.SERVER,attributes:{"http.method":F,"http.target":e.url}},i),void 0,!K))}catch(t){if(t instanceof f.NoFallbackError||await S.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:T})},!1,k),D)throw t;return await (0,p.sendResponse)(V,X,new Response(null,{status:500})),null}}e.s(["handler",0,j,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:k})},"routeModule",0,S,"serverHooks",0,T,"workAsyncStorage",0,b,"workUnitAsyncStorage",0,k],81243)}];
2
-
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__0e5cwnx._.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../node_modules/next/dist/esm/build/templates/app-route.js","../../../src/app/api/context/claude/route.ts"],"sourcesContent":["import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/context/claude/route\",\n pathname: \"/api/context/claude\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/context/claude/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/context/claude/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId,\n deploymentId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n","import { NextResponse } from \"next/server\";\nimport fs from \"fs\";\nimport path from \"path\";\n\nconst configDir = path.join(process.env.ORIGINAL_CWD || process.cwd(), \".ai\", \"neural-loom\");\nconst configPath = path.join(configDir, \"claude.json\");\n\nfunction ensureDir() {\n if (!fs.existsSync(configDir)) {\n fs.mkdirSync(configDir, { recursive: true });\n }\n}\n\nexport async function GET() {\n try {\n if (fs.existsSync(configPath)) {\n const rawData = fs.readFileSync(configPath, \"utf8\");\n const config = JSON.parse(rawData);\n \n return NextResponse.json({\n success: true,\n config: {\n name: config.name || \"Claude Local\",\n workspaceRoot: config.workspaceRoot || \"\",\n scopedDirs: config.scopedDirs || [],\n extraFlags: config.extraFlags || \"\",\n },\n });\n }\n\n return NextResponse.json({\n success: true,\n config: {\n name: \"Claude Local\",\n workspaceRoot: \"\",\n scopedDirs: [],\n extraFlags: \"\",\n },\n });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error\";\n return NextResponse.json({ success: false, error: errorMessage }, { status: 500 });\n }\n}\n\nexport async function POST(request: Request) {\n try {\n const body = await request.json();\n const { name, workspaceRoot, scopedDirs, extraFlags } = body;\n\n ensureDir();\n\n const newConfig = {\n name: name || \"Claude Local\",\n workspaceRoot: workspaceRoot || \"\",\n scopedDirs: scopedDirs || [],\n extraFlags: extraFlags || \"\",\n };\n\n fs.writeFileSync(configPath, JSON.stringify(newConfig, null, 2), \"utf8\");\n return NextResponse.json({ success: true, message: \"Claude configuration saved successfully!\" });\n\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error\";\n return NextResponse.json({ success: false, error: errorMessage }, { status: 500 });\n }\n}\n"],"names":["configDir","join","process","env","ORIGINAL_CWD","cwd","configPath","ensureDir","config","existsSync","mkdirSync","recursive","GET","rawData","readFileSync","JSON","parse","json","success","stringify","name","workspaceRoot","scopedDirs","extraFlags","error","errorMessage","Error","message","status","POST","request","body","newConfig","writeFileSync"],"mappings":"qmCAAA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACAQ,EAAAA,EAAAA,CAAAA,CAAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAC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A,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,QAAiB,EAAW,CAAC,GAE5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA5TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAA,AAAW,EAAC,kBACf,uBACA,CACJ,EACJ","ignoreList":[0]}
@@ -1,3 +0,0 @@
1
- module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},523,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),p=e.i(87718),d=e.i(95169),u=e.i(47587),c=e.i(66012),x=e.i(70101),h=e.i(26937),f=e.i(10372),y=e.i(93695);e.i(52474);var R=e.i(220),g=e.i(89171),v=e.i(22734),m=e.i(14747);let A=m.default.join(process.env.ORIGINAL_CWD||process.cwd(),".ai","neural-loom"),w=m.default.join(A,"aider.json");function E(e){return e?e.length<=8?"********":`${e.slice(0,6)}...${e.slice(-4)}`:""}async function C(){try{if(v.default.existsSync(w)){let e=v.default.readFileSync(w,"utf8"),t=JSON.parse(e);return g.NextResponse.json({success:!0,config:{openaiApiKey:t.openaiApiKey?E(t.openaiApiKey):"",anthropicApiKey:t.anthropicApiKey?E(t.anthropicApiKey):"",geminiApiKey:t.geminiApiKey?E(t.geminiApiKey):"",model:t.model||"claude-3-5-sonnet",extraFlags:t.extraFlags||"",workspaceRoot:t.workspaceRoot||"",scopedDirs:t.scopedDirs||[]}})}return g.NextResponse.json({success:!0,config:{openaiApiKey:"",anthropicApiKey:"",geminiApiKey:"",model:"claude-3-5-sonnet",extraFlags:"",workspaceRoot:"",scopedDirs:[]}})}catch(t){let e=t instanceof Error?t.message:"Unknown error";return g.NextResponse.json({success:!1,error:e},{status:500})}}async function N(e){try{let{openaiApiKey:t,anthropicApiKey:r,geminiApiKey:a,model:n,extraFlags:s,workspaceRoot:i,scopedDirs:o}=await e.json();v.default.existsSync(A)||v.default.mkdirSync(A,{recursive:!0});let l={openaiApiKey:"",anthropicApiKey:"",geminiApiKey:"",model:"claude-3-5-sonnet",extraFlags:"",workspaceRoot:"",scopedDirs:[]};if(v.default.existsSync(w))try{l=JSON.parse(v.default.readFileSync(w,"utf8"))}catch(e){console.error("Failed to parse existing aider.json:",e)}let p=t&&t.includes("...")?l.openaiApiKey:t||"",d=r&&r.includes("...")?l.anthropicApiKey:r||"",u=a&&a.includes("...")?l.geminiApiKey:a||"";return v.default.writeFileSync(w,JSON.stringify({openaiApiKey:p,anthropicApiKey:d,geminiApiKey:u,model:n||"claude-3-5-sonnet",extraFlags:s||"",workspaceRoot:i||"",scopedDirs:o||[]},null,2),"utf8"),g.NextResponse.json({success:!0,message:"Aider configuration saved successfully!"})}catch(t){let e=t instanceof Error?t.message:"Unknown error";return g.NextResponse.json({success:!1,error:e},{status:500})}}e.s(["GET",0,C,"POST",0,N],1935);var S=e.i(1935);let b=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/context/aider/route",pathname:"/api/context/aider",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/context/aider/route.ts",nextConfigOutput:"",userland:S,...{}}),{workAsyncStorage:k,workUnitAsyncStorage:K,serverHooks:j}=b;async function T(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),b.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/context/aider/route";g=g.replace(/\/index$/,"")||"/";let v=await b.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:m,deploymentId:A,params:w,nextConfig:E,parsedUrl:C,isDraftMode:N,prerenderManifest:S,routerServerContext:k,isOnDemandRevalidate:K,revalidateOnlyGenerated:j,resolvedPathname:T,clientReferenceManifest:q,serverActionsManifest:O}=v,P=(0,o.normalizeAppPath)(g),_=!!(S.dynamicRoutes[P]||S.routes[T]),D=async()=>((null==k?void 0:k.render404)?await k.render404(e,t,C,!1):t.end("This page could not be found"),null);if(_&&!N){let e=!!S.routes[T],t=S.dynamicRoutes[P];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await D();throw new y.NoFallbackError}}let I=null;!_||b.isDev||N||(I="/index"===(I=T)?"/":I);let U=!0===b.isDev||!_,F=_&&!U;O&&q&&(0,i.setManifestsSingleton)({page:g,clientReferenceManifest:q,serverActionsManifest:O});let H=e.method||"GET",M=(0,s.getTracer)(),$=M.getActiveScopeSpan(),B=!!(null==k?void 0:k.isWrappedByNextServer),L=!!(0,n.getRequestMeta)(e,"minimalMode"),G=(0,n.getRequestMeta)(e,"incrementalCache")||await b.getIncrementalCache(e,E,S,L);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let W={params:w,previewProps:S.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:U,incrementalCache:G,cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>b.onRequestError(e,t,a,n,k)},sharedContext:{buildId:m,deploymentId:A}},J=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),X=p.NextRequestAdapter.fromNodeNextRequest(J,(0,p.signalFromNodeResponse)(t));try{let n,i=async e=>b.handle(X,W).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=M.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${H} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),n&&n!==e&&(n.setAttribute("http.route",a),n.updateName(t))}else e.updateName(`${H} ${g}`)}),o=async n=>{var s,o;let l=async({previousCacheEntry:r})=>{try{if(!L&&K&&j&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=W.renderOpts.fetchMetrics;let o=W.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=W.renderOpts.collectedTags;if(!_)return await (0,c.sendResponse)(J,V,s,W.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,x.toNodeOutgoingHttpHeaders)(s.headers);l&&(t[f.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=f.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,a=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=f.INFINITE_CACHE?void 0:W.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:K})},!1,k),t}},p=await b.handleResponse({req:e,nextConfig:E,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:S,isRoutePPREnabled:!1,isOnDemandRevalidate:K,revalidateOnlyGenerated:j,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:L});if(!_)return null;if((null==p||null==(s=p.value)?void 0:s.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==p||null==(o=p.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});L||t.setHeader("x-nextjs-cache",K?"REVALIDATED":p.isMiss?"MISS":p.isStale?"STALE":"HIT"),N&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,x.fromNodeOutgoingHttpHeaders)(p.value.headers);return L&&_||d.delete(f.NEXT_CACHE_TAGS_HEADER),!p.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,h.getCacheControlHeader)(p.cacheControl)),await (0,c.sendResponse)(J,V,new Response(p.value.body,{headers:d,status:p.value.status||200})),null};B&&$?await o($):(n=M.getActiveScopeSpan(),await M.withPropagatedContext(e.headers,()=>M.trace(d.BaseServerSpan.handleRequest,{spanName:`${H} ${g}`,kind:s.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},o),void 0,!B))}catch(t){if(t instanceof y.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:P,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:K})},!1,k),_)throw t;return await (0,c.sendResponse)(J,V,new Response(null,{status:500})),null}}e.s(["handler",0,T,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:k,workUnitAsyncStorage:K})},"routeModule",0,b,"serverHooks",0,j,"workAsyncStorage",0,k,"workUnitAsyncStorage",0,K],523)}];
2
-
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__0efi5cr._.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/app/api/context/aider/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import { NextResponse } from \"next/server\";\nimport fs from \"fs\";\nimport path from \"path\";\n\nconst configDir = path.join(process.env.ORIGINAL_CWD || process.cwd(), \".ai\", \"neural-loom\");\nconst configPath = path.join(configDir, \"aider.json\");\n\nfunction ensureDir() {\n if (!fs.existsSync(configDir)) {\n fs.mkdirSync(configDir, { recursive: true });\n }\n}\n\nfunction maskKey(key: string): string {\n if (!key) return \"\";\n if (key.length <= 8) return \"********\";\n return `${key.slice(0, 6)}...${key.slice(-4)}`;\n}\n\nexport async function GET() {\n try {\n if (fs.existsSync(configPath)) {\n const rawData = fs.readFileSync(configPath, \"utf8\");\n const config = JSON.parse(rawData);\n \n return NextResponse.json({\n success: true,\n config: {\n openaiApiKey: config.openaiApiKey ? maskKey(config.openaiApiKey) : \"\",\n anthropicApiKey: config.anthropicApiKey ? maskKey(config.anthropicApiKey) : \"\",\n geminiApiKey: config.geminiApiKey ? maskKey(config.geminiApiKey) : \"\",\n model: config.model || \"claude-3-5-sonnet\",\n extraFlags: config.extraFlags || \"\",\n workspaceRoot: config.workspaceRoot || \"\",\n scopedDirs: config.scopedDirs || [],\n },\n });\n }\n\n return NextResponse.json({\n success: true,\n config: {\n openaiApiKey: \"\",\n anthropicApiKey: \"\",\n geminiApiKey: \"\",\n model: \"claude-3-5-sonnet\",\n extraFlags: \"\",\n workspaceRoot: \"\",\n scopedDirs: [],\n },\n });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error\";\n return NextResponse.json({ success: false, error: errorMessage }, { status: 500 });\n }\n}\n\nexport async function POST(request: Request) {\n try {\n const body = await request.json();\n const { openaiApiKey, anthropicApiKey, geminiApiKey, model, extraFlags, workspaceRoot, scopedDirs } = body;\n\n ensureDir();\n\n let existingConfig = {\n openaiApiKey: \"\",\n anthropicApiKey: \"\",\n geminiApiKey: \"\",\n model: \"claude-3-5-sonnet\",\n extraFlags: \"\",\n workspaceRoot: \"\",\n scopedDirs: [] as string[],\n };\n\n if (fs.existsSync(configPath)) {\n try {\n existingConfig = JSON.parse(fs.readFileSync(configPath, \"utf8\"));\n } catch (e) {\n console.error(\"Failed to parse existing aider.json:\", e);\n }\n }\n\n // Determine whether to use new keys or preserve existing ones if masked sentinels are received\n const finalOpenaiKey = (openaiApiKey && openaiApiKey.includes(\"...\")) \n ? existingConfig.openaiApiKey \n : (openaiApiKey || \"\");\n\n const finalAnthropicKey = (anthropicApiKey && anthropicApiKey.includes(\"...\")) \n ? existingConfig.anthropicApiKey \n : (anthropicApiKey || \"\");\n\n const finalGeminiKey = (geminiApiKey && geminiApiKey.includes(\"...\")) \n ? existingConfig.geminiApiKey \n : (geminiApiKey || \"\");\n\n const newConfig = {\n openaiApiKey: finalOpenaiKey,\n anthropicApiKey: finalAnthropicKey,\n geminiApiKey: finalGeminiKey,\n model: model || \"claude-3-5-sonnet\",\n extraFlags: extraFlags || \"\",\n workspaceRoot: workspaceRoot || \"\",\n scopedDirs: scopedDirs || [],\n };\n\n fs.writeFileSync(configPath, JSON.stringify(newConfig, null, 2), \"utf8\");\n return NextResponse.json({ success: true, message: \"Aider configuration saved successfully!\" });\n\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error\";\n return NextResponse.json({ success: false, error: errorMessage }, { status: 500 });\n }\n}\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/context/aider/route\",\n pathname: \"/api/context/aider\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/context/aider/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/context/aider/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId,\n deploymentId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":["configDir","join","process","env","ORIGINAL_CWD","cwd","configPath","ensureDir","existsSync","mkdirSync","recursive","maskKey","key","length","slice","GET","rawData","readFileSync","config","JSON","parse","json","success","openaiApiKey","anthropicApiKey","geminiApiKey","model","extraFlags","workspaceRoot","scopedDirs","existingConfig","error","errorMessage","Error","message","status","POST","request","body","e","console","finalOpenaiKey","includes","finalAnthropicKey","finalGeminiKey","newConfig","writeFileSync","stringify"],"mappings":"mmCCA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