@locusai/sdk 0.13.0 → 0.13.3
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/dist/agent/worker.d.ts.map +1 -1
- package/dist/agent/worker.js +333 -15
- package/dist/ai/__tests__/factory.test.d.ts +2 -0
- package/dist/ai/__tests__/factory.test.d.ts.map +1 -0
- package/dist/ai/factory.d.ts.map +1 -1
- package/dist/core/config.d.ts +25 -2
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/prompt-builder.d.ts +1 -0
- package/dist/core/prompt-builder.d.ts.map +1 -1
- package/dist/discussion/agents/facilitator-prompt.d.ts +13 -0
- package/dist/discussion/agents/facilitator-prompt.d.ts.map +1 -0
- package/dist/discussion/discussion-facilitator.d.ts +67 -0
- package/dist/discussion/discussion-facilitator.d.ts.map +1 -0
- package/dist/discussion/discussion-manager.d.ts +59 -0
- package/dist/discussion/discussion-manager.d.ts.map +1 -0
- package/dist/discussion/discussion-types.d.ts +89 -0
- package/dist/discussion/discussion-types.d.ts.map +1 -0
- package/dist/discussion/index.d.ts +5 -0
- package/dist/discussion/index.d.ts.map +1 -0
- package/dist/index-node.d.ts +1 -0
- package/dist/index-node.d.ts.map +1 -1
- package/dist/index-node.js +773 -108
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -0
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/agent/worker.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGlE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,qBAAa,WAAW;IAgBV,OAAO,CAAC,MAAM;IAf1B,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,WAAW,CAAc;IAGjC,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,iBAAiB,CAA+C;IACxE,OAAO,CAAC,aAAa,CAAuB;IAG5C,OAAO,CAAC,iBAAiB,CAA4C;IACrE,OAAO,CAAC,aAAa,CAAgB;gBAEjB,MAAM,EAAE,YAAY;IAqDxC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAgB;YAmB5D,eAAe;YAcf,WAAW;IAgDzB;;OAEG;YACW,WAAW;IAoCzB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,aAAa;IAoBf,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/agent/worker.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGlE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,qBAAa,WAAW;IAgBV,OAAO,CAAC,MAAM;IAf1B,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,WAAW,CAAc;IAGjC,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,iBAAiB,CAA+C;IACxE,OAAO,CAAC,aAAa,CAAuB;IAG5C,OAAO,CAAC,iBAAiB,CAA4C;IACrE,OAAO,CAAC,aAAa,CAAgB;gBAEjB,MAAM,EAAE,YAAY;IAqDxC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAgB;YAmB5D,eAAe;YAcf,WAAW;IAgDzB;;OAEG;YACW,WAAW;IAoCzB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,aAAa;IAoBf,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA4I3B"}
|
package/dist/agent/worker.js
CHANGED
|
@@ -391,6 +391,39 @@ var init_workspaces = __esm(() => {
|
|
|
391
391
|
};
|
|
392
392
|
});
|
|
393
393
|
|
|
394
|
+
// src/discussion/discussion-types.ts
|
|
395
|
+
var import_zod, DiscussionMessageSchema, DiscussionInsightSchema, DiscussionSchema;
|
|
396
|
+
var init_discussion_types = __esm(() => {
|
|
397
|
+
import_zod = require("zod");
|
|
398
|
+
DiscussionMessageSchema = import_zod.z.object({
|
|
399
|
+
role: import_zod.z.enum(["user", "assistant"]),
|
|
400
|
+
content: import_zod.z.string(),
|
|
401
|
+
timestamp: import_zod.z.number()
|
|
402
|
+
});
|
|
403
|
+
DiscussionInsightSchema = import_zod.z.object({
|
|
404
|
+
id: import_zod.z.string(),
|
|
405
|
+
type: import_zod.z.enum(["decision", "requirement", "idea", "concern", "learning"]),
|
|
406
|
+
title: import_zod.z.string(),
|
|
407
|
+
content: import_zod.z.string(),
|
|
408
|
+
tags: import_zod.z.array(import_zod.z.string()).default([]),
|
|
409
|
+
createdAt: import_zod.z.string()
|
|
410
|
+
});
|
|
411
|
+
DiscussionSchema = import_zod.z.object({
|
|
412
|
+
id: import_zod.z.string(),
|
|
413
|
+
title: import_zod.z.string(),
|
|
414
|
+
topic: import_zod.z.string(),
|
|
415
|
+
status: import_zod.z.enum(["active", "completed", "archived"]).default("active"),
|
|
416
|
+
messages: import_zod.z.array(DiscussionMessageSchema).default([]),
|
|
417
|
+
insights: import_zod.z.array(DiscussionInsightSchema).default([]),
|
|
418
|
+
createdAt: import_zod.z.string(),
|
|
419
|
+
updatedAt: import_zod.z.string(),
|
|
420
|
+
metadata: import_zod.z.object({
|
|
421
|
+
model: import_zod.z.string(),
|
|
422
|
+
provider: import_zod.z.string()
|
|
423
|
+
})
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
|
|
394
427
|
// src/index.ts
|
|
395
428
|
var exports_src = {};
|
|
396
429
|
__export(exports_src, {
|
|
@@ -403,6 +436,9 @@ __export(exports_src, {
|
|
|
403
436
|
LocusClient: () => LocusClient,
|
|
404
437
|
InvitationsModule: () => InvitationsModule,
|
|
405
438
|
DocsModule: () => DocsModule,
|
|
439
|
+
DiscussionSchema: () => DiscussionSchema,
|
|
440
|
+
DiscussionMessageSchema: () => DiscussionMessageSchema,
|
|
441
|
+
DiscussionInsightSchema: () => DiscussionInsightSchema,
|
|
406
442
|
CiModule: () => CiModule,
|
|
407
443
|
AuthModule: () => AuthModule
|
|
408
444
|
});
|
|
@@ -508,6 +544,7 @@ var init_src = __esm(() => {
|
|
|
508
544
|
init_sprints();
|
|
509
545
|
init_tasks();
|
|
510
546
|
init_workspaces();
|
|
547
|
+
init_discussion_types();
|
|
511
548
|
import_axios = __toESM(require("axios"));
|
|
512
549
|
init_events();
|
|
513
550
|
init_auth();
|
|
@@ -521,6 +558,12 @@ var init_src = __esm(() => {
|
|
|
521
558
|
});
|
|
522
559
|
|
|
523
560
|
// src/core/config.ts
|
|
561
|
+
function isValidModelForProvider(provider, model) {
|
|
562
|
+
return PROVIDER_MODELS[provider].includes(model);
|
|
563
|
+
}
|
|
564
|
+
function getModelsForProvider(provider) {
|
|
565
|
+
return PROVIDER_MODELS[provider];
|
|
566
|
+
}
|
|
524
567
|
function getLocusPath(projectPath, fileName) {
|
|
525
568
|
return import_node_path.join(projectPath, LOCUS_CONFIG.dir, LOCUS_CONFIG[fileName]);
|
|
526
569
|
}
|
|
@@ -528,16 +571,36 @@ function getAgentArtifactsPath(projectPath, agentId) {
|
|
|
528
571
|
const shortId = agentId.slice(-8);
|
|
529
572
|
return import_node_path.join(projectPath, LOCUS_CONFIG.dir, LOCUS_CONFIG.artifactsDir, shortId);
|
|
530
573
|
}
|
|
531
|
-
var import_node_path, PROVIDER, DEFAULT_MODEL, LOCUS_SCHEMA_BASE_URL = "https://locusai.dev/schemas", LOCUS_SCHEMAS, LOCUS_CONFIG, LOCUS_GITIGNORE_PATTERNS;
|
|
574
|
+
var import_node_path, PROVIDER, CLAUDE_MODELS, CODEX_MODELS, PROVIDER_MODELS, DEFAULT_MODEL, LOCUS_SCHEMA_BASE_URL = "https://locusai.dev/schemas", LOCUS_SCHEMAS, LOCUS_CONFIG, LOCUS_GITIGNORE_PATTERNS;
|
|
532
575
|
var init_config = __esm(() => {
|
|
533
576
|
import_node_path = require("node:path");
|
|
534
577
|
PROVIDER = {
|
|
535
578
|
CLAUDE: "claude",
|
|
536
579
|
CODEX: "codex"
|
|
537
580
|
};
|
|
581
|
+
CLAUDE_MODELS = {
|
|
582
|
+
OPUS: "opus",
|
|
583
|
+
SONNET: "sonnet",
|
|
584
|
+
HAIKU: "haiku",
|
|
585
|
+
OPUS_PLAN: "opusplan",
|
|
586
|
+
CLAUDE_OPUS_4_6: "claude-opus-4-6",
|
|
587
|
+
CLAUDE_SONNET_4_5: "claude-sonnet-4-5-20250929",
|
|
588
|
+
CLAUDE_SONNET_4_6: "claude-sonnet-4-6",
|
|
589
|
+
CLAUDE_HAIKU_4_5: "claude-haiku-4-5-20251001"
|
|
590
|
+
};
|
|
591
|
+
CODEX_MODELS = {
|
|
592
|
+
GPT_5_3_CODEX: "gpt-5.3-codex",
|
|
593
|
+
GPT_5_3_CODEX_SPARK: "gpt-5.3-codex-spark",
|
|
594
|
+
GPT_5_CODEX_MINI: "gpt-5-codex-mini",
|
|
595
|
+
GPT_5_2_CODEX: "gpt-5.2-codex"
|
|
596
|
+
};
|
|
597
|
+
PROVIDER_MODELS = {
|
|
598
|
+
[PROVIDER.CLAUDE]: Object.values(CLAUDE_MODELS),
|
|
599
|
+
[PROVIDER.CODEX]: Object.values(CODEX_MODELS)
|
|
600
|
+
};
|
|
538
601
|
DEFAULT_MODEL = {
|
|
539
|
-
[PROVIDER.CLAUDE]:
|
|
540
|
-
[PROVIDER.CODEX]:
|
|
602
|
+
[PROVIDER.CLAUDE]: CLAUDE_MODELS.OPUS,
|
|
603
|
+
[PROVIDER.CODEX]: CODEX_MODELS.GPT_5_3_CODEX
|
|
541
604
|
};
|
|
542
605
|
LOCUS_SCHEMAS = {
|
|
543
606
|
config: `${LOCUS_SCHEMA_BASE_URL}/config.schema.json`,
|
|
@@ -554,7 +617,8 @@ var init_config = __esm(() => {
|
|
|
554
617
|
documentsDir: "documents",
|
|
555
618
|
sessionsDir: "sessions",
|
|
556
619
|
reviewsDir: "reviews",
|
|
557
|
-
plansDir: "plans"
|
|
620
|
+
plansDir: "plans",
|
|
621
|
+
discussionsDir: "discussions"
|
|
558
622
|
};
|
|
559
623
|
LOCUS_GITIGNORE_PATTERNS = [
|
|
560
624
|
"# Locus AI - Session data (user-specific, can grow large)",
|
|
@@ -569,6 +633,9 @@ var init_config = __esm(() => {
|
|
|
569
633
|
"# Locus AI - Plans (generated per task)",
|
|
570
634
|
".locus/plans/",
|
|
571
635
|
"",
|
|
636
|
+
"# Locus AI - Discussions (AI discussion sessions)",
|
|
637
|
+
".locus/discussions/",
|
|
638
|
+
"",
|
|
572
639
|
"# Locus AI - Settings (contains API key, telegram config, etc.)",
|
|
573
640
|
".locus/settings.json",
|
|
574
641
|
"",
|
|
@@ -1517,6 +1584,10 @@ var init_codex_runner = __esm(() => {
|
|
|
1517
1584
|
function createAiRunner(provider, config) {
|
|
1518
1585
|
const resolvedProvider = provider ?? PROVIDER.CLAUDE;
|
|
1519
1586
|
const model = config.model ?? DEFAULT_MODEL[resolvedProvider];
|
|
1587
|
+
if (!isValidModelForProvider(resolvedProvider, model)) {
|
|
1588
|
+
const validModels = getModelsForProvider(resolvedProvider);
|
|
1589
|
+
throw new Error(`Model "${model}" is not valid for provider "${resolvedProvider}". ` + `Valid models: ${validModels.join(", ")}`);
|
|
1590
|
+
}
|
|
1520
1591
|
switch (resolvedProvider) {
|
|
1521
1592
|
case PROVIDER.CODEX:
|
|
1522
1593
|
return new CodexRunner(config.projectPath, model, config.log, config.reasoningEffort ?? "high", config.timeoutMs);
|
|
@@ -1871,6 +1942,187 @@ var init_git_workflow = __esm(() => {
|
|
|
1871
1942
|
import_node_child_process4 = require("node:child_process");
|
|
1872
1943
|
});
|
|
1873
1944
|
|
|
1945
|
+
// src/discussion/discussion-manager.ts
|
|
1946
|
+
class DiscussionManager {
|
|
1947
|
+
discussionsDir;
|
|
1948
|
+
constructor(projectPath) {
|
|
1949
|
+
this.discussionsDir = getLocusPath(projectPath, "discussionsDir");
|
|
1950
|
+
}
|
|
1951
|
+
create(topic, model, provider) {
|
|
1952
|
+
this.ensureDir();
|
|
1953
|
+
const now = new Date().toISOString();
|
|
1954
|
+
const id = `disc-${Date.now()}`;
|
|
1955
|
+
const discussion = {
|
|
1956
|
+
id,
|
|
1957
|
+
title: topic,
|
|
1958
|
+
topic,
|
|
1959
|
+
status: "active",
|
|
1960
|
+
messages: [],
|
|
1961
|
+
insights: [],
|
|
1962
|
+
createdAt: now,
|
|
1963
|
+
updatedAt: now,
|
|
1964
|
+
metadata: { model, provider }
|
|
1965
|
+
};
|
|
1966
|
+
this.save(discussion);
|
|
1967
|
+
return discussion;
|
|
1968
|
+
}
|
|
1969
|
+
save(discussion) {
|
|
1970
|
+
this.ensureDir();
|
|
1971
|
+
const jsonPath = import_node_path5.join(this.discussionsDir, `${discussion.id}.json`);
|
|
1972
|
+
const mdPath = import_node_path5.join(this.discussionsDir, `summary-${discussion.id}.md`);
|
|
1973
|
+
import_node_fs3.writeFileSync(jsonPath, JSON.stringify(discussion, null, 2), "utf-8");
|
|
1974
|
+
import_node_fs3.writeFileSync(mdPath, this.toMarkdown(discussion), "utf-8");
|
|
1975
|
+
}
|
|
1976
|
+
load(id) {
|
|
1977
|
+
this.ensureDir();
|
|
1978
|
+
const filePath = import_node_path5.join(this.discussionsDir, `${id}.json`);
|
|
1979
|
+
if (!import_node_fs3.existsSync(filePath)) {
|
|
1980
|
+
return null;
|
|
1981
|
+
}
|
|
1982
|
+
try {
|
|
1983
|
+
return JSON.parse(import_node_fs3.readFileSync(filePath, "utf-8"));
|
|
1984
|
+
} catch {
|
|
1985
|
+
return null;
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
list(status) {
|
|
1989
|
+
this.ensureDir();
|
|
1990
|
+
const files = import_node_fs3.readdirSync(this.discussionsDir).filter((f) => f.endsWith(".json"));
|
|
1991
|
+
const discussions = [];
|
|
1992
|
+
for (const file of files) {
|
|
1993
|
+
try {
|
|
1994
|
+
const discussion = JSON.parse(import_node_fs3.readFileSync(import_node_path5.join(this.discussionsDir, file), "utf-8"));
|
|
1995
|
+
if (!status || discussion.status === status) {
|
|
1996
|
+
discussions.push(discussion);
|
|
1997
|
+
}
|
|
1998
|
+
} catch {}
|
|
1999
|
+
}
|
|
2000
|
+
discussions.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
|
|
2001
|
+
return discussions;
|
|
2002
|
+
}
|
|
2003
|
+
complete(id) {
|
|
2004
|
+
const discussion = this.load(id);
|
|
2005
|
+
if (!discussion) {
|
|
2006
|
+
throw new Error(`Discussion not found: ${id}`);
|
|
2007
|
+
}
|
|
2008
|
+
discussion.status = "completed";
|
|
2009
|
+
discussion.updatedAt = new Date().toISOString();
|
|
2010
|
+
this.save(discussion);
|
|
2011
|
+
return discussion;
|
|
2012
|
+
}
|
|
2013
|
+
archive(id) {
|
|
2014
|
+
const discussion = this.load(id);
|
|
2015
|
+
if (!discussion) {
|
|
2016
|
+
throw new Error(`Discussion not found: ${id}`);
|
|
2017
|
+
}
|
|
2018
|
+
discussion.status = "archived";
|
|
2019
|
+
discussion.updatedAt = new Date().toISOString();
|
|
2020
|
+
this.save(discussion);
|
|
2021
|
+
}
|
|
2022
|
+
delete(id) {
|
|
2023
|
+
this.ensureDir();
|
|
2024
|
+
const jsonPath = import_node_path5.join(this.discussionsDir, `${id}.json`);
|
|
2025
|
+
const mdPath = import_node_path5.join(this.discussionsDir, `summary-${id}.md`);
|
|
2026
|
+
if (import_node_fs3.existsSync(jsonPath)) {
|
|
2027
|
+
import_node_fs3.unlinkSync(jsonPath);
|
|
2028
|
+
}
|
|
2029
|
+
if (import_node_fs3.existsSync(mdPath)) {
|
|
2030
|
+
import_node_fs3.unlinkSync(mdPath);
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
addMessage(id, role, content) {
|
|
2034
|
+
const discussion = this.load(id);
|
|
2035
|
+
if (!discussion) {
|
|
2036
|
+
throw new Error(`Discussion not found: ${id}`);
|
|
2037
|
+
}
|
|
2038
|
+
discussion.messages.push({
|
|
2039
|
+
role,
|
|
2040
|
+
content,
|
|
2041
|
+
timestamp: Date.now()
|
|
2042
|
+
});
|
|
2043
|
+
discussion.updatedAt = new Date().toISOString();
|
|
2044
|
+
this.save(discussion);
|
|
2045
|
+
return discussion;
|
|
2046
|
+
}
|
|
2047
|
+
addInsight(id, insight) {
|
|
2048
|
+
const discussion = this.load(id);
|
|
2049
|
+
if (!discussion) {
|
|
2050
|
+
throw new Error(`Discussion not found: ${id}`);
|
|
2051
|
+
}
|
|
2052
|
+
discussion.insights.push(insight);
|
|
2053
|
+
discussion.updatedAt = new Date().toISOString();
|
|
2054
|
+
this.save(discussion);
|
|
2055
|
+
return discussion;
|
|
2056
|
+
}
|
|
2057
|
+
getAllInsights() {
|
|
2058
|
+
const discussions = this.list("completed");
|
|
2059
|
+
const insights = [];
|
|
2060
|
+
for (const discussion of discussions) {
|
|
2061
|
+
insights.push(...discussion.insights);
|
|
2062
|
+
}
|
|
2063
|
+
insights.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
|
|
2064
|
+
return insights;
|
|
2065
|
+
}
|
|
2066
|
+
getMarkdown(id) {
|
|
2067
|
+
const discussion = this.load(id);
|
|
2068
|
+
if (!discussion)
|
|
2069
|
+
return null;
|
|
2070
|
+
return this.toMarkdown(discussion);
|
|
2071
|
+
}
|
|
2072
|
+
toMarkdown(discussion) {
|
|
2073
|
+
const lines = [];
|
|
2074
|
+
lines.push(`# Discussion: ${discussion.title}`);
|
|
2075
|
+
lines.push("");
|
|
2076
|
+
lines.push(`**Status:** ${discussion.status.toUpperCase()}`);
|
|
2077
|
+
lines.push(`**Topic:** ${discussion.topic}`);
|
|
2078
|
+
lines.push(`**Created:** ${discussion.createdAt}`);
|
|
2079
|
+
lines.push(`**Updated:** ${discussion.updatedAt}`);
|
|
2080
|
+
lines.push(`**Model:** ${discussion.metadata.model} (${discussion.metadata.provider})`);
|
|
2081
|
+
lines.push("");
|
|
2082
|
+
if (discussion.messages.length > 0) {
|
|
2083
|
+
lines.push(`## Messages (${discussion.messages.length})`);
|
|
2084
|
+
lines.push("");
|
|
2085
|
+
for (const msg of discussion.messages) {
|
|
2086
|
+
const time = new Date(msg.timestamp).toISOString();
|
|
2087
|
+
const roleLabel = msg.role === "user" ? "User" : "Assistant";
|
|
2088
|
+
lines.push(`### ${roleLabel} — ${time}`);
|
|
2089
|
+
lines.push("");
|
|
2090
|
+
lines.push(msg.content);
|
|
2091
|
+
lines.push("");
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
if (discussion.insights.length > 0) {
|
|
2095
|
+
lines.push(`## Insights (${discussion.insights.length})`);
|
|
2096
|
+
lines.push("");
|
|
2097
|
+
for (const insight of discussion.insights) {
|
|
2098
|
+
lines.push(`### [${insight.type.toUpperCase()}] ${insight.title}`);
|
|
2099
|
+
lines.push("");
|
|
2100
|
+
lines.push(insight.content);
|
|
2101
|
+
if (insight.tags.length > 0) {
|
|
2102
|
+
lines.push("");
|
|
2103
|
+
lines.push(`**Tags:** ${insight.tags.join(", ")}`);
|
|
2104
|
+
}
|
|
2105
|
+
lines.push("");
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
lines.push("---");
|
|
2109
|
+
lines.push(`*Discussion ID: ${discussion.id}*`);
|
|
2110
|
+
return lines.join(`
|
|
2111
|
+
`);
|
|
2112
|
+
}
|
|
2113
|
+
ensureDir() {
|
|
2114
|
+
if (!import_node_fs3.existsSync(this.discussionsDir)) {
|
|
2115
|
+
import_node_fs3.mkdirSync(this.discussionsDir, { recursive: true });
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
var import_node_fs3, import_node_path5;
|
|
2120
|
+
var init_discussion_manager = __esm(() => {
|
|
2121
|
+
init_config();
|
|
2122
|
+
import_node_fs3 = require("node:fs");
|
|
2123
|
+
import_node_path5 = require("node:path");
|
|
2124
|
+
});
|
|
2125
|
+
|
|
1874
2126
|
// src/core/prompt-builder.ts
|
|
1875
2127
|
class PromptBuilder {
|
|
1876
2128
|
projectPath;
|
|
@@ -1909,6 +2161,15 @@ ${knowledgeBase}
|
|
|
1909
2161
|
These are accumulated lessons from past tasks. Follow them to avoid repeating mistakes:
|
|
1910
2162
|
${learnings}
|
|
1911
2163
|
</learnings>
|
|
2164
|
+
`;
|
|
2165
|
+
}
|
|
2166
|
+
const discussionInsights = this.getDiscussionInsightsContent();
|
|
2167
|
+
if (discussionInsights) {
|
|
2168
|
+
sections += `
|
|
2169
|
+
<discussion_insights>
|
|
2170
|
+
These are key decisions and insights from product discussions. Follow them to maintain product coherence:
|
|
2171
|
+
${discussionInsights}
|
|
2172
|
+
</discussion_insights>
|
|
1912
2173
|
`;
|
|
1913
2174
|
}
|
|
1914
2175
|
if (task.docs && task.docs.length > 0) {
|
|
@@ -1997,6 +2258,15 @@ ${knowledgeBase}
|
|
|
1997
2258
|
These are accumulated lessons from past tasks. Follow them to avoid repeating mistakes:
|
|
1998
2259
|
${learnings}
|
|
1999
2260
|
</learnings>
|
|
2261
|
+
`;
|
|
2262
|
+
}
|
|
2263
|
+
const discussionInsights = this.getDiscussionInsightsContent();
|
|
2264
|
+
if (discussionInsights) {
|
|
2265
|
+
sections += `
|
|
2266
|
+
<discussion_insights>
|
|
2267
|
+
These are key decisions and insights from product discussions. Follow them to maintain product coherence:
|
|
2268
|
+
${discussionInsights}
|
|
2269
|
+
</discussion_insights>
|
|
2000
2270
|
`;
|
|
2001
2271
|
}
|
|
2002
2272
|
return `<direct_execution>
|
|
@@ -2011,9 +2281,9 @@ ${sections}
|
|
|
2011
2281
|
}
|
|
2012
2282
|
getProjectContext() {
|
|
2013
2283
|
const contextPath = getLocusPath(this.projectPath, "contextFile");
|
|
2014
|
-
if (
|
|
2284
|
+
if (import_node_fs4.existsSync(contextPath)) {
|
|
2015
2285
|
try {
|
|
2016
|
-
const context =
|
|
2286
|
+
const context = import_node_fs4.readFileSync(contextPath, "utf-8");
|
|
2017
2287
|
if (context.trim().length > 20) {
|
|
2018
2288
|
return context;
|
|
2019
2289
|
}
|
|
@@ -2024,10 +2294,10 @@ ${sections}
|
|
|
2024
2294
|
return this.getFallbackContext() || null;
|
|
2025
2295
|
}
|
|
2026
2296
|
getFallbackContext() {
|
|
2027
|
-
const readmePath =
|
|
2028
|
-
if (
|
|
2297
|
+
const readmePath = import_node_path6.join(this.projectPath, "README.md");
|
|
2298
|
+
if (import_node_fs4.existsSync(readmePath)) {
|
|
2029
2299
|
try {
|
|
2030
|
-
const content =
|
|
2300
|
+
const content = import_node_fs4.readFileSync(readmePath, "utf-8");
|
|
2031
2301
|
const limit = 1000;
|
|
2032
2302
|
return content.slice(0, limit) + (content.length > limit ? `
|
|
2033
2303
|
...(truncated)...` : "");
|
|
@@ -2041,15 +2311,16 @@ ${sections}
|
|
|
2041
2311
|
return `You have access to the following documentation directories for context:
|
|
2042
2312
|
- Artifacts: \`.locus/artifacts\` (local-only, not synced to cloud)
|
|
2043
2313
|
- Documents: \`.locus/documents\` (synced from cloud)
|
|
2314
|
+
- Discussions: \`.locus/discussions\` (product discussion insights and decisions)
|
|
2044
2315
|
If you need more information about the project strategies, plans, or architecture, read files in these directories.`;
|
|
2045
2316
|
}
|
|
2046
2317
|
getLearningsContent() {
|
|
2047
2318
|
const learningsPath = getLocusPath(this.projectPath, "learningsFile");
|
|
2048
|
-
if (!
|
|
2319
|
+
if (!import_node_fs4.existsSync(learningsPath)) {
|
|
2049
2320
|
return null;
|
|
2050
2321
|
}
|
|
2051
2322
|
try {
|
|
2052
|
-
const content =
|
|
2323
|
+
const content = import_node_fs4.readFileSync(learningsPath, "utf-8");
|
|
2053
2324
|
const lines = content.split(`
|
|
2054
2325
|
`).filter((l) => l.startsWith("- "));
|
|
2055
2326
|
if (lines.length === 0) {
|
|
@@ -2061,6 +2332,53 @@ If you need more information about the project strategies, plans, or architectur
|
|
|
2061
2332
|
return null;
|
|
2062
2333
|
}
|
|
2063
2334
|
}
|
|
2335
|
+
getDiscussionInsightsContent() {
|
|
2336
|
+
try {
|
|
2337
|
+
const manager = new DiscussionManager(this.projectPath);
|
|
2338
|
+
const insights = manager.getAllInsights();
|
|
2339
|
+
if (insights.length === 0) {
|
|
2340
|
+
return null;
|
|
2341
|
+
}
|
|
2342
|
+
const groups = {};
|
|
2343
|
+
for (const insight of insights) {
|
|
2344
|
+
const key = insight.type;
|
|
2345
|
+
if (!groups[key]) {
|
|
2346
|
+
groups[key] = [];
|
|
2347
|
+
}
|
|
2348
|
+
groups[key].push(insight);
|
|
2349
|
+
}
|
|
2350
|
+
const typeLabels = {
|
|
2351
|
+
decision: "Decisions",
|
|
2352
|
+
requirement: "Requirements",
|
|
2353
|
+
idea: "Ideas",
|
|
2354
|
+
concern: "Concerns",
|
|
2355
|
+
learning: "Learnings"
|
|
2356
|
+
};
|
|
2357
|
+
let output = "";
|
|
2358
|
+
for (const [type, label] of Object.entries(typeLabels)) {
|
|
2359
|
+
const items = groups[type];
|
|
2360
|
+
if (!items || items.length === 0)
|
|
2361
|
+
continue;
|
|
2362
|
+
output += `## ${label}
|
|
2363
|
+
`;
|
|
2364
|
+
for (const item of items) {
|
|
2365
|
+
output += `- [${item.title}]: ${item.content}
|
|
2366
|
+
`;
|
|
2367
|
+
}
|
|
2368
|
+
output += `
|
|
2369
|
+
`;
|
|
2370
|
+
}
|
|
2371
|
+
if (output.length === 0) {
|
|
2372
|
+
return null;
|
|
2373
|
+
}
|
|
2374
|
+
if (output.length > 2000) {
|
|
2375
|
+
output = `${output.slice(0, 1997)}...`;
|
|
2376
|
+
}
|
|
2377
|
+
return output.trimEnd();
|
|
2378
|
+
} catch {
|
|
2379
|
+
return null;
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2064
2382
|
roleToText(role) {
|
|
2065
2383
|
if (!role) {
|
|
2066
2384
|
return null;
|
|
@@ -2081,11 +2399,12 @@ If you need more information about the project strategies, plans, or architectur
|
|
|
2081
2399
|
}
|
|
2082
2400
|
}
|
|
2083
2401
|
}
|
|
2084
|
-
var
|
|
2402
|
+
var import_node_fs4, import_node_path6, import_shared2;
|
|
2085
2403
|
var init_prompt_builder = __esm(() => {
|
|
2404
|
+
init_discussion_manager();
|
|
2086
2405
|
init_config();
|
|
2087
|
-
|
|
2088
|
-
|
|
2406
|
+
import_node_fs4 = require("node:fs");
|
|
2407
|
+
import_node_path6 = require("node:path");
|
|
2089
2408
|
import_shared2 = require("@locusai/shared");
|
|
2090
2409
|
});
|
|
2091
2410
|
|
|
@@ -2408,7 +2727,6 @@ Branch: \`${result.branch}\`` : "";
|
|
|
2408
2727
|
this.log("All tasks done. Creating pull request...", "info");
|
|
2409
2728
|
const prResult = this.gitWorkflow.createPullRequest(this.completedTaskList, this.taskSummaries);
|
|
2410
2729
|
if (prResult.url) {
|
|
2411
|
-
this.log(`PR created: ${prResult.url}`, "success");
|
|
2412
2730
|
for (const task of this.completedTaskList) {
|
|
2413
2731
|
try {
|
|
2414
2732
|
await this.client.tasks.update(task.id, this.config.workspaceId, {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.test.d.ts","sourceRoot":"","sources":["../../../src/ai/__tests__/factory.test.ts"],"names":[],"mappings":""}
|
package/dist/ai/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/ai/factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/ai/factory.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,KAAK,GAAG,CAClB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,KAC1C,IAAI,CAAC;AAEV,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,KAAK,CAAC;IACZ,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,UAAU,GAAG,SAAS,EAChC,MAAM,EAAE,cAAc,GACrB,QAAQ,CA8BV"}
|
package/dist/core/config.d.ts
CHANGED
|
@@ -3,7 +3,29 @@ export declare const PROVIDER: {
|
|
|
3
3
|
readonly CODEX: "codex";
|
|
4
4
|
};
|
|
5
5
|
export type Provider = (typeof PROVIDER)[keyof typeof PROVIDER];
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const CLAUDE_MODELS: {
|
|
7
|
+
readonly OPUS: "opus";
|
|
8
|
+
readonly SONNET: "sonnet";
|
|
9
|
+
readonly HAIKU: "haiku";
|
|
10
|
+
readonly OPUS_PLAN: "opusplan";
|
|
11
|
+
readonly CLAUDE_OPUS_4_6: "claude-opus-4-6";
|
|
12
|
+
readonly CLAUDE_SONNET_4_5: "claude-sonnet-4-5-20250929";
|
|
13
|
+
readonly CLAUDE_SONNET_4_6: "claude-sonnet-4-6";
|
|
14
|
+
readonly CLAUDE_HAIKU_4_5: "claude-haiku-4-5-20251001";
|
|
15
|
+
};
|
|
16
|
+
export type ClaudeModel = (typeof CLAUDE_MODELS)[keyof typeof CLAUDE_MODELS];
|
|
17
|
+
export declare const CODEX_MODELS: {
|
|
18
|
+
readonly GPT_5_3_CODEX: "gpt-5.3-codex";
|
|
19
|
+
readonly GPT_5_3_CODEX_SPARK: "gpt-5.3-codex-spark";
|
|
20
|
+
readonly GPT_5_CODEX_MINI: "gpt-5-codex-mini";
|
|
21
|
+
readonly GPT_5_2_CODEX: "gpt-5.2-codex";
|
|
22
|
+
};
|
|
23
|
+
export type CodexModel = (typeof CODEX_MODELS)[keyof typeof CODEX_MODELS];
|
|
24
|
+
export type ModelId = ClaudeModel | CodexModel;
|
|
25
|
+
export declare const PROVIDER_MODELS: Record<Provider, readonly ModelId[]>;
|
|
26
|
+
export declare const DEFAULT_MODEL: Record<Provider, ModelId>;
|
|
27
|
+
export declare function isValidModelForProvider(provider: Provider, model: string): boolean;
|
|
28
|
+
export declare function getModelsForProvider(provider: Provider): readonly ModelId[];
|
|
7
29
|
export declare const LOCUS_SCHEMA_BASE_URL = "https://locusai.dev/schemas";
|
|
8
30
|
export declare const LOCUS_SCHEMAS: {
|
|
9
31
|
readonly config: "https://locusai.dev/schemas/config.schema.json";
|
|
@@ -21,8 +43,9 @@ export declare const LOCUS_CONFIG: {
|
|
|
21
43
|
sessionsDir: string;
|
|
22
44
|
reviewsDir: string;
|
|
23
45
|
plansDir: string;
|
|
46
|
+
discussionsDir: string;
|
|
24
47
|
};
|
|
25
|
-
export declare const LOCUS_GITIGNORE_PATTERNS: readonly ["# Locus AI - Session data (user-specific, can grow large)", ".locus/sessions/", "", "# Locus AI - Artifacts (local-only, user-specific)", ".locus/artifacts/", "", "# Locus AI - Review reports (generated per sprint)", ".locus/reviews/", "", "# Locus AI - Plans (generated per task)", ".locus/plans/", "", "# Locus AI - Settings (contains API key, telegram config, etc.)", ".locus/settings.json", "", "# Locus AI - Configuration (contains project context, etc.)", ".locus/config.json"];
|
|
48
|
+
export declare const LOCUS_GITIGNORE_PATTERNS: readonly ["# Locus AI - Session data (user-specific, can grow large)", ".locus/sessions/", "", "# Locus AI - Artifacts (local-only, user-specific)", ".locus/artifacts/", "", "# Locus AI - Review reports (generated per sprint)", ".locus/reviews/", "", "# Locus AI - Plans (generated per task)", ".locus/plans/", "", "# Locus AI - Discussions (AI discussion sessions)", ".locus/discussions/", "", "# Locus AI - Settings (contains API key, telegram config, etc.)", ".locus/settings.json", "", "# Locus AI - Configuration (contains project context, etc.)", ".locus/config.json"];
|
|
26
49
|
export declare function getLocusPath(projectPath: string, fileName: keyof typeof LOCUS_CONFIG): string;
|
|
27
50
|
/**
|
|
28
51
|
* Gets the artifacts directory path for a specific agent.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;CAGX,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAEhE,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;CAGX,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAEhE,eAAO,MAAM,aAAa;;;;;;;;;CAShB,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE7E,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE1E,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,UAAU,CAAC;AAE/C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAGvD,CAAC;AAEX,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,CAGnD,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,MAAM,GACZ,OAAO,CAET;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,OAAO,EAAE,CAE3E;AAED,eAAO,MAAM,qBAAqB,gCAAgC,CAAC;AAEnE,eAAO,MAAM,aAAa;;;CAGhB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAaxB,CAAC;AAIF,eAAO,MAAM,wBAAwB,gkBAqB3B,CAAC;AAEX,wBAAgB,YAAY,CAC1B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,OAAO,YAAY,GAClC,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,MAAM,CASR"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEFAULT_MODEL, getAgentArtifactsPath, getLocusPath, LOCUS_CONFIG, LOCUS_GITIGNORE_PATTERNS, LOCUS_SCHEMA_BASE_URL, LOCUS_SCHEMAS, PROVIDER, type Provider, } from "./config.js";
|
|
1
|
+
export { CLAUDE_MODELS, type ClaudeModel, CODEX_MODELS, type CodexModel, DEFAULT_MODEL, getAgentArtifactsPath, getLocusPath, getModelsForProvider, isValidModelForProvider, LOCUS_CONFIG, LOCUS_GITIGNORE_PATTERNS, LOCUS_SCHEMA_BASE_URL, LOCUS_SCHEMAS, type ModelId, PROVIDER, PROVIDER_MODELS, type Provider, } from "./config.js";
|
|
2
2
|
export { type CodebaseIndex, CodebaseIndexer } from "./indexer.js";
|
|
3
3
|
export { PromptBuilder } from "./prompt-builder.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,QAAQ,EACR,KAAK,QAAQ,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,WAAW,EAChB,YAAY,EACZ,KAAK,UAAU,EACf,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,EACvB,YAAY,EACZ,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,KAAK,OAAO,EACZ,QAAQ,EACR,eAAe,EACf,KAAK,QAAQ,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -8,6 +8,7 @@ export declare class PromptBuilder {
|
|
|
8
8
|
private getFallbackContext;
|
|
9
9
|
private getKnowledgeBaseSection;
|
|
10
10
|
private getLearningsContent;
|
|
11
|
+
private getDiscussionInsightsContent;
|
|
11
12
|
roleToText(role: Task["assigneeRole"]): string | null;
|
|
12
13
|
}
|
|
13
14
|
//# sourceMappingURL=prompt-builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-builder.d.ts","sourceRoot":"","sources":["../../src/core/prompt-builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,IAAI,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"prompt-builder.d.ts","sourceRoot":"","sources":["../../src/core/prompt-builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAKrD,qBAAa,aAAa;IACZ,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,MAAM;IAEjC,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IAuFlC,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqCxD,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,4BAA4B;IAqDpC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,MAAM,GAAG,IAAI;CAoBtD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DiscussionInsight, DiscussionMessage } from "../discussion-types.js";
|
|
2
|
+
export interface FacilitatorPromptInput {
|
|
3
|
+
topic: string;
|
|
4
|
+
projectContext: string | null;
|
|
5
|
+
learnings: string | null;
|
|
6
|
+
knowledgeBase: string;
|
|
7
|
+
previousMessages: DiscussionMessage[];
|
|
8
|
+
insights: DiscussionInsight[];
|
|
9
|
+
isFirstMessage: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function buildFacilitatorPrompt(input: FacilitatorPromptInput): string;
|
|
12
|
+
export declare function buildSummaryPrompt(topic: string, messages: DiscussionMessage[], insights: DiscussionInsight[]): string;
|
|
13
|
+
//# sourceMappingURL=facilitator-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facilitator-prompt.d.ts","sourceRoot":"","sources":["../../../src/discussion/agents/facilitator-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,iBAAiB,EAAE,CAAC;IACtC,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,CAwF5E;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,iBAAiB,EAAE,EAC7B,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,MAAM,CAwCR"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { LogFn } from "../ai/factory.js";
|
|
2
|
+
import type { AiRunner } from "../ai/runner.js";
|
|
3
|
+
import { Provider } from "../core/config.js";
|
|
4
|
+
import type { StreamChunk } from "../exec/types.js";
|
|
5
|
+
import type { DiscussionManager } from "./discussion-manager.js";
|
|
6
|
+
import type { Discussion, DiscussionInsight } from "./discussion-types.js";
|
|
7
|
+
export interface DiscussionFacilitatorConfig {
|
|
8
|
+
projectPath: string;
|
|
9
|
+
aiRunner: AiRunner;
|
|
10
|
+
discussionManager: DiscussionManager;
|
|
11
|
+
log?: LogFn;
|
|
12
|
+
provider: Provider;
|
|
13
|
+
model: string;
|
|
14
|
+
}
|
|
15
|
+
export interface StartDiscussionResult {
|
|
16
|
+
discussion: Discussion;
|
|
17
|
+
message: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ContinueDiscussionResult {
|
|
20
|
+
response: string;
|
|
21
|
+
insights: DiscussionInsight[];
|
|
22
|
+
}
|
|
23
|
+
export declare class DiscussionFacilitator {
|
|
24
|
+
private projectPath;
|
|
25
|
+
private aiRunner;
|
|
26
|
+
private discussionManager;
|
|
27
|
+
private log;
|
|
28
|
+
private provider;
|
|
29
|
+
private model;
|
|
30
|
+
constructor(config: DiscussionFacilitatorConfig);
|
|
31
|
+
/**
|
|
32
|
+
* Start a new discussion on a topic. Creates the discussion,
|
|
33
|
+
* generates the AI's opening question, and saves it.
|
|
34
|
+
*/
|
|
35
|
+
startDiscussion(topic: string): Promise<StartDiscussionResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Continue a discussion with a user message. Runs the AI to generate
|
|
38
|
+
* a response, extracts insights, and saves everything.
|
|
39
|
+
* Non-streaming path for Telegram and other non-interactive consumers.
|
|
40
|
+
*/
|
|
41
|
+
continueDiscussion(discussionId: string, userMessage: string): Promise<ContinueDiscussionResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Continue a discussion with streaming support for CLI consumption.
|
|
44
|
+
* Yields stream chunks in real-time and returns the final result.
|
|
45
|
+
*/
|
|
46
|
+
continueDiscussionStream(discussionId: string, userMessage: string): AsyncGenerator<StreamChunk, ContinueDiscussionResult, unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* Generate a final summary of the discussion, save it as the last
|
|
49
|
+
* assistant message, and mark the discussion as completed.
|
|
50
|
+
*/
|
|
51
|
+
summarizeDiscussion(discussionId: string): Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Extract <insight>...</insight> XML blocks from the AI response.
|
|
54
|
+
* Returns the cleaned response text (with insight tags removed) and
|
|
55
|
+
* the parsed insight objects.
|
|
56
|
+
*/
|
|
57
|
+
private parseInsights;
|
|
58
|
+
/**
|
|
59
|
+
* Build context from project files (LOCUS.md, LEARNINGS.md).
|
|
60
|
+
* Reuses the same logic as PromptBuilder.
|
|
61
|
+
*/
|
|
62
|
+
private buildContext;
|
|
63
|
+
private getProjectContext;
|
|
64
|
+
private getLearningsContent;
|
|
65
|
+
private getKnowledgeBaseSection;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=discussion-facilitator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discussion-facilitator.d.ts","sourceRoot":"","sources":["../../src/discussion/discussion-facilitator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAgB,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAKpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,GAAG,CAAC,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,GAAG,CAAQ;IACnB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,KAAK,CAAS;gBAEV,MAAM,EAAE,2BAA2B;IAS/C;;;OAGG;IACG,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA6CpE;;;;OAIG;IACG,kBAAkB,CACtB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,wBAAwB,CAAC;IAsCpC;;;OAGG;IACI,wBAAwB,CAC7B,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,GAClB,cAAc,CAAC,WAAW,EAAE,wBAAwB,EAAE,OAAO,CAAC;IAkDjE;;;OAGG;IACG,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAwBhE;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAyCrB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,uBAAuB;CAMhC"}
|