neural-loom 0.2.12 → 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 (141) 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 +6 -5
  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/{14pu0yottw6p0.js → 06z14vx5drwj0.js} +2 -2
  100. package/.next/static/chunks/0b89ti7ob.09t.js +1 -0
  101. package/.next/static/chunks/0eidfx-s54367.js +1 -0
  102. package/.next/static/chunks/0ew-ei_k3d-qg.js +1 -0
  103. package/.next/static/chunks/0g45rn_9mbzt6.js +1 -0
  104. package/.next/static/chunks/0jxar8nsw_py3.js +1 -0
  105. package/.next/trace +1 -1
  106. package/.next/trace-build +1 -1
  107. package/.next/types/routes.d.ts +3 -1
  108. package/.next/types/validator.ts +18 -0
  109. package/package.json +1 -1
  110. package/src/app/api/context/aider/route.ts +37 -22
  111. package/src/app/api/context/claude/route.ts +28 -16
  112. package/src/app/api/recents/route.ts +34 -0
  113. package/src/app/api/sessions/launch/route.ts +12 -0
  114. package/src/app/api/sessions/scope/route.ts +139 -0
  115. package/src/app/components/AiderWizard.tsx +70 -4
  116. package/src/app/components/ClaudeWizard.tsx +70 -4
  117. package/src/app/components/IdeLayout.tsx +86 -12
  118. package/src/app/components/TerminalConsole.tsx +3 -3
  119. package/src/app/page.tsx +2 -1
  120. package/src/lib/agents/AgentRunner.ts +2 -0
  121. package/src/lib/agents/SessionManager.ts +62 -4
  122. package/src/lib/agents/SessionPersister.ts +57 -14
  123. package/src/lib/recents.ts +57 -0
  124. package/src/lib/workspaceParser.ts +40 -0
  125. package/.next/server/chunks/[root-of-the-server]__0e5cwnx._.js +0 -3
  126. package/.next/server/chunks/[root-of-the-server]__0e5cwnx._.js.map +0 -1
  127. package/.next/server/chunks/[root-of-the-server]__0efi5cr._.js +0 -3
  128. package/.next/server/chunks/[root-of-the-server]__0efi5cr._.js.map +0 -1
  129. package/.next/server/chunks/[root-of-the-server]__0ezygp7._.js +0 -15
  130. package/.next/server/chunks/[root-of-the-server]__0m7xwu2._.js +0 -15
  131. package/.next/server/chunks/[root-of-the-server]__0rd5ojc._.js +0 -15
  132. package/.next/server/chunks/[root-of-the-server]__0tl2n51._.js +0 -15
  133. package/.next/server/chunks/[root-of-the-server]__0y-63z8._.js +0 -15
  134. package/.next/server/chunks/[root-of-the-server]__0y-63z8._.js.map +0 -1
  135. package/.next/static/chunks/09.xgpyzqwrhv.js +0 -1
  136. package/.next/static/chunks/095uz52in_39t.js +0 -1
  137. package/.next/static/chunks/0ayrw9yot-bjb.js +0 -1
  138. package/.next/static/chunks/178yphwi3n~oc.js +0 -1
  139. /package/.next/static/{tvKY2oiwfjXnsPv5B4a3i → g7S_nNTPWKtmCY0Va4YcB}/_buildManifest.js +0 -0
  140. /package/.next/static/{tvKY2oiwfjXnsPv5B4a3i → g7S_nNTPWKtmCY0Va4YcB}/_clientMiddlewareManifest.js +0 -0
  141. /package/.next/static/{tvKY2oiwfjXnsPv5B4a3i → g7S_nNTPWKtmCY0Va4YcB}/_ssgManifest.js +0 -0
@@ -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") {
@@ -92,23 +94,79 @@ export class SessionManager {
92
94
 
93
95
  await runner.start();
94
96
  this.sessions.set(id, runner);
95
- SessionPersister.saveSession(runner);
97
+ SessionPersister.saveSession(runner, true);
96
98
  return runner;
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> {
108
166
  const runner = this.sessions.get(id);
109
167
  if (!runner) return false;
110
168
  await runner.stop();
111
- SessionPersister.saveSession(runner);
169
+ SessionPersister.saveSession(runner, true);
112
170
  return true;
113
171
  }
114
172
 
@@ -10,9 +10,13 @@ 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 {
17
+ private static pendingSaves = new Map<string, NodeJS.Timeout>();
18
+ private static pendingData = new Map<string, PersistedSession>();
19
+
16
20
  private static get workspaceRoot(): string {
17
21
  return process.env.ORIGINAL_CWD || process.cwd();
18
22
  }
@@ -25,23 +29,62 @@ export class SessionPersister {
25
29
  return dir;
26
30
  }
27
31
 
28
- public static saveSession(session: { id: string; name: string; type: string; status: string; createdAt: string; logs: string[]; workspaceRoot?: string; scopedDirs?: string[] }) {
32
+ public static saveSession(
33
+ session: { id: string; name: string; type: string; status: string; createdAt: string; logs: string[]; workspaceRoot?: string; scopedDirs?: string[]; lastSyncedWorkspaceFolders?: string[] },
34
+ immediate = false
35
+ ) {
36
+ const data: PersistedSession = {
37
+ id: session.id,
38
+ name: session.name,
39
+ type: session.type,
40
+ status: (session.status === 'running' && session.type === 'mock') ? 'running' : session.status as 'idle' | 'running' | 'stopped', // Mock sessions can persist as running or restart
41
+ createdAt: session.createdAt,
42
+ logs: session.logs,
43
+ workspaceRoot: session.workspaceRoot,
44
+ scopedDirs: session.scopedDirs,
45
+ lastSyncedWorkspaceFolders: session.lastSyncedWorkspaceFolders
46
+ };
47
+
48
+ if (immediate) {
49
+ // Clear any pending debounced save
50
+ const timer = this.pendingSaves.get(session.id);
51
+ if (timer) {
52
+ clearTimeout(timer);
53
+ this.pendingSaves.delete(session.id);
54
+ }
55
+ this.pendingData.delete(session.id);
56
+ this.writeToDisk(session.id, data);
57
+ return;
58
+ }
59
+
60
+ // Update pending data
61
+ this.pendingData.set(session.id, data);
62
+
63
+ // Schedule save if not already scheduled
64
+ if (!this.pendingSaves.has(session.id)) {
65
+ const timer = setTimeout(() => {
66
+ this.pendingSaves.delete(session.id);
67
+ const dataToWrite = this.pendingData.get(session.id);
68
+ if (dataToWrite) {
69
+ this.pendingData.delete(session.id);
70
+ this.writeToDisk(session.id, dataToWrite);
71
+ }
72
+ }, 1000); // 1-second debounce
73
+ this.pendingSaves.set(session.id, timer);
74
+ }
75
+ }
76
+
77
+ private static writeToDisk(id: string, data: PersistedSession) {
29
78
  try {
30
79
  const dir = this.getSessionsDir();
31
- const filePath = path.join(dir, `${session.id}.json`);
32
- const data: PersistedSession = {
33
- id: session.id,
34
- name: session.name,
35
- type: session.type,
36
- status: (session.status === 'running' && session.type === 'mock') ? 'running' : session.status as 'idle' | 'running' | 'stopped', // Mock sessions can persist as running or restart
37
- createdAt: session.createdAt,
38
- logs: session.logs,
39
- workspaceRoot: session.workspaceRoot,
40
- scopedDirs: session.scopedDirs
41
- };
42
- fs.writeFileSync(filePath, JSON.stringify(data, null, 2), "utf8");
80
+ const filePath = path.join(dir, `${id}.json`);
81
+ fs.writeFile(filePath, JSON.stringify(data, null, 2), "utf8", (err) => {
82
+ if (err) {
83
+ console.error(`[SessionPersister] Failed to save session ${id} asynchronously:`, err);
84
+ }
85
+ });
43
86
  } catch (err) {
44
- console.error(`[SessionPersister] Failed to save session ${session.id}:`, err);
87
+ console.error(`[SessionPersister] Failed to save session ${id}:`, err);
45
88
  }
46
89
  }
47
90
 
@@ -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,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ChC,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAChC,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,GAAyB,EACzB,MAAM,EAAe,EADgB,EAGrC,EAAa,EAAO,kBAAkB,GACtC,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,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":"mmCCAA,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,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,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,CAAA,CAAA,OAAA,IAAA,EAAA,EAAA,CAAA,CAAA,KDhBA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAEA,IAAMA,EAAY,EAAA,OAAI,CAACC,IAAI,CAACC,QAAQC,GAAG,CAACC,YAAY,EAAIF,QAAQG,GAAG,GAAI,MAAO,eACxEC,EAAa,EAAA,OAAI,CAACL,IAAI,CAACD,EAAW,cAQxC,SAASW,EAAQC,CAAW,SAC1B,AAAKA,EACDA,EAAIC,AADJ,CAAM,KACI,EAAI,EAAU,CAAP,UACd,CAAA,EAAGD,EAAIE,KAAK,CAAC,EAAG,GAAG,GAAG,EAAEF,EAAIE,KAAK,CAAC,CAAC,GAAA,CAAI,CAF7B,EAGnB,CAEO,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
@@ -1,15 +0,0 @@
1
- module.exports=[24361,(e,t,r)=>{t.exports=e.x("util",()=>require("util"))},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"))},46619,e=>{"use strict";var t=e.i(22734),r=e.i(14747);e.s(["ContextManager",0,class{static get workspaceRoot(){return process.env.ORIGINAL_CWD||process.cwd()}static ensureDirs(e){let a=r.default.join(e,".ai","neural-loom");t.default.existsSync(a)||t.default.mkdirSync(a,{recursive:!0});let s=r.default.join(e,".claude","commands");t.default.existsSync(s)||t.default.mkdirSync(s,{recursive:!0})}static initializeStaging(e=process.env.ORIGINAL_CWD||process.cwd()){this.ensureDirs(e);let a=r.default.join(e,".claude","commands","ccp.md");t.default.existsSync(a)||t.default.writeFileSync(a,"Read the prompt from .ai/neural-loom/cprompt.md and execute it. This is a staged prompt from the NeuralLoom UI. Treat the contents as user instructions.\n");let s=r.default.join(e,".claude","commands","ccc.md");t.default.existsSync(s)||t.default.writeFileSync(s,"Read the context from .ai/neural-loom/ccontext.md. This is persistent context from the NeuralLoom UI. Absorb it as background information for this session. Acknowledge briefly what you received.\n")}static updatePrompt(e,a=process.env.ORIGINAL_CWD||process.cwd()){this.ensureDirs(a);let s=r.default.join(a,".ai","neural-loom","cprompt.md");t.default.writeFileSync(s,e)}static updateContext(e,a=process.env.ORIGINAL_CWD||process.cwd()){this.ensureDirs(a);let s=r.default.join(a,".ai","neural-loom","ccontext.md");t.default.writeFileSync(s,e)}static updateRules(e,a=process.env.ORIGINAL_CWD||process.cwd()){this.ensureDirs(a);let s=r.default.join(a,"AGENTS.md");t.default.writeFileSync(s,e,"utf8")}static loadPrompt(e=process.env.ORIGINAL_CWD||process.cwd()){let a=r.default.join(e,".ai","neural-loom","cprompt.md");return t.default.existsSync(a)?t.default.readFileSync(a,"utf8"):""}static loadRules(e=process.env.ORIGINAL_CWD||process.cwd()){let a=r.default.join(e,"AGENTS.md");return t.default.existsSync(a)?t.default.readFileSync(a,"utf8"):""}static compileGlobalRules(){this.compileSessionContext()}static compileSessionContext(e=process.env.ORIGINAL_CWD||process.cwd(),a){this.ensureDirs(e),this.initializeStaging(e);let s=r.default.join(e,"AGENTS.md"),n="";if(t.default.existsSync(s))n=t.default.readFileSync(s,"utf8");else{let e=r.default.join(this.workspaceRoot,"AGENTS.md");t.default.existsSync(e)&&(n=t.default.readFileSync(e,"utf8"))}let i=`## Workspace Root Map (${e}):
2
- ${this.generateProjectMapFor(e)}`;a&&Array.isArray(a)&&a.forEach(e=>{t.default.existsSync(e)&&(i+=`
3
-
4
- ## Scoped Directory Map (${e}):
5
- ${this.generateProjectMapFor(e)}`)});let o=`# System Rules & Guidelines
6
-
7
- ${n}
8
-
9
- # Project File Hierarchy Map
10
-
11
- ${i}`;this.updateContext(o,e);let l=r.default.join(e,".ai","neural-loom","cprompt.md");t.default.existsSync(l)||t.default.writeFileSync(l,"Hello! Please review the project context (/ccc) and check for any tasks to execute.")}static generateProjectMapFor(e){try{let a=(e,s=0)=>{if(s>2)return"";let n="";for(let i of t.default.readdirSync(e,{withFileTypes:!0})){if(i.name.startsWith(".")||"node_modules"===i.name||"out"===i.name||".next"===i.name)continue;let t=" ".repeat(s);i.isDirectory()?(n+=`${t}- [Dir] ${i.name}/
12
- `,n+=a(r.default.join(e,i.name),s+1)):n+=`${t}- [File] ${i.name}
13
- `}return n};return a(e)}catch(e){return"Error generating project map: "+(e instanceof Error?e.message:String(e))}}}])},99762,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),s=e.i(59756),n=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),u=e.i(87718),c=e.i(95169),d=e.i(47587),p=e.i(66012),f=e.i(70101),h=e.i(26937),m=e.i(10372),x=e.i(93695);e.i(52474);var R=e.i(220),v=e.i(89171),y=e.i(29307);async function g(e){try{let{type:t,name:r,workspaceRoot:a,scopedDirs:s}=await e.json(),n=["mock","claude","claude-docker","claude-ssh","aider","aider-docker"];if(!t||!n.includes(t))return v.NextResponse.json({error:`Invalid type. Must be one of: ${n.join(", ")}`},{status:400});let i=y.SessionManager.getInstance(),o=await i.createSession(t,r,a,s);return v.NextResponse.json({success:!0,session:o.getStatus()})}catch(t){let e=t instanceof Error?t.message:"Unknown error";return v.NextResponse.json({error:e},{status:500})}}e.s(["POST",0,g],7233);var w=e.i(7233);let S=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sessions/launch/route",pathname:"/api/sessions/launch",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/sessions/launch/route.ts",nextConfigOutput:"",userland:w,...{}}),{workAsyncStorage:C,workUnitAsyncStorage:E,serverHooks:A}=S;async function N(e,t,a){a.requestMeta&&(0,s.setRequestMeta)(e,a.requestMeta),S.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/sessions/launch/route";v=v.replace(/\/index$/,"")||"/";let y=await S.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:g,deploymentId:w,params:C,nextConfig:E,parsedUrl:A,isDraftMode:N,prerenderManifest:j,routerServerContext:I,isOnDemandRevalidate:b,revalidateOnlyGenerated:k,resolvedPathname:T,clientReferenceManifest:P,serverActionsManifest:_}=y,D=(0,o.normalizeAppPath)(v),O=!!(j.dynamicRoutes[D]||j.routes[T]),q=async()=>((null==I?void 0:I.render404)?await I.render404(e,t,A,!1):t.end("This page could not be found"),null);if(O&&!N){let e=!!j.routes[T],t=j.dynamicRoutes[D];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await q();throw new x.NoFallbackError}}let F=null;!O||S.isDev||N||(F="/index"===(F=T)?"/":F);let M=!0===S.isDev||!O,$=O&&!M;_&&P&&(0,i.setManifestsSingleton)({page:v,clientReferenceManifest:P,serverActionsManifest:_});let H=e.method||"GET",U=(0,n.getTracer)(),G=U.getActiveScopeSpan(),L=!!(null==I?void 0:I.isWrappedByNextServer),W=!!(0,s.getRequestMeta)(e,"minimalMode"),K=(0,s.getRequestMeta)(e,"incrementalCache")||await S.getIncrementalCache(e,E,j,W);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let B={params:C,previewProps:j.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:M,incrementalCache:K,cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,s)=>S.onRequestError(e,t,a,s,I)},sharedContext:{buildId:g,deploymentId:w}},z=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),X=u.NextRequestAdapter.fromNodeNextRequest(z,(0,u.signalFromNodeResponse)(t));try{let s,i=async e=>S.handle(X,B).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=U.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==c.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),s&&s!==e&&(s.setAttribute("http.route",a),s.updateName(t))}else e.updateName(`${H} ${v}`)}),o=async s=>{var n,o;let l=async({previousCacheEntry:r})=>{try{if(!W&&b&&k&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await i(s);e.fetchMetrics=B.renderOpts.fetchMetrics;let o=B.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=B.renderOpts.collectedTags;if(!O)return await (0,p.sendResponse)(z,V,n,B.renderOpts.pendingWaitUntil),null;{let e=await n.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(n.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,a=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:B.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:n.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:v,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:b})},!1,I),t}},u=await S.handleResponse({req:e,nextConfig:E,cacheKey:F,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:j,isRoutePPREnabled:!1,isOnDemandRevalidate:b,revalidateOnlyGenerated:k,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:W});if(!O)return null;if((null==u||null==(n=u.value)?void 0:n.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(o=u.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});W||t.setHeader("x-nextjs-cache",b?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),N&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let c=(0,f.fromNodeOutgoingHttpHeaders)(u.value.headers);return W&&O||c.delete(m.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||c.get("Cache-Control")||c.set("Cache-Control",(0,h.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(z,V,new Response(u.value.body,{headers:c,status:u.value.status||200})),null};L&&G?await o(G):(s=U.getActiveScopeSpan(),await U.withPropagatedContext(e.headers,()=>U.trace(c.BaseServerSpan.handleRequest,{spanName:`${H} ${v}`,kind:n.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},o),void 0,!L))}catch(t){if(t instanceof x.NoFallbackError||await S.onRequestError(e,t,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:b})},!1,I),O)throw t;return await (0,p.sendResponse)(z,V,new Response(null,{status:500})),null}}e.s(["handler",0,N,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:E})},"routeModule",0,S,"serverHooks",0,A,"workAsyncStorage",0,C,"workUnitAsyncStorage",0,E],99762)}];
14
-
15
- //# sourceMappingURL=%5Broot-of-the-server%5D__0ezygp7._.js.map
@@ -1,15 +0,0 @@
1
- module.exports=[24361,(e,t,r)=>{t.exports=e.x("util",()=>require("util"))},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"))},46619,e=>{"use strict";var t=e.i(22734),r=e.i(14747);e.s(["ContextManager",0,class{static get workspaceRoot(){return process.env.ORIGINAL_CWD||process.cwd()}static ensureDirs(e){let a=r.default.join(e,".ai","neural-loom");t.default.existsSync(a)||t.default.mkdirSync(a,{recursive:!0});let s=r.default.join(e,".claude","commands");t.default.existsSync(s)||t.default.mkdirSync(s,{recursive:!0})}static initializeStaging(e=process.env.ORIGINAL_CWD||process.cwd()){this.ensureDirs(e);let a=r.default.join(e,".claude","commands","ccp.md");t.default.existsSync(a)||t.default.writeFileSync(a,"Read the prompt from .ai/neural-loom/cprompt.md and execute it. This is a staged prompt from the NeuralLoom UI. Treat the contents as user instructions.\n");let s=r.default.join(e,".claude","commands","ccc.md");t.default.existsSync(s)||t.default.writeFileSync(s,"Read the context from .ai/neural-loom/ccontext.md. This is persistent context from the NeuralLoom UI. Absorb it as background information for this session. Acknowledge briefly what you received.\n")}static updatePrompt(e,a=process.env.ORIGINAL_CWD||process.cwd()){this.ensureDirs(a);let s=r.default.join(a,".ai","neural-loom","cprompt.md");t.default.writeFileSync(s,e)}static updateContext(e,a=process.env.ORIGINAL_CWD||process.cwd()){this.ensureDirs(a);let s=r.default.join(a,".ai","neural-loom","ccontext.md");t.default.writeFileSync(s,e)}static updateRules(e,a=process.env.ORIGINAL_CWD||process.cwd()){this.ensureDirs(a);let s=r.default.join(a,"AGENTS.md");t.default.writeFileSync(s,e,"utf8")}static loadPrompt(e=process.env.ORIGINAL_CWD||process.cwd()){let a=r.default.join(e,".ai","neural-loom","cprompt.md");return t.default.existsSync(a)?t.default.readFileSync(a,"utf8"):""}static loadRules(e=process.env.ORIGINAL_CWD||process.cwd()){let a=r.default.join(e,"AGENTS.md");return t.default.existsSync(a)?t.default.readFileSync(a,"utf8"):""}static compileGlobalRules(){this.compileSessionContext()}static compileSessionContext(e=process.env.ORIGINAL_CWD||process.cwd(),a){this.ensureDirs(e),this.initializeStaging(e);let s=r.default.join(e,"AGENTS.md"),n="";if(t.default.existsSync(s))n=t.default.readFileSync(s,"utf8");else{let e=r.default.join(this.workspaceRoot,"AGENTS.md");t.default.existsSync(e)&&(n=t.default.readFileSync(e,"utf8"))}let i=`## Workspace Root Map (${e}):
2
- ${this.generateProjectMapFor(e)}`;a&&Array.isArray(a)&&a.forEach(e=>{t.default.existsSync(e)&&(i+=`
3
-
4
- ## Scoped Directory Map (${e}):
5
- ${this.generateProjectMapFor(e)}`)});let o=`# System Rules & Guidelines
6
-
7
- ${n}
8
-
9
- # Project File Hierarchy Map
10
-
11
- ${i}`;this.updateContext(o,e);let l=r.default.join(e,".ai","neural-loom","cprompt.md");t.default.existsSync(l)||t.default.writeFileSync(l,"Hello! Please review the project context (/ccc) and check for any tasks to execute.")}static generateProjectMapFor(e){try{let a=(e,s=0)=>{if(s>2)return"";let n="";for(let i of t.default.readdirSync(e,{withFileTypes:!0})){if(i.name.startsWith(".")||"node_modules"===i.name||"out"===i.name||".next"===i.name)continue;let t=" ".repeat(s);i.isDirectory()?(n+=`${t}- [Dir] ${i.name}/
12
- `,n+=a(r.default.join(e,i.name),s+1)):n+=`${t}- [File] ${i.name}
13
- `}return n};return a(e)}catch(e){return"Error generating project map: "+(e instanceof Error?e.message:String(e))}}}])},71188,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),s=e.i(59756),n=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),m=e.i(26937),h=e.i(10372),x=e.i(93695);e.i(52474);var R=e.i(220),v=e.i(89171),y=e.i(29307);async function g(e){try{let{id:t,delete:r}=await e.json();if(!t)return v.NextResponse.json({error:"Missing required field 'id'."},{status:400});let a=y.SessionManager.getInstance();if(r){let e=await a.deleteSession(t);return v.NextResponse.json({success:e})}{let e=await a.stopSession(t);return v.NextResponse.json({success:e})}}catch(t){let e=t instanceof Error?t.message:"Unknown error";return v.NextResponse.json({error:e},{status:500})}}e.s(["POST",0,g],64662);var w=e.i(64662);let S=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/sessions/stop/route",pathname:"/api/sessions/stop",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/sessions/stop/route.ts",nextConfigOutput:"",userland:w,...{}}),{workAsyncStorage:C,workUnitAsyncStorage:E,serverHooks:A}=S;async function N(e,t,a){a.requestMeta&&(0,s.setRequestMeta)(e,a.requestMeta),S.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/sessions/stop/route";v=v.replace(/\/index$/,"")||"/";let y=await S.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:g,deploymentId:w,params:C,nextConfig:E,parsedUrl:A,isDraftMode:N,prerenderManifest:j,routerServerContext:I,isOnDemandRevalidate:b,revalidateOnlyGenerated:T,resolvedPathname:P,clientReferenceManifest:k,serverActionsManifest:_}=y,D=(0,o.normalizeAppPath)(v),O=!!(j.dynamicRoutes[D]||j.routes[P]),q=async()=>((null==I?void 0:I.render404)?await I.render404(e,t,A,!1):t.end("This page could not be found"),null);if(O&&!N){let e=!!j.routes[P],t=j.dynamicRoutes[D];if(t&&!1===t.fallback&&!e){if(E.adapterPath)return await q();throw new x.NoFallbackError}}let F=null;!O||S.isDev||N||(F="/index"===(F=P)?"/":F);let M=!0===S.isDev||!O,H=O&&!M;_&&k&&(0,i.setManifestsSingleton)({page:v,clientReferenceManifest:k,serverActionsManifest:_});let U=e.method||"GET",$=(0,n.getTracer)(),G=$.getActiveScopeSpan(),L=!!(null==I?void 0:I.isWrappedByNextServer),W=!!(0,s.getRequestMeta)(e,"minimalMode"),K=(0,s.getRequestMeta)(e,"incrementalCache")||await S.getIncrementalCache(e,E,j,W);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let B={params:C,previewProps:j.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts},cacheComponents:!!E.cacheComponents,supportsDynamicResponse:M,incrementalCache:K,cacheLifeProfiles:E.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,s)=>S.onRequestError(e,t,a,s,I)},sharedContext:{buildId:g,deploymentId:w}},z=new l.NodeNextRequest(e),V=new l.NodeNextResponse(t),X=d.NextRequestAdapter.fromNodeNextRequest(z,(0,d.signalFromNodeResponse)(t));try{let s,i=async e=>S.handle(X,B).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.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=`${U} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t),s&&s!==e&&(s.setAttribute("http.route",a),s.updateName(t))}else e.updateName(`${U} ${v}`)}),o=async s=>{var n,o;let l=async({previousCacheEntry:r})=>{try{if(!W&&b&&T&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await i(s);e.fetchMetrics=B.renderOpts.fetchMetrics;let o=B.renderOpts.pendingWaitUntil;o&&a.waitUntil&&(a.waitUntil(o),o=void 0);let l=B.renderOpts.collectedTags;if(!O)return await (0,p.sendResponse)(z,V,n,B.renderOpts.pendingWaitUntil),null;{let e=await n.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(n.headers);l&&(t[h.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,a=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=h.INFINITE_CACHE?void 0:B.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:n.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:v,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:b})},!1,I),t}},d=await S.handleResponse({req:e,nextConfig:E,cacheKey:F,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:j,isRoutePPREnabled:!1,isOnDemandRevalidate:b,revalidateOnlyGenerated:T,responseGenerator:l,waitUntil:a.waitUntil,isMinimalMode:W});if(!O)return null;if((null==d||null==(n=d.value)?void 0:n.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(o=d.value)?void 0:o.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});W||t.setHeader("x-nextjs-cache",b?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),N&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return W&&O||u.delete(h.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,m.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(z,V,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};L&&G?await o(G):(s=$.getActiveScopeSpan(),await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${U} ${v}`,kind:n.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},o),void 0,!L))}catch(t){if(t instanceof x.NoFallbackError||await S.onRequestError(e,t,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:b})},!1,I),O)throw t;return await (0,p.sendResponse)(z,V,new Response(null,{status:500})),null}}e.s(["handler",0,N,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:C,workUnitAsyncStorage:E})},"routeModule",0,S,"serverHooks",0,A,"workAsyncStorage",0,C,"workUnitAsyncStorage",0,E],71188)}];
14
-
15
- //# sourceMappingURL=%5Broot-of-the-server%5D__0m7xwu2._.js.map