newtype-profile 1.0.16 → 1.0.17

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 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.16",
2256
+ version: "1.0.17",
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,21 @@ 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
+ });
22399
+ var ConfidenceConfigSchema = exports_external.object({
22400
+ default: ConfidenceThresholdSchema.optional(),
22401
+ by_agent: ConfidenceByAgentSchema.optional(),
22402
+ max_rewrite_attempts: exports_external.number().min(1).max(10).optional()
22403
+ });
22389
22404
  var OhMyOpenCodeConfigSchema = exports_external.object({
22390
22405
  $schema: exports_external.string().optional(),
22391
22406
  disabled_mcps: exports_external.array(AnyMcpNameSchema).optional(),
@@ -22406,6 +22421,7 @@ var OhMyOpenCodeConfigSchema = exports_external.object({
22406
22421
  background_task: BackgroundTaskConfigSchema.optional(),
22407
22422
  notification: NotificationConfigSchema.optional(),
22408
22423
  git_master: GitMasterConfigSchema.optional(),
22424
+ confidence: ConfidenceConfigSchema.optional(),
22409
22425
  mcp: McpConfigSchema.optional()
22410
22426
  });
22411
22427
  // src/cli/doctor/checks/config.ts
@@ -769,6 +769,55 @@ 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
+ }, z.core.$strip>;
796
+ export declare const ConfidenceConfigSchema: z.ZodObject<{
797
+ default: z.ZodOptional<z.ZodObject<{
798
+ pass: z.ZodOptional<z.ZodNumber>;
799
+ polish: z.ZodOptional<z.ZodNumber>;
800
+ }, z.core.$strip>>;
801
+ by_agent: z.ZodOptional<z.ZodObject<{
802
+ "fact-checker": z.ZodOptional<z.ZodObject<{
803
+ pass: z.ZodOptional<z.ZodNumber>;
804
+ polish: z.ZodOptional<z.ZodNumber>;
805
+ }, z.core.$strip>>;
806
+ researcher: z.ZodOptional<z.ZodObject<{
807
+ pass: z.ZodOptional<z.ZodNumber>;
808
+ polish: z.ZodOptional<z.ZodNumber>;
809
+ }, z.core.$strip>>;
810
+ writer: z.ZodOptional<z.ZodObject<{
811
+ pass: z.ZodOptional<z.ZodNumber>;
812
+ polish: z.ZodOptional<z.ZodNumber>;
813
+ }, z.core.$strip>>;
814
+ editor: z.ZodOptional<z.ZodObject<{
815
+ pass: z.ZodOptional<z.ZodNumber>;
816
+ polish: z.ZodOptional<z.ZodNumber>;
817
+ }, z.core.$strip>>;
818
+ }, z.core.$strip>>;
819
+ max_rewrite_attempts: z.ZodOptional<z.ZodNumber>;
820
+ }, z.core.$strip>;
772
821
  export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
773
822
  $schema: z.ZodOptional<z.ZodString>;
774
823
  disabled_mcps: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -1381,6 +1430,31 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
1381
1430
  commit_footer: z.ZodDefault<z.ZodBoolean>;
1382
1431
  include_co_authored_by: z.ZodDefault<z.ZodBoolean>;
1383
1432
  }, z.core.$strip>>;
1433
+ confidence: z.ZodOptional<z.ZodObject<{
1434
+ default: z.ZodOptional<z.ZodObject<{
1435
+ pass: z.ZodOptional<z.ZodNumber>;
1436
+ polish: z.ZodOptional<z.ZodNumber>;
1437
+ }, z.core.$strip>>;
1438
+ by_agent: z.ZodOptional<z.ZodObject<{
1439
+ "fact-checker": z.ZodOptional<z.ZodObject<{
1440
+ pass: z.ZodOptional<z.ZodNumber>;
1441
+ polish: z.ZodOptional<z.ZodNumber>;
1442
+ }, z.core.$strip>>;
1443
+ researcher: z.ZodOptional<z.ZodObject<{
1444
+ pass: z.ZodOptional<z.ZodNumber>;
1445
+ polish: z.ZodOptional<z.ZodNumber>;
1446
+ }, z.core.$strip>>;
1447
+ writer: z.ZodOptional<z.ZodObject<{
1448
+ pass: z.ZodOptional<z.ZodNumber>;
1449
+ polish: z.ZodOptional<z.ZodNumber>;
1450
+ }, z.core.$strip>>;
1451
+ editor: z.ZodOptional<z.ZodObject<{
1452
+ pass: z.ZodOptional<z.ZodNumber>;
1453
+ polish: z.ZodOptional<z.ZodNumber>;
1454
+ }, z.core.$strip>>;
1455
+ }, z.core.$strip>>;
1456
+ max_rewrite_attempts: z.ZodOptional<z.ZodNumber>;
1457
+ }, z.core.$strip>>;
1384
1458
  mcp: z.ZodOptional<z.ZodObject<{
1385
1459
  tavily: z.ZodOptional<z.ZodObject<{
1386
1460
  api_key: z.ZodString;
@@ -1415,5 +1489,8 @@ export type CategoryConfig = z.infer<typeof CategoryConfigSchema>;
1415
1489
  export type CategoriesConfig = z.infer<typeof CategoriesConfigSchema>;
1416
1490
  export type BuiltinCategoryName = z.infer<typeof BuiltinCategoryNameSchema>;
1417
1491
  export type GitMasterConfig = z.infer<typeof GitMasterConfigSchema>;
1492
+ export type ConfidenceThreshold = z.infer<typeof ConfidenceThresholdSchema>;
1493
+ export type ConfidenceByAgent = z.infer<typeof ConfidenceByAgentSchema>;
1494
+ export type ConfidenceConfig = z.infer<typeof ConfidenceConfigSchema>;
1418
1495
  export type McpConfig = z.infer<typeof McpConfigSchema>;
1419
1496
  export { AnyMcpNameSchema, type AnyMcpName, McpNameSchema, type McpName, McpConfigSchema, type McpTavilyConfig, type McpFirecrawlConfig, type McpFilesystemConfig, } from "../mcp/types";
@@ -4,6 +4,7 @@
4
4
  * Parses confidence scores from agent outputs and generates
5
5
  * routing recommendations for the orchestrator.
6
6
  */
7
+ import type { ConfidenceConfig } from "../../config/schema";
7
8
  export type AgentType = "fact-checker" | "researcher" | "writer" | "editor";
8
9
  export type Recommendation = "pass" | "polish" | "rewrite" | "escalate";
9
10
  export interface ConfidenceResult {
@@ -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 MAX_REWRITE_ATTEMPTS = 2;
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
- if (confidence >= 0.8) {
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 >= 0.5) {
22944
+ } else if (confidence >= thresholds.polish) {
22913
22945
  return "polish";
22914
22946
  } else {
22915
22947
  return "rewrite";
@@ -23050,9 +23082,10 @@ function getRewritePrompt(agentType) {
23050
23082
  }
23051
23083
  function buildEscalateDirective(confidence, attempts) {
23052
23084
  const confidencePercent = Math.round(confidence * 100);
23085
+ const maxAttempts = getMaxRewriteAttempts();
23053
23086
  return `[FACT-CHECK: ESCALATE TO USER]
23054
23087
  Confidence: ${confidencePercent}% (LOW)
23055
- Rewrite attempts: ${attempts}/${MAX_REWRITE_ATTEMPTS} (LIMIT REACHED)
23088
+ Rewrite attempts: ${attempts}/${maxAttempts} (LIMIT REACHED)
23056
23089
 
23057
23090
  \u26A0\uFE0F AUTOMATIC REWRITING HAS FAILED.
23058
23091
 
@@ -23080,10 +23113,11 @@ function analyzeAgentOutput(output, sessionId, agentType) {
23080
23113
  agentType
23081
23114
  };
23082
23115
  }
23083
- const baseRecommendation = getRecommendation(confidence);
23116
+ const baseRecommendation = getRecommendation(confidence, agentType);
23084
23117
  if (baseRecommendation === "rewrite") {
23085
23118
  const attempts = incrementRewriteAttempts(sessionId, agentType);
23086
- if (attempts > MAX_REWRITE_ATTEMPTS) {
23119
+ const maxAttempts = getMaxRewriteAttempts();
23120
+ if (attempts > maxAttempts) {
23087
23121
  return {
23088
23122
  confidence,
23089
23123
  recommendation: "escalate",
@@ -23093,7 +23127,7 @@ function analyzeAgentOutput(output, sessionId, agentType) {
23093
23127
  }
23094
23128
  const directive2 = buildConfidenceDirective(confidence, sessionId, agentType) + `
23095
23129
 
23096
- Rewrite attempt: ${attempts}/${MAX_REWRITE_ATTEMPTS}`;
23130
+ Rewrite attempt: ${attempts}/${maxAttempts}`;
23097
23131
  return {
23098
23132
  confidence,
23099
23133
  recommendation: "rewrite",
@@ -49069,6 +49103,21 @@ var GitMasterConfigSchema = exports_external.object({
49069
49103
  commit_footer: exports_external.boolean().default(true),
49070
49104
  include_co_authored_by: exports_external.boolean().default(true)
49071
49105
  });
49106
+ var ConfidenceThresholdSchema = exports_external.object({
49107
+ pass: exports_external.number().min(0).max(1).optional(),
49108
+ polish: exports_external.number().min(0).max(1).optional()
49109
+ });
49110
+ var ConfidenceByAgentSchema = exports_external.object({
49111
+ "fact-checker": ConfidenceThresholdSchema.optional(),
49112
+ researcher: ConfidenceThresholdSchema.optional(),
49113
+ writer: ConfidenceThresholdSchema.optional(),
49114
+ editor: ConfidenceThresholdSchema.optional()
49115
+ });
49116
+ var ConfidenceConfigSchema = exports_external.object({
49117
+ default: ConfidenceThresholdSchema.optional(),
49118
+ by_agent: ConfidenceByAgentSchema.optional(),
49119
+ max_rewrite_attempts: exports_external.number().min(1).max(10).optional()
49120
+ });
49072
49121
  var OhMyOpenCodeConfigSchema = exports_external.object({
49073
49122
  $schema: exports_external.string().optional(),
49074
49123
  disabled_mcps: exports_external.array(AnyMcpNameSchema).optional(),
@@ -49089,6 +49138,7 @@ var OhMyOpenCodeConfigSchema = exports_external.object({
49089
49138
  background_task: BackgroundTaskConfigSchema.optional(),
49090
49139
  notification: NotificationConfigSchema.optional(),
49091
49140
  git_master: GitMasterConfigSchema.optional(),
49141
+ confidence: ConfidenceConfigSchema.optional(),
49092
49142
  mcp: McpConfigSchema.optional()
49093
49143
  });
49094
49144
  // src/plugin-config.ts
@@ -52015,6 +52065,9 @@ var OhMyOpenCodePlugin = async (ctx) => {
52015
52065
  }) : null;
52016
52066
  const editErrorRecovery = isHookEnabled("edit-error-recovery") ? createEditErrorRecoveryHook(ctx) : null;
52017
52067
  const startWork = isHookEnabled("start-work") ? createStartWorkHook(ctx) : null;
52068
+ if (pluginConfig.confidence) {
52069
+ setConfidenceConfig(pluginConfig.confidence);
52070
+ }
52018
52071
  const chiefOrchestrator = isHookEnabled("chief-orchestrator") ? createChiefOrchestratorHook(ctx) : null;
52019
52072
  const prometheusMdOnly = isHookEnabled("prometheus-md-only") ? createPrometheusMdOnlyHook(ctx) : null;
52020
52073
  const taskResumeInfo = createTaskResumeInfoHook();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newtype-profile",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "AI Agent Collaboration System for Content Creation - Based on oh-my-opencode",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",