autosnippet 3.2.7 → 3.2.9
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.
- package/bin/cli.js +13 -5
- package/dashboard/dist/assets/index-BTAsOZv2.js +128 -0
- package/dashboard/dist/assets/index-C_72Ct98.css +1 -0
- package/dashboard/dist/index.html +2 -2
- package/lib/cli/AiScanService.js +26 -29
- package/lib/cli/SetupService.js +1 -1
- package/lib/core/AstAnalyzer.js +27 -5
- package/lib/core/analysis/CallEdgeResolver.js +402 -0
- package/lib/core/analysis/CallGraphAnalyzer.js +367 -0
- package/lib/core/analysis/CallSiteExtractor.js +629 -0
- package/lib/core/analysis/DataFlowInferrer.js +57 -0
- package/lib/core/analysis/ImportPathResolver.js +189 -0
- package/lib/core/analysis/ImportRecord.js +105 -0
- package/lib/core/analysis/SymbolTableBuilder.js +211 -0
- package/lib/core/ast/ProjectGraph.js +8 -0
- package/lib/core/ast/lang-dart.js +352 -5
- package/lib/core/ast/lang-go.js +212 -10
- package/lib/core/ast/lang-java.js +205 -1
- package/lib/core/ast/lang-kotlin.js +330 -1
- package/lib/core/ast/lang-python.js +31 -2
- package/lib/core/ast/lang-rust.js +284 -3
- package/lib/core/ast/lang-swift.js +180 -1
- package/lib/core/ast/lang-typescript.js +290 -1
- package/lib/core/discovery/index.js +2 -2
- package/lib/external/ai/AiProvider.js +66 -172
- package/lib/external/ai/providers/GoogleGeminiProvider.js +23 -1
- package/lib/external/mcp/McpServer.js +1 -0
- package/lib/external/mcp/handlers/bootstrap/BootstrapSession.js +1 -1
- package/lib/external/mcp/handlers/bootstrap/ExternalSubmissionTracker.js +3 -3
- package/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +22 -1
- package/lib/external/mcp/handlers/bootstrap/pipeline/IncrementalBootstrap.js +1 -1
- package/lib/external/mcp/handlers/bootstrap/pipeline/dimension-configs.js +2 -1
- package/lib/external/mcp/handlers/bootstrap/pipeline/dimension-context.js +8 -8
- package/lib/external/mcp/handlers/bootstrap/pipeline/noAiFallback.js +1 -1
- package/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +311 -162
- package/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.js +102 -7
- package/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.js +1 -1
- package/lib/external/mcp/handlers/bootstrap-external.js +9 -2
- package/lib/external/mcp/handlers/bootstrap-internal.js +19 -8
- package/lib/external/mcp/handlers/consolidated.js +9 -0
- package/lib/external/mcp/handlers/dimension-complete-external.js +6 -6
- package/lib/external/mcp/handlers/guard.js +3 -3
- package/lib/external/mcp/handlers/structure.js +62 -0
- package/lib/external/mcp/handlers/wiki-external.js +66 -3
- package/lib/external/mcp/tools.js +36 -1
- package/lib/http/HttpServer.js +1 -1
- package/lib/http/middleware/requestLogger.js +1 -0
- package/lib/http/routes/ai.js +240 -35
- package/lib/http/routes/candidates.js +2 -3
- package/lib/http/routes/extract.js +13 -11
- package/lib/http/routes/modules.js +2 -2
- package/lib/http/routes/recipes.js +9 -5
- package/lib/http/routes/remote.js +149 -270
- package/lib/http/routes/violations.js +0 -54
- package/lib/http/utils/sse-sessions.js +1 -1
- package/lib/infrastructure/logging/Logger.js +5 -4
- package/lib/infrastructure/monitoring/PerformanceMonitor.js +3 -2
- package/lib/injection/ServiceContainer.js +70 -28
- package/lib/platform/ScreenCaptureService.js +177 -0
- package/lib/platform/ios/index.js +2 -2
- package/lib/platform/ios/routes/spm.js +2 -2
- package/lib/platform/ios/spm/PackageSwiftParser.js +14 -3
- package/lib/platform/ios/spm/SpmDiscoverer.js +123 -17
- package/lib/platform/ios/spm/{SpmService.js → SpmHelper.js} +43 -675
- package/lib/platform/ios/xcode/XcodeWriteUtils.js +1 -1
- package/lib/service/agent/AgentEventBus.js +207 -0
- package/lib/service/agent/AgentFactory.js +490 -0
- package/lib/service/agent/AgentMessage.js +240 -0
- package/lib/service/agent/AgentRouter.js +228 -0
- package/lib/service/agent/AgentRuntime.js +1016 -0
- package/lib/service/agent/AgentState.js +217 -0
- package/lib/service/agent/IntentClassifier.js +331 -0
- package/lib/service/agent/LarkTransport.js +389 -0
- package/lib/service/agent/capabilities.js +408 -0
- package/lib/service/{chat → agent/context}/ContextWindow.js +37 -12
- package/lib/service/{chat → agent/context}/ExplorationTracker.js +77 -22
- package/lib/service/{chat → agent/core}/ChatAgentPrompts.js +14 -2
- package/lib/service/agent/core/LoopContext.js +170 -0
- package/lib/service/agent/core/MessageAdapter.js +223 -0
- package/lib/service/agent/core/ToolExecutionPipeline.js +376 -0
- package/lib/service/{chat → agent/domain}/ChatAgentTasks.js +19 -98
- package/lib/service/{chat → agent/domain}/EpisodicConsolidator.js +7 -7
- package/lib/service/{chat → agent/domain}/EvidenceCollector.js +4 -2
- package/lib/service/{chat/AnalystAgent.js → agent/domain/insight-analyst.js} +37 -172
- package/lib/service/{chat/HandoffProtocol.js → agent/domain/insight-gate.js} +91 -123
- package/lib/service/agent/domain/insight-producer.js +267 -0
- package/lib/service/agent/domain/scan-prompts.js +105 -0
- package/lib/service/agent/forced-summary.js +266 -0
- package/lib/service/agent/index.js +91 -0
- package/lib/service/{chat → agent}/memory/ActiveContext.js +3 -1
- package/lib/service/{chat → agent}/memory/MemoryCoordinator.js +7 -7
- package/lib/service/{chat/ProjectSemanticMemory.js → agent/memory/PersistentMemory.js} +359 -89
- package/lib/service/{chat → agent}/memory/SessionStore.js +5 -4
- package/lib/service/{chat → agent}/memory/index.js +1 -1
- package/lib/service/agent/policies.js +442 -0
- package/lib/service/agent/presets.js +303 -0
- package/lib/service/agent/strategies.js +717 -0
- package/lib/service/{chat → agent/tools}/ToolRegistry.js +3 -3
- package/lib/service/agent/tools/ai-analysis.js +75 -0
- package/lib/service/{chat → agent}/tools/ast-graph.js +229 -32
- package/lib/service/{chat → agent}/tools/composite.js +2 -1
- package/lib/service/{chat → agent}/tools/guard.js +1 -121
- package/lib/service/{chat → agent}/tools/index.js +33 -22
- package/lib/service/{chat → agent}/tools/infrastructure.js +6 -1
- package/lib/service/agent/tools/knowledge-graph.js +112 -0
- package/lib/service/agent/tools/scan-recipe.js +189 -0
- package/lib/service/agent/tools/system-interaction.js +476 -0
- package/lib/service/automation/DirectiveDetector.js +0 -1
- package/lib/service/automation/FileWatcher.js +0 -8
- package/lib/service/automation/handlers/CreateHandler.js +7 -3
- package/lib/service/automation/handlers/DraftHandler.js +7 -6
- package/lib/service/cursor/CursorDeliveryPipeline.js +167 -1
- package/lib/service/knowledge/CodeEntityGraph.js +327 -2
- package/lib/service/knowledge/KnowledgeService.js +5 -1
- package/lib/service/module/ModuleService.js +49 -73
- package/lib/service/skills/SignalCollector.js +26 -19
- package/lib/service/snippet/codecs/VSCodeCodec.js +1 -1
- package/lib/service/wiki/WikiGenerator.js +1 -1
- package/lib/shared/FieldSpec.js +1 -1
- package/lib/shared/PathGuard.js +1 -1
- package/lib/shared/StyleGuide.js +1 -1
- package/package.json +4 -1
- package/resources/native-ui/screenshot.swift +228 -0
- package/dashboard/dist/assets/index-BaGY7kJI.css +0 -1
- package/dashboard/dist/assets/index-DfHY_3ln.js +0 -128
- package/lib/core/discovery/SpmDiscoverer.js +0 -5
- package/lib/external/mcp/handlers/bootstrap/pipeline/EpisodicMemory.js +0 -749
- package/lib/external/mcp/handlers/bootstrap/pipeline/ToolResultCache.js +0 -277
- package/lib/http/routes/spm.js +0 -5
- package/lib/infrastructure/external/XcodeAutomation.js +0 -15
- package/lib/service/chat/ChatAgent.js +0 -1602
- package/lib/service/chat/Memory.js +0 -161
- package/lib/service/chat/ProducerAgent.js +0 -431
- package/lib/service/chat/ReasoningTrace.js +0 -523
- package/lib/service/chat/TaskPipeline.js +0 -357
- package/lib/service/chat/WorkingMemory.js +0 -357
- package/lib/service/chat/memory/PersistentMemory.js +0 -450
- package/lib/service/chat/tools/ai-analysis.js +0 -267
- package/lib/service/chat/tools/knowledge-graph.js +0 -234
- package/lib/service/chat/tools.js +0 -18
- package/lib/service/snippet/PlaceholderConverter.js +0 -5
- package/lib/service/snippet/codecs/XcodeCodec.js +0 -5
- /package/lib/service/{chat → agent}/ConversationStore.js +0 -0
- /package/lib/service/{chat → agent}/tools/_shared.js +0 -0
- /package/lib/service/{chat → agent}/tools/lifecycle.js +0 -0
- /package/lib/service/{chat → agent}/tools/project-access.js +0 -0
- /package/lib/service/{chat → agent}/tools/query.js +0 -0
|
@@ -15,7 +15,12 @@ const EMBED_MODEL = 'models/gemini-embedding-001';
|
|
|
15
15
|
|
|
16
16
|
export class GoogleGeminiProvider extends AiProvider {
|
|
17
17
|
constructor(config = {}) {
|
|
18
|
-
super(
|
|
18
|
+
super({
|
|
19
|
+
...config,
|
|
20
|
+
maxConcurrency:
|
|
21
|
+
config.maxConcurrency ||
|
|
22
|
+
Number(process.env.ASD_GEMINI_MAX_CONCURRENCY || process.env.ASD_AI_MAX_CONCURRENCY || 2),
|
|
23
|
+
});
|
|
19
24
|
this.name = 'google-gemini';
|
|
20
25
|
this.model = config.model || 'gemini-3-flash-preview';
|
|
21
26
|
this.apiKey = config.apiKey || process.env.ASD_GOOGLE_API_KEY || '';
|
|
@@ -421,6 +426,20 @@ export class GoogleGeminiProvider extends AiProvider {
|
|
|
421
426
|
signal: controller.signal,
|
|
422
427
|
});
|
|
423
428
|
if (!res.ok) {
|
|
429
|
+
const retryAfterHeader = res.headers.get('retry-after');
|
|
430
|
+
let retryAfterMs = 0;
|
|
431
|
+
if (retryAfterHeader) {
|
|
432
|
+
const sec = Number(retryAfterHeader);
|
|
433
|
+
if (Number.isFinite(sec) && sec > 0) {
|
|
434
|
+
retryAfterMs = sec * 1000;
|
|
435
|
+
} else {
|
|
436
|
+
const when = Date.parse(retryAfterHeader);
|
|
437
|
+
if (Number.isFinite(when)) {
|
|
438
|
+
retryAfterMs = Math.max(0, when - Date.now());
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
424
443
|
let detail = '';
|
|
425
444
|
try {
|
|
426
445
|
const j = await res.json();
|
|
@@ -430,6 +449,9 @@ export class GoogleGeminiProvider extends AiProvider {
|
|
|
430
449
|
}
|
|
431
450
|
const err = new Error(`Gemini API error: ${res.status}${detail ? ` — ${detail}` : ''}`);
|
|
432
451
|
err.status = res.status;
|
|
452
|
+
if (retryAfterMs > 0) {
|
|
453
|
+
err.retryAfterMs = retryAfterMs;
|
|
454
|
+
}
|
|
433
455
|
throw err;
|
|
434
456
|
}
|
|
435
457
|
return await res.json();
|
|
@@ -353,6 +353,7 @@ export class McpServer {
|
|
|
353
353
|
autosnippet_search: (ctx, args) => consolidated.consolidatedSearch(ctx, args),
|
|
354
354
|
autosnippet_knowledge: (ctx, args) => consolidated.consolidatedKnowledge(ctx, args),
|
|
355
355
|
autosnippet_structure: (ctx, args) => consolidated.consolidatedStructure(ctx, args),
|
|
356
|
+
autosnippet_call_context: (ctx, args) => consolidated.consolidatedCallContext(ctx, args),
|
|
356
357
|
autosnippet_graph: (ctx, args) => consolidated.consolidatedGraph(ctx, args),
|
|
357
358
|
autosnippet_guard: (ctx, args) => consolidated.consolidatedGuard(ctx, args),
|
|
358
359
|
autosnippet_submit_knowledge: (ctx, args) => consolidated.enhancedSubmitKnowledge(ctx, args),
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import crypto from 'node:crypto';
|
|
19
|
-
import { SessionStore } from '../../../../service/
|
|
19
|
+
import { SessionStore } from '../../../../service/agent/memory/SessionStore.js';
|
|
20
20
|
import { ExternalSubmissionTracker } from './ExternalSubmissionTracker.js';
|
|
21
21
|
|
|
22
22
|
// ── 常量 ────────────────────────────────────────────────────
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ExternalSubmissionTracker — 外部 Agent 提交追踪与质量评估
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* 内部 Agent 使用 EvidenceCollector 从 toolCall
|
|
4
|
+
* 质量门控的外部 Agent 对应模块。
|
|
5
|
+
* 内部 Agent 使用 EvidenceCollector 从 toolCall 中收集证据 (bootstrap-gate.js),
|
|
6
6
|
* 外部 Agent 使用 ExternalSubmissionTracker 从 submit_knowledge 调用中积累证据。
|
|
7
7
|
*
|
|
8
8
|
* 职责:
|
|
9
9
|
* - 追踪每个维度的 submit_knowledge 提交 (recipe 元数据 + 引用文件)
|
|
10
10
|
* - 从提交内容构建 evidenceMap (filePath → 引用摘要)
|
|
11
11
|
* - 从 dimension_complete 的 analysisText 提取负空间信号
|
|
12
|
-
* - 计算维度级质量评分 (
|
|
12
|
+
* - 计算维度级质量评分 (对应 bootstrap-gate.js 的 buildQualityScores)
|
|
13
13
|
* - 为下游维度提供结构化跨维度证据
|
|
14
14
|
*
|
|
15
15
|
* 设计对应关系:
|
|
@@ -37,7 +37,7 @@ const SIZE_THRESHOLDS = {
|
|
|
37
37
|
/**
|
|
38
38
|
* 将 base-dimensions 中的维度定义转换为 Mission Briefing 中的维度任务对象
|
|
39
39
|
*
|
|
40
|
-
* 取自
|
|
40
|
+
* 取自 bootstrap-analyst.buildAnalystPrompt() + DIMENSION_CONFIGS_V3 + StyleGuide
|
|
41
41
|
*
|
|
42
42
|
* @param {object} dim — base-dimensions.js 中的维度定义
|
|
43
43
|
* @param {object[]} skills — 已加载的 bootstrap skills
|
|
@@ -551,6 +551,20 @@ function summarizeEntityGraph(codeEntityResult) {
|
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
+
/**
|
|
555
|
+
* 压缩 Call Graph 结果
|
|
556
|
+
* @param {object|null} callGraphResult — CodeEntityGraph.populateCallGraph() 返回值
|
|
557
|
+
* @returns {object|null}
|
|
558
|
+
*/
|
|
559
|
+
function summarizeCallGraph(callGraphResult) {
|
|
560
|
+
if (!callGraphResult) return null;
|
|
561
|
+
return {
|
|
562
|
+
methodEntities: callGraphResult.entitiesUpserted || 0,
|
|
563
|
+
callEdges: callGraphResult.edgesCreated || 0,
|
|
564
|
+
durationMs: callGraphResult.durationMs || 0,
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
|
|
554
568
|
/**
|
|
555
569
|
* 压缩 Guard 审计结果
|
|
556
570
|
*/
|
|
@@ -673,6 +687,7 @@ export function buildMissionBriefing({
|
|
|
673
687
|
projectMeta,
|
|
674
688
|
astData,
|
|
675
689
|
codeEntityResult,
|
|
690
|
+
callGraphResult,
|
|
676
691
|
depGraphData,
|
|
677
692
|
guardAudit,
|
|
678
693
|
targets,
|
|
@@ -680,6 +695,7 @@ export function buildMissionBriefing({
|
|
|
680
695
|
session,
|
|
681
696
|
languageExtension, // §7.1: 语言扩展(反模式、Guard 规则、Agent 注意事项)
|
|
682
697
|
incrementalPlan, // §7.3: 增量 Bootstrap 评估结果
|
|
698
|
+
languageStats, // §7.4: 完整语言分布统计
|
|
683
699
|
}) {
|
|
684
700
|
const scheduler = new TierScheduler();
|
|
685
701
|
|
|
@@ -720,6 +736,8 @@ export function buildMissionBriefing({
|
|
|
720
736
|
|
|
721
737
|
codeEntityGraph: summarizeEntityGraph(codeEntityResult),
|
|
722
738
|
|
|
739
|
+
callGraph: summarizeCallGraph(callGraphResult),
|
|
740
|
+
|
|
723
741
|
dependencyGraph: depGraphData
|
|
724
742
|
? {
|
|
725
743
|
nodes: (depGraphData.nodes || []).map((n) => ({
|
|
@@ -750,6 +768,9 @@ export function buildMissionBriefing({
|
|
|
750
768
|
example,
|
|
751
769
|
},
|
|
752
770
|
|
|
771
|
+
// 完整语言统计(按文件扩展名计数)
|
|
772
|
+
languageStats: languageStats || null,
|
|
773
|
+
|
|
753
774
|
executionPlan: buildExecutionPlan(activeDimensions),
|
|
754
775
|
|
|
755
776
|
session: session.toJSON(),
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { BootstrapSnapshot } from './BootstrapSnapshot.js';
|
|
19
|
-
import { SessionStore } from '../../../../../service/
|
|
19
|
+
import { SessionStore } from '../../../../../service/agent/memory/SessionStore.js';
|
|
20
20
|
|
|
21
21
|
// ──────────────────────────────────────────────────────────────
|
|
22
22
|
// IncrementalBootstrap 类
|
|
@@ -115,7 +115,8 @@ export function buildTierReflection(tierIndex, tierResults, sessionStore) {
|
|
|
115
115
|
for (const f of allFindings) {
|
|
116
116
|
// 统计文件引用频率
|
|
117
117
|
if (f.evidence) {
|
|
118
|
-
const
|
|
118
|
+
const ev = typeof f.evidence === 'string' ? f.evidence : String(f.evidence);
|
|
119
|
+
const file = ev.split(':')[0];
|
|
119
120
|
if (file) {
|
|
120
121
|
fileMentions[file] = (fileMentions[file] || 0) + 1;
|
|
121
122
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pipeline/dimension-context.js — 跨维度上下文管理 (v6)
|
|
3
3
|
*
|
|
4
|
-
* ⚠️ 内部 Agent 专用 — 被 orchestrator.js 的
|
|
4
|
+
* ⚠️ 内部 Agent 专用 — 被 orchestrator.js 的 PipelineStrategy analyze 阶段调用。
|
|
5
5
|
* 外部 Agent 不使用此模块(外部 Agent 的跨维度上下文由 BootstrapSession.js + EpisodicMemory 管理)。
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* 在 PipelineStrategy 按维度分批执行时,维护跨维度的上下文:
|
|
8
8
|
* - 项目基础信息 (不变)
|
|
9
9
|
* - 已完成维度的 DimensionDigest (累积)
|
|
10
10
|
* - 已提交候选的摘要列表 (累积)
|
|
11
11
|
*
|
|
12
|
-
* 确保每个维度的
|
|
12
|
+
* 确保每个维度的 Analyst 阶段都能看到前序维度的分析结论,
|
|
13
13
|
* 实现跨维度透明互补。
|
|
14
14
|
*
|
|
15
15
|
* @module pipeline/dimension-context
|
|
@@ -73,7 +73,7 @@ export class DimensionContext {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
|
-
* 构建给
|
|
76
|
+
* 构建给 Agent 的上下文快照
|
|
77
77
|
*
|
|
78
78
|
* @param {string} currentDimId — 当前维度 ID
|
|
79
79
|
* @returns {DimensionContextSnapshot}
|
|
@@ -115,7 +115,7 @@ export class DimensionContext {
|
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
117
|
* 获取所有维度摘要的紧凑文本表示
|
|
118
|
-
* 用于
|
|
118
|
+
* 用于 Agent prompt 中注入
|
|
119
119
|
*
|
|
120
120
|
* @returns {string}
|
|
121
121
|
*/
|
|
@@ -176,12 +176,12 @@ export class DimensionContext {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
|
-
* 从
|
|
179
|
+
* 从 Agent 的最终回复中解析 DimensionDigest
|
|
180
180
|
*
|
|
181
|
-
*
|
|
181
|
+
* Agent 被要求在回复末尾包含 JSON 格式的 dimensionDigest。
|
|
182
182
|
* 此函数从自由格式文本中提取该 JSON 块。
|
|
183
183
|
*
|
|
184
|
-
* @param {string} reply —
|
|
184
|
+
* @param {string} reply — Agent 的完整回复文本
|
|
185
185
|
* @returns {DimensionDigest|null}
|
|
186
186
|
*/
|
|
187
187
|
export function parseDimensionDigest(reply) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* noAiFallback.js — AI 不可用时的规则化降级知识提取
|
|
3
3
|
*
|
|
4
|
-
* 当
|
|
4
|
+
* 当 AgentRuntime / AI Provider 不可用时,从 Phase 1-4 的结构化数据中
|
|
5
5
|
* 提取基础知识候选和 Project Skill,覆盖以下维度:
|
|
6
6
|
*
|
|
7
7
|
* ✅ project-profile — 从 langStats + depGraph + targets 构建项目技术画像
|