sparkecoder 0.1.32 → 0.1.34

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 (102) hide show
  1. package/dist/agent/index.d.ts +2 -2
  2. package/dist/agent/index.js +10 -10
  3. package/dist/agent/index.js.map +1 -1
  4. package/dist/cli.js +48 -17
  5. package/dist/cli.js.map +1 -1
  6. package/dist/{index-CsZVebwZ.d.ts → index-BSbFzE22.d.ts} +2 -2
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.js +10 -10
  9. package/dist/index.js.map +1 -1
  10. package/dist/{search-Bk0sOPXw.d.ts → search-CrICQDSa.d.ts} +4 -4
  11. package/dist/server/index.js +10 -10
  12. package/dist/server/index.js.map +1 -1
  13. package/dist/tools/index.d.ts +3 -3
  14. package/dist/tools/index.js +4 -4
  15. package/dist/tools/index.js.map +1 -1
  16. package/package.json +1 -1
  17. package/web/.next/BUILD_ID +1 -1
  18. package/web/.next/standalone/web/.next/BUILD_ID +1 -1
  19. package/web/.next/standalone/web/.next/build-manifest.json +2 -2
  20. package/web/.next/standalone/web/.next/prerender-manifest.json +3 -3
  21. package/web/.next/standalone/web/.next/server/app/(main)/session/[id]/page_client-reference-manifest.js +1 -1
  22. package/web/.next/standalone/web/.next/server/app/_global-error.html +2 -2
  23. package/web/.next/standalone/web/.next/server/app/_global-error.rsc +1 -1
  24. package/web/.next/standalone/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  25. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  26. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  27. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  28. package/web/.next/standalone/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  29. package/web/.next/standalone/web/.next/server/app/_not-found.html +1 -1
  30. package/web/.next/standalone/web/.next/server/app/_not-found.rsc +1 -1
  31. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  32. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  33. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  34. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  35. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  36. package/web/.next/standalone/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  37. package/web/.next/standalone/web/.next/server/app/docs/installation.html +2 -2
  38. package/web/.next/standalone/web/.next/server/app/docs/installation.rsc +1 -1
  39. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_full.segment.rsc +1 -1
  40. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_head.segment.rsc +1 -1
  41. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_index.segment.rsc +1 -1
  42. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_tree.segment.rsc +1 -1
  43. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation/__PAGE__.segment.rsc +1 -1
  44. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation.segment.rsc +1 -1
  45. package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs.segment.rsc +1 -1
  46. package/web/.next/standalone/web/.next/server/app/docs/skills.html +2 -2
  47. package/web/.next/standalone/web/.next/server/app/docs/skills.rsc +1 -1
  48. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_full.segment.rsc +1 -1
  49. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_head.segment.rsc +1 -1
  50. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_index.segment.rsc +1 -1
  51. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_tree.segment.rsc +1 -1
  52. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills/__PAGE__.segment.rsc +1 -1
  53. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills.segment.rsc +1 -1
  54. package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs.segment.rsc +1 -1
  55. package/web/.next/standalone/web/.next/server/app/docs/tools.html +7 -7
  56. package/web/.next/standalone/web/.next/server/app/docs/tools.rsc +5 -5
  57. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_full.segment.rsc +5 -5
  58. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_head.segment.rsc +1 -1
  59. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_index.segment.rsc +1 -1
  60. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_tree.segment.rsc +1 -1
  61. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools/__PAGE__.segment.rsc +5 -5
  62. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools.segment.rsc +1 -1
  63. package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs.segment.rsc +1 -1
  64. package/web/.next/standalone/web/.next/server/app/docs.html +3 -3
  65. package/web/.next/standalone/web/.next/server/app/docs.rsc +2 -2
  66. package/web/.next/standalone/web/.next/server/app/docs.segments/_full.segment.rsc +2 -2
  67. package/web/.next/standalone/web/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  68. package/web/.next/standalone/web/.next/server/app/docs.segments/_index.segment.rsc +1 -1
  69. package/web/.next/standalone/web/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
  70. package/web/.next/standalone/web/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +2 -2
  71. package/web/.next/standalone/web/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  72. package/web/.next/standalone/web/.next/server/app/index.html +1 -1
  73. package/web/.next/standalone/web/.next/server/app/index.rsc +1 -1
  74. package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p/__PAGE__.segment.rsc +1 -1
  75. package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p.segment.rsc +1 -1
  76. package/web/.next/standalone/web/.next/server/app/index.segments/_full.segment.rsc +1 -1
  77. package/web/.next/standalone/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
  78. package/web/.next/standalone/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
  79. package/web/.next/standalone/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  80. package/web/.next/standalone/web/.next/server/chunks/ssr/[root-of-the-server]__2dbf511a._.js +1 -1
  81. package/web/.next/standalone/web/.next/server/chunks/ssr/[root-of-the-server]__397fadd4._.js +1 -1
  82. package/web/.next/standalone/web/.next/server/chunks/ssr/[root-of-the-server]__f764bebe._.js +1 -1
  83. package/web/.next/standalone/web/.next/server/pages/404.html +1 -1
  84. package/web/.next/standalone/web/.next/server/pages/500.html +2 -2
  85. package/web/.next/standalone/web/.next/server/server-reference-manifest.js +1 -1
  86. package/web/.next/standalone/web/.next/server/server-reference-manifest.json +1 -1
  87. package/web/.next/standalone/web/.next/static/chunks/{ce505264d78c8eff.js → 9e2f49d8736aeb05.js} +1 -1
  88. package/web/.next/standalone/web/.next/static/static/chunks/{ce505264d78c8eff.js → 9e2f49d8736aeb05.js} +1 -1
  89. package/web/.next/standalone/web/src/app/docs/page.mdx +1 -1
  90. package/web/.next/standalone/web/src/app/docs/tools/page.mdx +5 -5
  91. package/web/.next/standalone/web/src/components/ai-elements/search-tool.tsx +4 -4
  92. package/web/.next/standalone/web/src/components/chat-interface.tsx +36 -36
  93. package/web/.next/static/chunks/{ce505264d78c8eff.js → 9e2f49d8736aeb05.js} +1 -1
  94. /package/web/.next/standalone/web/.next/static/{4Qd7gbyP-9Akkkk8I1vrs → bk6IEoUxuLyCjrNYkiMkB}/_buildManifest.js +0 -0
  95. /package/web/.next/standalone/web/.next/static/{4Qd7gbyP-9Akkkk8I1vrs → bk6IEoUxuLyCjrNYkiMkB}/_clientMiddlewareManifest.json +0 -0
  96. /package/web/.next/standalone/web/.next/static/{4Qd7gbyP-9Akkkk8I1vrs → bk6IEoUxuLyCjrNYkiMkB}/_ssgManifest.js +0 -0
  97. /package/web/.next/standalone/web/.next/static/static/{4Qd7gbyP-9Akkkk8I1vrs → bk6IEoUxuLyCjrNYkiMkB}/_buildManifest.js +0 -0
  98. /package/web/.next/standalone/web/.next/static/static/{4Qd7gbyP-9Akkkk8I1vrs → bk6IEoUxuLyCjrNYkiMkB}/_clientMiddlewareManifest.json +0 -0
  99. /package/web/.next/standalone/web/.next/static/static/{4Qd7gbyP-9Akkkk8I1vrs → bk6IEoUxuLyCjrNYkiMkB}/_ssgManifest.js +0 -0
  100. /package/web/.next/static/{4Qd7gbyP-9Akkkk8I1vrs → bk6IEoUxuLyCjrNYkiMkB}/_buildManifest.js +0 -0
  101. /package/web/.next/static/{4Qd7gbyP-9Akkkk8I1vrs → bk6IEoUxuLyCjrNYkiMkB}/_clientMiddlewareManifest.json +0 -0
  102. /package/web/.next/static/{4Qd7gbyP-9Akkkk8I1vrs → bk6IEoUxuLyCjrNYkiMkB}/_ssgManifest.js +0 -0
package/dist/cli.js CHANGED
@@ -3744,7 +3744,7 @@ function createSearchSubagent(model) {
3744
3744
  var MAX_RESULT_CHARS = 8e3;
3745
3745
  function createSearchTool(options) {
3746
3746
  return tool8({
3747
- description: `Delegate a search task to a specialized Explore agent. Use this when you need to:
3747
+ description: `Delegate an explore task to the explore_agent tool. Use this when you need to:
3748
3748
  - Find files or code matching a pattern
3749
3749
  - Explore the codebase structure
3750
3750
  - Search for specific functions, classes, or variables
@@ -3763,7 +3763,7 @@ Examples:
3763
3763
  context: z9.string().optional().describe("Optional additional context about why you need this information.")
3764
3764
  }),
3765
3765
  execute: async ({ query, context }, toolOptions) => {
3766
- const toolCallId = toolOptions.toolCallId || `search_${Date.now()}`;
3766
+ const toolCallId = toolOptions.toolCallId || `explore_agent_${Date.now()}`;
3767
3767
  await options.onProgress?.({
3768
3768
  status: "started",
3769
3769
  subagentId: toolCallId
@@ -3812,7 +3812,7 @@ Context: ${context}` : query;
3812
3812
  };
3813
3813
  }
3814
3814
  const searchResult = result.result;
3815
- let formattedResult = `## Explore Results
3815
+ let formattedResult = `## Explore Agent Results
3816
3816
 
3817
3817
  `;
3818
3818
  formattedResult += `**Summary:** ${searchResult.summary}
@@ -4445,6 +4445,14 @@ import { relative as relative7 } from "path";
4445
4445
  import { minimatch as minimatch2 } from "minimatch";
4446
4446
  var MAX_FILE_SIZE3 = 1024 * 1024;
4447
4447
  var EMBEDDING_BATCH_SIZE = 50;
4448
+ var EMBEDDING_CONCURRENCY = 5;
4449
+ function parsePositiveInt(value, fallback) {
4450
+ const parsed = Number(value);
4451
+ if (!Number.isFinite(parsed) || parsed <= 0) {
4452
+ return fallback;
4453
+ }
4454
+ return Math.floor(parsed);
4455
+ }
4448
4456
  function isPathExcluded(relativePath, exclude) {
4449
4457
  return exclude.some((pattern) => {
4450
4458
  if (minimatch2(relativePath, pattern, { dot: true })) {
@@ -4628,11 +4636,22 @@ async function indexRepository(options) {
4628
4636
  reportProgress();
4629
4637
  const embeddingModel = getEmbeddingModel();
4630
4638
  let failedChunks = 0;
4631
- const totalBatches = Math.ceil(newChunks.length / EMBEDDING_BATCH_SIZE);
4632
- console.log(`[indexer] Starting embedding: ${newChunks.length} chunks in ${totalBatches} batches`);
4633
- for (let i = 0; i < newChunks.length; i += EMBEDDING_BATCH_SIZE) {
4634
- const batchNum = Math.floor(i / EMBEDDING_BATCH_SIZE) + 1;
4635
- const batch = newChunks.slice(i, i + EMBEDDING_BATCH_SIZE);
4639
+ const batchSize = parsePositiveInt(process.env.SPARKECODER_INDEX_BATCH_SIZE, EMBEDDING_BATCH_SIZE);
4640
+ const concurrency = parsePositiveInt(process.env.SPARKECODER_INDEX_CONCURRENCY, EMBEDDING_CONCURRENCY);
4641
+ const totalBatches = Math.ceil(newChunks.length / batchSize);
4642
+ console.log(
4643
+ `[indexer] Starting embedding: ${newChunks.length} chunks in ${totalBatches} batches (batchSize=${batchSize}, concurrency=${concurrency})`
4644
+ );
4645
+ const batches = newChunks.reduce((acc, chunk, index) => {
4646
+ if (index % batchSize === 0) {
4647
+ acc.push({
4648
+ batchNum: Math.floor(index / batchSize) + 1,
4649
+ batch: newChunks.slice(index, index + batchSize)
4650
+ });
4651
+ }
4652
+ return acc;
4653
+ }, []);
4654
+ const processBatch = async (batchNum, batch) => {
4636
4655
  console.log(`[indexer] Batch ${batchNum}/${totalBatches}: embedding ${batch.length} chunks...`);
4637
4656
  const batchStartTime = Date.now();
4638
4657
  try {
@@ -4687,9 +4706,21 @@ async function indexRepository(options) {
4687
4706
  const errorMsg = error instanceof Error ? error.message : String(error);
4688
4707
  console.error(`[indexer] Batch ${batchNum}: ERROR - ${errorMsg}`);
4689
4708
  errors.push({ file: `batch ${batchNum}`, error: errorMsg });
4709
+ } finally {
4710
+ reportProgress();
4690
4711
  }
4691
- reportProgress();
4692
- }
4712
+ };
4713
+ let nextBatchIndex = 0;
4714
+ const workerCount = Math.min(concurrency, batches.length);
4715
+ const workers = Array.from({ length: workerCount }, async () => {
4716
+ while (nextBatchIndex < batches.length) {
4717
+ const currentIndex = nextBatchIndex;
4718
+ nextBatchIndex += 1;
4719
+ const { batchNum, batch } = batches[currentIndex];
4720
+ await processBatch(batchNum, batch);
4721
+ }
4722
+ });
4723
+ await Promise.all(workers);
4693
4724
  console.log(`[indexer] Embedding complete. Updating index status...`);
4694
4725
  try {
4695
4726
  console.log(`[indexer] Calling indexStatusQueries.upsert with totalChunks: ${allChunks.length}`);
@@ -4923,7 +4954,7 @@ async function createTools(options) {
4923
4954
  linter: createLinterTool({
4924
4955
  workingDirectory: options.workingDirectory
4925
4956
  }),
4926
- search: createSearchTool({
4957
+ explore_agent: createSearchTool({
4927
4958
  sessionId: options.sessionId,
4928
4959
  workingDirectory: options.workingDirectory,
4929
4960
  onProgress: options.onSearchProgress
@@ -5015,7 +5046,7 @@ You have access to powerful tools for:
5015
5046
  - **linter**: Check files for type errors and lint issues (TypeScript, JavaScript, TSX, JSX)
5016
5047
  - **todo**: Manage your task list to track progress on complex operations
5017
5048
  - **load_skill**: Load specialized knowledge documents for specific tasks
5018
- - **search**: Explore agent for semantic discovery - for exploratory questions and finding code by meaning
5049
+ - **explore_agent**: Explore agent for semantic discovery - for exploratory questions and finding code by meaning
5019
5050
 
5020
5051
 
5021
5052
  IMPORTANT: If you have zero context of where you are working, always explore it first to understand the structure before doing things for the user.
@@ -5109,7 +5140,7 @@ Use this proactively after making code changes to catch errors early.
5109
5140
 
5110
5141
  **Choose the right search approach:**
5111
5142
 
5112
- 1. **Use the \`search\` tool (Explore agent)** for:
5143
+ 1. **Use the \`explore_agent\` tool (Explore agent)** for:
5113
5144
  - Semantic/exploratory questions: "How does authentication work?", "Where is user data processed?"
5114
5145
  - Finding code by meaning or concept, not exact text
5115
5146
  - Understanding how features are implemented across multiple files
@@ -5125,9 +5156,9 @@ Use this proactively after making code changes to catch errors early.
5125
5156
  - Counting occurrences or listing all matches
5126
5157
 
5127
5158
  **Examples:**
5128
- - "Where is the API authentication handled?" \u2192 Use \`search\` tool
5159
+ - "Where is the API authentication handled?" \u2192 Use \`explore_agent\` tool
5129
5160
  - "Find all usages of getUserById" \u2192 Use \`rg "getUserById"\`
5130
- - "How does the payment flow work?" \u2192 Use \`search\` tool
5161
+ - "How does the payment flow work?" \u2192 Use \`explore_agent\` tool
5131
5162
  - "Find files named config" \u2192 Use \`find . -name "*config*"\`
5132
5163
 
5133
5164
  ${searchInstructions}
@@ -5154,7 +5185,7 @@ ${searchInstructions}
5154
5185
 
5155
5186
  ### Follow these rules to be a good agent for the user:
5156
5187
 
5157
- 1. Understand first - Read relevant files before making any changes. Use the \`search\` tool for exploratory questions about how things work, and direct searches (grep/rg) for finding exact strings or file names.
5188
+ 1. Understand first - Read relevant files before making any changes. Use the \`explore_agent\` tool for exploratory questions about how things work, and direct searches (grep/rg) for finding exact strings or file names.
5158
5189
  2. Plan for complexity - If the task involves 3+ steps or has meaningful trade-offs, create a todo list to track progress before implementing.
5159
5190
  3. Use the right tools - Have specialized tools for reading files, editing code, semantic search via subagents, and running terminal commands. Prefer these over raw shell commands.
5160
5191
  4. Work efficiently - When need to do multiple independent things (like reading several files), do them in parallel rather than one at a time.
@@ -5344,7 +5375,7 @@ var Agent = class _Agent {
5344
5375
  skillsDirectories: config.resolvedSkillsDirectories,
5345
5376
  onBashProgress: options.onToolProgress ? (progress) => options.onToolProgress({ toolName: "bash", data: progress }) : void 0,
5346
5377
  onWriteFileProgress: options.onToolProgress ? (progress) => options.onToolProgress({ toolName: "write_file", data: progress }) : void 0,
5347
- onSearchProgress: options.onToolProgress ? (progress) => options.onToolProgress({ toolName: "search", data: progress }) : void 0
5378
+ onSearchProgress: options.onToolProgress ? (progress) => options.onToolProgress({ toolName: "explore_agent", data: progress }) : void 0
5348
5379
  });
5349
5380
  }
5350
5381
  /**