newtype-profile 1.0.16 → 1.0.18
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/cli/index.js +19 -1
- package/dist/config/schema.d.ts +101 -0
- package/dist/hooks/chief-orchestrator/confidence-router.d.ts +6 -2
- package/dist/index.js +137 -12
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2253,7 +2253,7 @@ var require_picocolors = __commonJS((exports, module) => {
|
|
|
2253
2253
|
var require_package = __commonJS((exports, module) => {
|
|
2254
2254
|
module.exports = {
|
|
2255
2255
|
name: "newtype-profile",
|
|
2256
|
-
version: "1.0.
|
|
2256
|
+
version: "1.0.18",
|
|
2257
2257
|
description: "AI Agent Collaboration System for Content Creation - Based on oh-my-opencode",
|
|
2258
2258
|
main: "dist/index.js",
|
|
2259
2259
|
types: "dist/index.d.ts",
|
|
@@ -22386,6 +22386,23 @@ var GitMasterConfigSchema = exports_external.object({
|
|
|
22386
22386
|
commit_footer: exports_external.boolean().default(true),
|
|
22387
22387
|
include_co_authored_by: exports_external.boolean().default(true)
|
|
22388
22388
|
});
|
|
22389
|
+
var ConfidenceThresholdSchema = exports_external.object({
|
|
22390
|
+
pass: exports_external.number().min(0).max(1).optional(),
|
|
22391
|
+
polish: exports_external.number().min(0).max(1).optional()
|
|
22392
|
+
});
|
|
22393
|
+
var ConfidenceByAgentSchema = exports_external.object({
|
|
22394
|
+
"fact-checker": ConfidenceThresholdSchema.optional(),
|
|
22395
|
+
researcher: ConfidenceThresholdSchema.optional(),
|
|
22396
|
+
writer: ConfidenceThresholdSchema.optional(),
|
|
22397
|
+
editor: ConfidenceThresholdSchema.optional(),
|
|
22398
|
+
archivist: ConfidenceThresholdSchema.optional(),
|
|
22399
|
+
extractor: ConfidenceThresholdSchema.optional()
|
|
22400
|
+
});
|
|
22401
|
+
var ConfidenceConfigSchema = exports_external.object({
|
|
22402
|
+
default: ConfidenceThresholdSchema.optional(),
|
|
22403
|
+
by_agent: ConfidenceByAgentSchema.optional(),
|
|
22404
|
+
max_rewrite_attempts: exports_external.number().min(1).max(10).optional()
|
|
22405
|
+
});
|
|
22389
22406
|
var OhMyOpenCodeConfigSchema = exports_external.object({
|
|
22390
22407
|
$schema: exports_external.string().optional(),
|
|
22391
22408
|
disabled_mcps: exports_external.array(AnyMcpNameSchema).optional(),
|
|
@@ -22406,6 +22423,7 @@ var OhMyOpenCodeConfigSchema = exports_external.object({
|
|
|
22406
22423
|
background_task: BackgroundTaskConfigSchema.optional(),
|
|
22407
22424
|
notification: NotificationConfigSchema.optional(),
|
|
22408
22425
|
git_master: GitMasterConfigSchema.optional(),
|
|
22426
|
+
confidence: ConfidenceConfigSchema.optional(),
|
|
22409
22427
|
mcp: McpConfigSchema.optional()
|
|
22410
22428
|
});
|
|
22411
22429
|
// src/cli/doctor/checks/config.ts
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -769,6 +769,71 @@ export declare const GitMasterConfigSchema: z.ZodObject<{
|
|
|
769
769
|
commit_footer: z.ZodDefault<z.ZodBoolean>;
|
|
770
770
|
include_co_authored_by: z.ZodDefault<z.ZodBoolean>;
|
|
771
771
|
}, z.core.$strip>;
|
|
772
|
+
/** Threshold configuration for a single agent category */
|
|
773
|
+
export declare const ConfidenceThresholdSchema: z.ZodObject<{
|
|
774
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
775
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
776
|
+
}, z.core.$strip>;
|
|
777
|
+
/** Agent-specific confidence thresholds */
|
|
778
|
+
export declare const ConfidenceByAgentSchema: z.ZodObject<{
|
|
779
|
+
"fact-checker": z.ZodOptional<z.ZodObject<{
|
|
780
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
781
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
782
|
+
}, z.core.$strip>>;
|
|
783
|
+
researcher: z.ZodOptional<z.ZodObject<{
|
|
784
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
785
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
786
|
+
}, z.core.$strip>>;
|
|
787
|
+
writer: z.ZodOptional<z.ZodObject<{
|
|
788
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
789
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
790
|
+
}, z.core.$strip>>;
|
|
791
|
+
editor: z.ZodOptional<z.ZodObject<{
|
|
792
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
793
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
794
|
+
}, z.core.$strip>>;
|
|
795
|
+
archivist: z.ZodOptional<z.ZodObject<{
|
|
796
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
797
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
798
|
+
}, z.core.$strip>>;
|
|
799
|
+
extractor: z.ZodOptional<z.ZodObject<{
|
|
800
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
801
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
802
|
+
}, z.core.$strip>>;
|
|
803
|
+
}, z.core.$strip>;
|
|
804
|
+
export declare const ConfidenceConfigSchema: z.ZodObject<{
|
|
805
|
+
default: z.ZodOptional<z.ZodObject<{
|
|
806
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
807
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
808
|
+
}, z.core.$strip>>;
|
|
809
|
+
by_agent: z.ZodOptional<z.ZodObject<{
|
|
810
|
+
"fact-checker": z.ZodOptional<z.ZodObject<{
|
|
811
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
812
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
813
|
+
}, z.core.$strip>>;
|
|
814
|
+
researcher: z.ZodOptional<z.ZodObject<{
|
|
815
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
816
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
817
|
+
}, z.core.$strip>>;
|
|
818
|
+
writer: z.ZodOptional<z.ZodObject<{
|
|
819
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
820
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
821
|
+
}, z.core.$strip>>;
|
|
822
|
+
editor: z.ZodOptional<z.ZodObject<{
|
|
823
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
824
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
825
|
+
}, z.core.$strip>>;
|
|
826
|
+
archivist: z.ZodOptional<z.ZodObject<{
|
|
827
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
828
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
829
|
+
}, z.core.$strip>>;
|
|
830
|
+
extractor: z.ZodOptional<z.ZodObject<{
|
|
831
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
832
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
833
|
+
}, z.core.$strip>>;
|
|
834
|
+
}, z.core.$strip>>;
|
|
835
|
+
max_rewrite_attempts: z.ZodOptional<z.ZodNumber>;
|
|
836
|
+
}, z.core.$strip>;
|
|
772
837
|
export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
773
838
|
$schema: z.ZodOptional<z.ZodString>;
|
|
774
839
|
disabled_mcps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -1381,6 +1446,39 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1381
1446
|
commit_footer: z.ZodDefault<z.ZodBoolean>;
|
|
1382
1447
|
include_co_authored_by: z.ZodDefault<z.ZodBoolean>;
|
|
1383
1448
|
}, z.core.$strip>>;
|
|
1449
|
+
confidence: z.ZodOptional<z.ZodObject<{
|
|
1450
|
+
default: z.ZodOptional<z.ZodObject<{
|
|
1451
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
1452
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
1453
|
+
}, z.core.$strip>>;
|
|
1454
|
+
by_agent: z.ZodOptional<z.ZodObject<{
|
|
1455
|
+
"fact-checker": z.ZodOptional<z.ZodObject<{
|
|
1456
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
1457
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
1458
|
+
}, z.core.$strip>>;
|
|
1459
|
+
researcher: z.ZodOptional<z.ZodObject<{
|
|
1460
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
1461
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
1462
|
+
}, z.core.$strip>>;
|
|
1463
|
+
writer: z.ZodOptional<z.ZodObject<{
|
|
1464
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
1465
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
1466
|
+
}, z.core.$strip>>;
|
|
1467
|
+
editor: z.ZodOptional<z.ZodObject<{
|
|
1468
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
1469
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
1470
|
+
}, z.core.$strip>>;
|
|
1471
|
+
archivist: z.ZodOptional<z.ZodObject<{
|
|
1472
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
1473
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
1474
|
+
}, z.core.$strip>>;
|
|
1475
|
+
extractor: z.ZodOptional<z.ZodObject<{
|
|
1476
|
+
pass: z.ZodOptional<z.ZodNumber>;
|
|
1477
|
+
polish: z.ZodOptional<z.ZodNumber>;
|
|
1478
|
+
}, z.core.$strip>>;
|
|
1479
|
+
}, z.core.$strip>>;
|
|
1480
|
+
max_rewrite_attempts: z.ZodOptional<z.ZodNumber>;
|
|
1481
|
+
}, z.core.$strip>>;
|
|
1384
1482
|
mcp: z.ZodOptional<z.ZodObject<{
|
|
1385
1483
|
tavily: z.ZodOptional<z.ZodObject<{
|
|
1386
1484
|
api_key: z.ZodString;
|
|
@@ -1415,5 +1513,8 @@ export type CategoryConfig = z.infer<typeof CategoryConfigSchema>;
|
|
|
1415
1513
|
export type CategoriesConfig = z.infer<typeof CategoriesConfigSchema>;
|
|
1416
1514
|
export type BuiltinCategoryName = z.infer<typeof BuiltinCategoryNameSchema>;
|
|
1417
1515
|
export type GitMasterConfig = z.infer<typeof GitMasterConfigSchema>;
|
|
1516
|
+
export type ConfidenceThreshold = z.infer<typeof ConfidenceThresholdSchema>;
|
|
1517
|
+
export type ConfidenceByAgent = z.infer<typeof ConfidenceByAgentSchema>;
|
|
1518
|
+
export type ConfidenceConfig = z.infer<typeof ConfidenceConfigSchema>;
|
|
1418
1519
|
export type McpConfig = z.infer<typeof McpConfigSchema>;
|
|
1419
1520
|
export { AnyMcpNameSchema, type AnyMcpName, McpNameSchema, type McpName, McpConfigSchema, type McpTavilyConfig, type McpFirecrawlConfig, type McpFilesystemConfig, } from "../mcp/types";
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Parses confidence scores from agent outputs and generates
|
|
5
5
|
* routing recommendations for the orchestrator.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
import type { ConfidenceConfig } from "../../config/schema";
|
|
8
|
+
export type AgentType = "fact-checker" | "researcher" | "writer" | "editor" | "archivist" | "extractor";
|
|
8
9
|
export type Recommendation = "pass" | "polish" | "rewrite" | "escalate";
|
|
9
10
|
export interface ConfidenceResult {
|
|
10
11
|
confidence: number | null;
|
|
@@ -12,6 +13,8 @@ export interface ConfidenceResult {
|
|
|
12
13
|
directive: string | null;
|
|
13
14
|
agentType?: AgentType;
|
|
14
15
|
}
|
|
16
|
+
export declare function setConfidenceConfig(config: ConfidenceConfig | undefined): void;
|
|
17
|
+
export declare function getConfidenceConfig(): ConfidenceConfig | undefined;
|
|
15
18
|
/**
|
|
16
19
|
* Extract confidence score from fact-checker output
|
|
17
20
|
* Looks for pattern: **CONFIDENCE: X.XX**
|
|
@@ -19,8 +22,9 @@ export interface ConfidenceResult {
|
|
|
19
22
|
export declare function extractConfidence(output: string): number | null;
|
|
20
23
|
/**
|
|
21
24
|
* Determine routing recommendation based on confidence score
|
|
25
|
+
* Uses agent-specific thresholds when configured
|
|
22
26
|
*/
|
|
23
|
-
export declare function getRecommendation(confidence: number): "pass" | "polish" | "rewrite";
|
|
27
|
+
export declare function getRecommendation(confidence: number, agentType?: AgentType): "pass" | "polish" | "rewrite";
|
|
24
28
|
/**
|
|
25
29
|
* Get current rewrite attempt count for a session and agent type
|
|
26
30
|
*/
|
package/dist/index.js
CHANGED
|
@@ -22894,8 +22894,36 @@ function clearTrackerForSession(sessionId) {
|
|
|
22894
22894
|
}
|
|
22895
22895
|
|
|
22896
22896
|
// src/hooks/chief-orchestrator/confidence-router.ts
|
|
22897
|
-
var
|
|
22897
|
+
var DEFAULT_PASS_THRESHOLD = 0.8;
|
|
22898
|
+
var DEFAULT_POLISH_THRESHOLD = 0.5;
|
|
22899
|
+
var DEFAULT_MAX_REWRITE_ATTEMPTS = 2;
|
|
22898
22900
|
var rewriteAttempts = new Map;
|
|
22901
|
+
var routerConfig;
|
|
22902
|
+
function setConfidenceConfig(config) {
|
|
22903
|
+
routerConfig = config;
|
|
22904
|
+
}
|
|
22905
|
+
function getThresholdsForAgent(agentType) {
|
|
22906
|
+
if (!routerConfig) {
|
|
22907
|
+
return { pass: DEFAULT_PASS_THRESHOLD, polish: DEFAULT_POLISH_THRESHOLD };
|
|
22908
|
+
}
|
|
22909
|
+
const agentThresholds = routerConfig.by_agent?.[agentType];
|
|
22910
|
+
if (agentThresholds) {
|
|
22911
|
+
return {
|
|
22912
|
+
pass: agentThresholds.pass ?? routerConfig.default?.pass ?? DEFAULT_PASS_THRESHOLD,
|
|
22913
|
+
polish: agentThresholds.polish ?? routerConfig.default?.polish ?? DEFAULT_POLISH_THRESHOLD
|
|
22914
|
+
};
|
|
22915
|
+
}
|
|
22916
|
+
if (routerConfig.default) {
|
|
22917
|
+
return {
|
|
22918
|
+
pass: routerConfig.default.pass ?? DEFAULT_PASS_THRESHOLD,
|
|
22919
|
+
polish: routerConfig.default.polish ?? DEFAULT_POLISH_THRESHOLD
|
|
22920
|
+
};
|
|
22921
|
+
}
|
|
22922
|
+
return { pass: DEFAULT_PASS_THRESHOLD, polish: DEFAULT_POLISH_THRESHOLD };
|
|
22923
|
+
}
|
|
22924
|
+
function getMaxRewriteAttempts() {
|
|
22925
|
+
return routerConfig?.max_rewrite_attempts ?? DEFAULT_MAX_REWRITE_ATTEMPTS;
|
|
22926
|
+
}
|
|
22899
22927
|
function extractConfidence(output) {
|
|
22900
22928
|
const match = output.match(/\*\*CONFIDENCE:\s*(\d+\.?\d*)\*\*/i);
|
|
22901
22929
|
if (match) {
|
|
@@ -22906,10 +22934,14 @@ function extractConfidence(output) {
|
|
|
22906
22934
|
}
|
|
22907
22935
|
return null;
|
|
22908
22936
|
}
|
|
22909
|
-
function getRecommendation(confidence) {
|
|
22910
|
-
|
|
22937
|
+
function getRecommendation(confidence, agentType) {
|
|
22938
|
+
const thresholds = agentType ? getThresholdsForAgent(agentType) : {
|
|
22939
|
+
pass: routerConfig?.default?.pass ?? DEFAULT_PASS_THRESHOLD,
|
|
22940
|
+
polish: routerConfig?.default?.polish ?? DEFAULT_POLISH_THRESHOLD
|
|
22941
|
+
};
|
|
22942
|
+
if (confidence >= thresholds.pass) {
|
|
22911
22943
|
return "pass";
|
|
22912
|
-
} else if (confidence >=
|
|
22944
|
+
} else if (confidence >= thresholds.polish) {
|
|
22913
22945
|
return "polish";
|
|
22914
22946
|
} else {
|
|
22915
22947
|
return "rewrite";
|
|
@@ -22936,7 +22968,9 @@ function buildConfidenceDirective(confidence, sessionId, agentType = "fact-check
|
|
|
22936
22968
|
"fact-checker": "FACT-CHECK",
|
|
22937
22969
|
researcher: "RESEARCH",
|
|
22938
22970
|
writer: "DRAFT",
|
|
22939
|
-
editor: "EDIT"
|
|
22971
|
+
editor: "EDIT",
|
|
22972
|
+
archivist: "ARCHIVE",
|
|
22973
|
+
extractor: "EXTRACTION"
|
|
22940
22974
|
};
|
|
22941
22975
|
const label = agentLabels[agentType];
|
|
22942
22976
|
switch (recommendation) {
|
|
@@ -22974,6 +23008,10 @@ function getPassAction(agentType) {
|
|
|
22974
23008
|
return "Draft complete. Send to editor.";
|
|
22975
23009
|
case "editor":
|
|
22976
23010
|
return "Edit complete. Send to fact-check.";
|
|
23011
|
+
case "archivist":
|
|
23012
|
+
return "Retrieval complete. Materials ready for use.";
|
|
23013
|
+
case "extractor":
|
|
23014
|
+
return "Extraction complete. Content ready for processing.";
|
|
22977
23015
|
}
|
|
22978
23016
|
}
|
|
22979
23017
|
function getPolishAction(agentType) {
|
|
@@ -22986,6 +23024,10 @@ function getPolishAction(agentType) {
|
|
|
22986
23024
|
return "Draft needs improvement before editing.";
|
|
22987
23025
|
case "editor":
|
|
22988
23026
|
return "Needs another editing pass.";
|
|
23027
|
+
case "archivist":
|
|
23028
|
+
return "Needs deeper search or alternative queries.";
|
|
23029
|
+
case "extractor":
|
|
23030
|
+
return "Some sections need re-extraction or clarification.";
|
|
22989
23031
|
}
|
|
22990
23032
|
}
|
|
22991
23033
|
function getPolishCategory(agentType) {
|
|
@@ -22998,6 +23040,10 @@ function getPolishCategory(agentType) {
|
|
|
22998
23040
|
return "writing";
|
|
22999
23041
|
case "editor":
|
|
23000
23042
|
return "editing";
|
|
23043
|
+
case "archivist":
|
|
23044
|
+
return "archive";
|
|
23045
|
+
case "extractor":
|
|
23046
|
+
return "extraction";
|
|
23001
23047
|
}
|
|
23002
23048
|
}
|
|
23003
23049
|
function getPolishPrompt(agentType) {
|
|
@@ -23010,6 +23056,10 @@ function getPolishPrompt(agentType) {
|
|
|
23010
23056
|
return "Improve the draft addressing the identified issues. Focus on: [list specific issues]";
|
|
23011
23057
|
case "editor":
|
|
23012
23058
|
return "Continue editing to address remaining issues. Focus on: [list specific issues]";
|
|
23059
|
+
case "archivist":
|
|
23060
|
+
return "Search deeper for missing materials. Try: [alternative search terms or locations]";
|
|
23061
|
+
case "extractor":
|
|
23062
|
+
return "Re-extract the unclear sections. Focus on: [list specific sections]";
|
|
23013
23063
|
}
|
|
23014
23064
|
}
|
|
23015
23065
|
function getRewriteAction(agentType) {
|
|
@@ -23022,6 +23072,10 @@ function getRewriteAction(agentType) {
|
|
|
23022
23072
|
return "Draft has fundamental issues. Needs major revision.";
|
|
23023
23073
|
case "editor":
|
|
23024
23074
|
return "Content not ready for editing. Send back to Writer.";
|
|
23075
|
+
case "archivist":
|
|
23076
|
+
return "Retrieval failed. May need external research instead.";
|
|
23077
|
+
case "extractor":
|
|
23078
|
+
return "Extraction failed. Try different format or manual extraction.";
|
|
23025
23079
|
}
|
|
23026
23080
|
}
|
|
23027
23081
|
function getRewriteCategory(agentType) {
|
|
@@ -23034,6 +23088,10 @@ function getRewriteCategory(agentType) {
|
|
|
23034
23088
|
return "writing";
|
|
23035
23089
|
case "editor":
|
|
23036
23090
|
return "writing";
|
|
23091
|
+
case "archivist":
|
|
23092
|
+
return "research";
|
|
23093
|
+
case "extractor":
|
|
23094
|
+
return "extraction";
|
|
23037
23095
|
}
|
|
23038
23096
|
}
|
|
23039
23097
|
function getRewritePrompt(agentType) {
|
|
@@ -23046,13 +23104,18 @@ function getRewritePrompt(agentType) {
|
|
|
23046
23104
|
return "Rewrite the draft addressing fundamental issues. Focus on: [list specific issues]";
|
|
23047
23105
|
case "editor":
|
|
23048
23106
|
return "Content needs rewriting before editing. Issues: [list specific issues]";
|
|
23107
|
+
case "archivist":
|
|
23108
|
+
return "Knowledge base search failed. Consider external research or different query strategy.";
|
|
23109
|
+
case "extractor":
|
|
23110
|
+
return "Extraction quality too low. Try: different tool, manual extraction, or request clearer source.";
|
|
23049
23111
|
}
|
|
23050
23112
|
}
|
|
23051
23113
|
function buildEscalateDirective(confidence, attempts) {
|
|
23052
23114
|
const confidencePercent = Math.round(confidence * 100);
|
|
23115
|
+
const maxAttempts = getMaxRewriteAttempts();
|
|
23053
23116
|
return `[FACT-CHECK: ESCALATE TO USER]
|
|
23054
23117
|
Confidence: ${confidencePercent}% (LOW)
|
|
23055
|
-
Rewrite attempts: ${attempts}/${
|
|
23118
|
+
Rewrite attempts: ${attempts}/${maxAttempts} (LIMIT REACHED)
|
|
23056
23119
|
|
|
23057
23120
|
\u26A0\uFE0F AUTOMATIC REWRITING HAS FAILED.
|
|
23058
23121
|
|
|
@@ -23080,10 +23143,11 @@ function analyzeAgentOutput(output, sessionId, agentType) {
|
|
|
23080
23143
|
agentType
|
|
23081
23144
|
};
|
|
23082
23145
|
}
|
|
23083
|
-
const baseRecommendation = getRecommendation(confidence);
|
|
23146
|
+
const baseRecommendation = getRecommendation(confidence, agentType);
|
|
23084
23147
|
if (baseRecommendation === "rewrite") {
|
|
23085
23148
|
const attempts = incrementRewriteAttempts(sessionId, agentType);
|
|
23086
|
-
|
|
23149
|
+
const maxAttempts = getMaxRewriteAttempts();
|
|
23150
|
+
if (attempts > maxAttempts) {
|
|
23087
23151
|
return {
|
|
23088
23152
|
confidence,
|
|
23089
23153
|
recommendation: "escalate",
|
|
@@ -23093,7 +23157,7 @@ function analyzeAgentOutput(output, sessionId, agentType) {
|
|
|
23093
23157
|
}
|
|
23094
23158
|
const directive2 = buildConfidenceDirective(confidence, sessionId, agentType) + `
|
|
23095
23159
|
|
|
23096
|
-
Rewrite attempt: ${attempts}/${
|
|
23160
|
+
Rewrite attempt: ${attempts}/${maxAttempts}`;
|
|
23097
23161
|
return {
|
|
23098
23162
|
confidence,
|
|
23099
23163
|
recommendation: "rewrite",
|
|
@@ -23115,7 +23179,9 @@ function detectAgentType(output, category) {
|
|
|
23115
23179
|
"fact-check": "fact-checker",
|
|
23116
23180
|
research: "researcher",
|
|
23117
23181
|
writing: "writer",
|
|
23118
|
-
editing: "editor"
|
|
23182
|
+
editing: "editor",
|
|
23183
|
+
archive: "archivist",
|
|
23184
|
+
extraction: "extractor"
|
|
23119
23185
|
};
|
|
23120
23186
|
if (categoryToAgent[category]) {
|
|
23121
23187
|
return categoryToAgent[category];
|
|
@@ -23134,6 +23200,12 @@ function detectAgentType(output, category) {
|
|
|
23134
23200
|
if (lowerOutput.includes("draft") || lowerOutput.includes("wrote") || lowerOutput.includes("created content")) {
|
|
23135
23201
|
return "writer";
|
|
23136
23202
|
}
|
|
23203
|
+
if (lowerOutput.includes("retrieval") || lowerOutput.includes("archive") || lowerOutput.includes("knowledge base") || lowerOutput.includes("found:")) {
|
|
23204
|
+
return "archivist";
|
|
23205
|
+
}
|
|
23206
|
+
if (lowerOutput.includes("extracted") || lowerOutput.includes("extraction") || lowerOutput.includes("pdf") || lowerOutput.includes("document conversion")) {
|
|
23207
|
+
return "extractor";
|
|
23208
|
+
}
|
|
23137
23209
|
return null;
|
|
23138
23210
|
}
|
|
23139
23211
|
function hasConfidenceScore(output) {
|
|
@@ -49069,6 +49141,23 @@ var GitMasterConfigSchema = exports_external.object({
|
|
|
49069
49141
|
commit_footer: exports_external.boolean().default(true),
|
|
49070
49142
|
include_co_authored_by: exports_external.boolean().default(true)
|
|
49071
49143
|
});
|
|
49144
|
+
var ConfidenceThresholdSchema = exports_external.object({
|
|
49145
|
+
pass: exports_external.number().min(0).max(1).optional(),
|
|
49146
|
+
polish: exports_external.number().min(0).max(1).optional()
|
|
49147
|
+
});
|
|
49148
|
+
var ConfidenceByAgentSchema = exports_external.object({
|
|
49149
|
+
"fact-checker": ConfidenceThresholdSchema.optional(),
|
|
49150
|
+
researcher: ConfidenceThresholdSchema.optional(),
|
|
49151
|
+
writer: ConfidenceThresholdSchema.optional(),
|
|
49152
|
+
editor: ConfidenceThresholdSchema.optional(),
|
|
49153
|
+
archivist: ConfidenceThresholdSchema.optional(),
|
|
49154
|
+
extractor: ConfidenceThresholdSchema.optional()
|
|
49155
|
+
});
|
|
49156
|
+
var ConfidenceConfigSchema = exports_external.object({
|
|
49157
|
+
default: ConfidenceThresholdSchema.optional(),
|
|
49158
|
+
by_agent: ConfidenceByAgentSchema.optional(),
|
|
49159
|
+
max_rewrite_attempts: exports_external.number().min(1).max(10).optional()
|
|
49160
|
+
});
|
|
49072
49161
|
var OhMyOpenCodeConfigSchema = exports_external.object({
|
|
49073
49162
|
$schema: exports_external.string().optional(),
|
|
49074
49163
|
disabled_mcps: exports_external.array(AnyMcpNameSchema).optional(),
|
|
@@ -49089,6 +49178,7 @@ var OhMyOpenCodeConfigSchema = exports_external.object({
|
|
|
49089
49178
|
background_task: BackgroundTaskConfigSchema.optional(),
|
|
49090
49179
|
notification: NotificationConfigSchema.optional(),
|
|
49091
49180
|
git_master: GitMasterConfigSchema.optional(),
|
|
49181
|
+
confidence: ConfidenceConfigSchema.optional(),
|
|
49092
49182
|
mcp: McpConfigSchema.optional()
|
|
49093
49183
|
});
|
|
49094
49184
|
// src/plugin-config.ts
|
|
@@ -49584,7 +49674,23 @@ FOUND: [Number] relevant items
|
|
|
49584
49674
|
- The knowledge base is your domain \u2014 you know it better than anyone
|
|
49585
49675
|
- Your value is in CONNECTIONS, not just retrieval
|
|
49586
49676
|
- Think like a detective: what story do these materials tell together?
|
|
49587
|
-
</Mindset
|
|
49677
|
+
</Mindset>
|
|
49678
|
+
|
|
49679
|
+
<Confidence_Score>
|
|
49680
|
+
## Retrieval Completeness Score (REQUIRED)
|
|
49681
|
+
After completing your retrieval, you MUST end your response with a confidence score in this EXACT format:
|
|
49682
|
+
|
|
49683
|
+
---
|
|
49684
|
+
**CONFIDENCE: X.XX**
|
|
49685
|
+
|
|
49686
|
+
Where X.XX is a number between 0.00 and 1.00:
|
|
49687
|
+
- 0.90-1.00: Found all relevant materials, strong connections identified, no gaps
|
|
49688
|
+
- 0.70-0.89: Good coverage, useful connections, but some materials may be missing
|
|
49689
|
+
- 0.50-0.69: Partial findings, weak connections, significant gaps in knowledge base
|
|
49690
|
+
- 0.00-0.49: Limited results, no clear connections, or query too vague
|
|
49691
|
+
|
|
49692
|
+
This score helps Chief decide if more retrieval or external research is needed.
|
|
49693
|
+
</Confidence_Score>`
|
|
49588
49694
|
};
|
|
49589
49695
|
}
|
|
49590
49696
|
var archivistAgent = createArchivistAgent();
|
|
@@ -49651,7 +49757,23 @@ You handle data source conversions: PDFs, images, documents, and other formats.
|
|
|
49651
49757
|
- Accuracy over speed
|
|
49652
49758
|
- When in doubt, flag it rather than guess
|
|
49653
49759
|
- Your output becomes input for other agents \u2014 make it clean
|
|
49654
|
-
</Mindset
|
|
49760
|
+
</Mindset>
|
|
49761
|
+
|
|
49762
|
+
<Confidence_Score>
|
|
49763
|
+
## Extraction Quality Score (REQUIRED)
|
|
49764
|
+
After completing your extraction, you MUST end your response with a confidence score in this EXACT format:
|
|
49765
|
+
|
|
49766
|
+
---
|
|
49767
|
+
**CONFIDENCE: X.XX**
|
|
49768
|
+
|
|
49769
|
+
Where X.XX is a number between 0.00 and 1.00:
|
|
49770
|
+
- 0.90-1.00: Clean extraction, all content captured, structure preserved, no uncertainties
|
|
49771
|
+
- 0.70-0.89: Good extraction, minor formatting issues or a few unclear sections
|
|
49772
|
+
- 0.50-0.69: Partial extraction, significant unclear sections, structure partially lost
|
|
49773
|
+
- 0.00-0.49: Poor extraction, major content missing, or format not supported
|
|
49774
|
+
|
|
49775
|
+
This score helps Chief decide if re-extraction or manual review is needed.
|
|
49776
|
+
</Confidence_Score>`
|
|
49655
49777
|
};
|
|
49656
49778
|
}
|
|
49657
49779
|
var extractorAgent = createExtractorAgent();
|
|
@@ -52015,6 +52137,9 @@ var OhMyOpenCodePlugin = async (ctx) => {
|
|
|
52015
52137
|
}) : null;
|
|
52016
52138
|
const editErrorRecovery = isHookEnabled("edit-error-recovery") ? createEditErrorRecoveryHook(ctx) : null;
|
|
52017
52139
|
const startWork = isHookEnabled("start-work") ? createStartWorkHook(ctx) : null;
|
|
52140
|
+
if (pluginConfig.confidence) {
|
|
52141
|
+
setConfidenceConfig(pluginConfig.confidence);
|
|
52142
|
+
}
|
|
52018
52143
|
const chiefOrchestrator = isHookEnabled("chief-orchestrator") ? createChiefOrchestratorHook(ctx) : null;
|
|
52019
52144
|
const prometheusMdOnly = isHookEnabled("prometheus-md-only") ? createPrometheusMdOnlyHook(ctx) : null;
|
|
52020
52145
|
const taskResumeInfo = createTaskResumeInfoHook();
|