newtype-profile 1.0.10 → 1.0.12

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.10",
2256
+ version: "1.0.12",
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",
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Confidence-based routing for fact-check results
3
+ *
4
+ * Parses confidence scores from fact-checker output and generates
5
+ * routing recommendations for the orchestrator.
6
+ */
7
+ export interface ConfidenceResult {
8
+ confidence: number | null;
9
+ recommendation: "pass" | "polish" | "rewrite" | null;
10
+ directive: string | null;
11
+ }
12
+ /**
13
+ * Extract confidence score from fact-checker output
14
+ * Looks for pattern: **CONFIDENCE: X.XX**
15
+ */
16
+ export declare function extractConfidence(output: string): number | null;
17
+ /**
18
+ * Determine routing recommendation based on confidence score
19
+ */
20
+ export declare function getRecommendation(confidence: number): "pass" | "polish" | "rewrite";
21
+ /**
22
+ * Build routing directive for Chief based on confidence
23
+ */
24
+ export declare function buildConfidenceDirective(confidence: number, sessionId: string): string;
25
+ /**
26
+ * Analyze fact-check output and generate routing result
27
+ */
28
+ export declare function analyzeFactCheckOutput(output: string, sessionId: string): ConfidenceResult;
29
+ /**
30
+ * Check if output is from a fact-check task
31
+ */
32
+ export declare function isFactCheckOutput(output: string): boolean;
package/dist/index.js CHANGED
@@ -22893,6 +22893,77 @@ function clearTrackerForSession(sessionId) {
22893
22893
  sessionTrackers.delete(sessionId);
22894
22894
  }
22895
22895
 
22896
+ // src/hooks/chief-orchestrator/confidence-router.ts
22897
+ function extractConfidence(output) {
22898
+ const match = output.match(/\*\*CONFIDENCE:\s*(\d+\.?\d*)\*\*/i);
22899
+ if (match) {
22900
+ const value = parseFloat(match[1]);
22901
+ if (!isNaN(value) && value >= 0 && value <= 1) {
22902
+ return value;
22903
+ }
22904
+ }
22905
+ return null;
22906
+ }
22907
+ function getRecommendation(confidence) {
22908
+ if (confidence >= 0.8) {
22909
+ return "pass";
22910
+ } else if (confidence >= 0.5) {
22911
+ return "polish";
22912
+ } else {
22913
+ return "rewrite";
22914
+ }
22915
+ }
22916
+ function buildConfidenceDirective(confidence, sessionId) {
22917
+ const recommendation = getRecommendation(confidence);
22918
+ const confidencePercent = Math.round(confidence * 100);
22919
+ switch (recommendation) {
22920
+ case "pass":
22921
+ return `[FACT-CHECK PASSED]
22922
+ Confidence: ${confidencePercent}% (HIGH)
22923
+ Action: Content verified. Ready for delivery.`;
22924
+ case "polish":
22925
+ return `[FACT-CHECK: NEEDS POLISH]
22926
+ Confidence: ${confidencePercent}% (MEDIUM)
22927
+ Action: Send to Editor for refinement.
22928
+
22929
+ REQUIRED: Call chief_task with:
22930
+ category="editing"
22931
+ prompt="Polish the content based on fact-check feedback. Address minor uncertainties while preserving verified claims."
22932
+ resume="${sessionId}"`;
22933
+ case "rewrite":
22934
+ return `[FACT-CHECK: NEEDS REWRITE]
22935
+ Confidence: ${confidencePercent}% (LOW)
22936
+ Action: Significant issues found. Send back to Writer.
22937
+
22938
+ REQUIRED: Call chief_task with:
22939
+ category="writing"
22940
+ prompt="Rewrite the content addressing the fact-check issues. Focus on: [list specific issues from fact-check report]"
22941
+ resume="${sessionId}"
22942
+
22943
+ NOTE: Max 2 rewrite attempts. If still failing after 2 rewrites, escalate to user.`;
22944
+ }
22945
+ }
22946
+ function analyzeFactCheckOutput(output, sessionId) {
22947
+ const confidence = extractConfidence(output);
22948
+ if (confidence === null) {
22949
+ return {
22950
+ confidence: null,
22951
+ recommendation: null,
22952
+ directive: null
22953
+ };
22954
+ }
22955
+ const recommendation = getRecommendation(confidence);
22956
+ const directive = buildConfidenceDirective(confidence, sessionId);
22957
+ return {
22958
+ confidence,
22959
+ recommendation,
22960
+ directive
22961
+ };
22962
+ }
22963
+ function isFactCheckOutput(output) {
22964
+ return output.includes("CONFIDENCE:") || output.toLowerCase().includes("fact-check") || output.includes("\u6838\u67E5") || output.includes("verification");
22965
+ }
22966
+
22896
22967
  // src/hooks/chief-orchestrator/index.ts
22897
22968
  var HOOK_NAME6 = "chief-orchestrator";
22898
22969
  var ALLOWED_PATH_PREFIX2 = ".chief/";
@@ -23465,12 +23536,28 @@ ${buildOrchestratorReminder(boulderState.plan_name, progress, subagentSessionId)
23465
23536
  const category = categoryMatch?.[1];
23466
23537
  const summarized = summarizeOutput(output.output, { category });
23467
23538
  const formattedSummary = formatSummarizedOutput(summarized);
23539
+ let confidenceDirective = "";
23540
+ if (isFactCheckOutput(output.output)) {
23541
+ const confidenceResult = analyzeFactCheckOutput(output.output, subagentSessionId);
23542
+ if (confidenceResult.directive) {
23543
+ confidenceDirective = `
23544
+
23545
+ ---
23546
+ ${confidenceResult.directive}
23547
+ ---`;
23548
+ log(`[${HOOK_NAME6}] Confidence routing detected`, {
23549
+ sessionID: input.sessionID,
23550
+ confidence: confidenceResult.confidence,
23551
+ recommendation: confidenceResult.recommendation
23552
+ });
23553
+ }
23554
+ }
23468
23555
  output.output = `${formattedSummary}
23469
23556
 
23470
23557
  ${progressTable}
23471
23558
 
23472
23559
  ${fileChanges ? `
23473
- ${fileChanges}` : ""}
23560
+ ${fileChanges}` : ""}${confidenceDirective}
23474
23561
  <system-reminder>
23475
23562
  ${buildStandaloneVerificationReminder(subagentSessionId)}
23476
23563
  </system-reminder>`;
@@ -44501,7 +44588,22 @@ Approach:
44501
44588
  - Official documents over media reports
44502
44589
  - Academic/peer-reviewed over informal
44503
44590
  - Note confidence levels for each claim
44504
- </Category_Context>`;
44591
+ </Category_Context>
44592
+
44593
+ <Output_Format>
44594
+ CRITICAL: You MUST end your response with a confidence score in this EXACT format:
44595
+
44596
+ ---
44597
+ **CONFIDENCE: X.XX**
44598
+
44599
+ Where X.XX is a number between 0.00 and 1.00:
44600
+ - 0.90-1.00: All claims verified with authoritative sources
44601
+ - 0.70-0.89: Most claims verified, minor uncertainties
44602
+ - 0.50-0.69: Some claims unverified or conflicting sources
44603
+ - 0.00-0.49: Significant issues, major claims unverified or false
44604
+
44605
+ This score determines whether the content passes review or needs revision.
44606
+ </Output_Format>`;
44505
44607
  var ARCHIVE_CATEGORY_PROMPT_APPEND = `<Category_Context>
44506
44608
  You are working on ARCHIVE/KNOWLEDGE-BASE tasks.
44507
44609
 
@@ -44582,11 +44684,11 @@ Approach:
44582
44684
  </Category_Context>`;
44583
44685
  var DEFAULT_CATEGORIES = {
44584
44686
  research: {
44585
- model: "google/antigravity-gemini-3-pro-high",
44687
+ model: "google/antigravity-gemini-3-flash",
44586
44688
  temperature: 0.5
44587
44689
  },
44588
44690
  "fact-check": {
44589
- model: "google/antigravity-gemini-3-pro-high",
44691
+ model: "google/antigravity-gemini-3-flash",
44590
44692
  temperature: 0.2
44591
44693
  },
44592
44694
  archive: {
@@ -44619,6 +44721,14 @@ var CATEGORY_PROMPT_APPENDS = {
44619
44721
  extraction: EXTRACTION_CATEGORY_PROMPT_APPEND,
44620
44722
  quick: QUICK_CATEGORY_PROMPT_APPEND
44621
44723
  };
44724
+ var AGENT_TO_CATEGORY_MAP = {
44725
+ "fact-checker": "fact-check",
44726
+ researcher: "research",
44727
+ archivist: "archive",
44728
+ writer: "writing",
44729
+ editor: "editing",
44730
+ extractor: "extraction"
44731
+ };
44622
44732
  var BUILTIN_CATEGORIES = Object.keys(DEFAULT_CATEGORIES).join(", ");
44623
44733
  var CHIEF_TASK_DESCRIPTION = `Spawn agent task with category-based or direct agent selection.
44624
44734
 
@@ -44999,6 +45109,10 @@ ${textContent || "(No text output)"}`;
44999
45109
  if (!agentToUse) {
45000
45110
  return `\u274C Agent name cannot be empty.`;
45001
45111
  }
45112
+ const mappedCategory = AGENT_TO_CATEGORY_MAP[agentToUse];
45113
+ if (mappedCategory) {
45114
+ categoryPromptAppend = CATEGORY_PROMPT_APPENDS[mappedCategory];
45115
+ }
45002
45116
  try {
45003
45117
  const agentsResult = await client2.app.agents();
45004
45118
  const agents = agentsResult.data ?? agentsResult;
@@ -1,6 +1,6 @@
1
1
  import type { CategoryConfig } from "../../config/schema";
2
2
  export declare const RESEARCH_CATEGORY_PROMPT_APPEND = "<Category_Context>\nYou are working on RESEARCH tasks.\n\n\u60C5\u62A5\u5458 (Researcher) mindset:\n- Broad, comprehensive information gathering\n- Multiple source triangulation\n- Identify emerging trends and patterns\n- Surface unexpected connections\n- Prioritize recency and relevance\n\nApproach:\n- Cast a wide net first\n- Synthesize findings into actionable insights\n- Flag contradictions or uncertainties\n- Provide source attribution\n</Category_Context>";
3
- export declare const FACT_CHECK_CATEGORY_PROMPT_APPEND = "<Category_Context>\nYou are working on FACT-CHECKING tasks.\n\n\u6838\u67E5\u5458 (Fact-Checker) mindset:\n- Rigorous source verification\n- Cross-reference multiple authoritative sources\n- Identify potential biases or conflicts of interest\n- Assess credibility and reliability\n- Flag unverifiable claims\n\nApproach:\n- Primary sources over secondary\n- Official documents over media reports\n- Academic/peer-reviewed over informal\n- Note confidence levels for each claim\n</Category_Context>";
3
+ export declare const FACT_CHECK_CATEGORY_PROMPT_APPEND = "<Category_Context>\nYou are working on FACT-CHECKING tasks.\n\n\u6838\u67E5\u5458 (Fact-Checker) mindset:\n- Rigorous source verification\n- Cross-reference multiple authoritative sources\n- Identify potential biases or conflicts of interest\n- Assess credibility and reliability\n- Flag unverifiable claims\n\nApproach:\n- Primary sources over secondary\n- Official documents over media reports\n- Academic/peer-reviewed over informal\n- Note confidence levels for each claim\n</Category_Context>\n\n<Output_Format>\nCRITICAL: You MUST end your response with a confidence score in this EXACT format:\n\n---\n**CONFIDENCE: X.XX**\n\nWhere X.XX is a number between 0.00 and 1.00:\n- 0.90-1.00: All claims verified with authoritative sources\n- 0.70-0.89: Most claims verified, minor uncertainties\n- 0.50-0.69: Some claims unverified or conflicting sources\n- 0.00-0.49: Significant issues, major claims unverified or false\n\nThis score determines whether the content passes review or needs revision.\n</Output_Format>";
4
4
  export declare const ARCHIVE_CATEGORY_PROMPT_APPEND = "<Category_Context>\nYou are working on ARCHIVE/KNOWLEDGE-BASE tasks.\n\n\u8D44\u6599\u5458 (Archivist) mindset:\n- Deep knowledge of existing repository content\n- Find connections between documents\n- Identify gaps and duplications\n- Maintain organizational coherence\n- Surface relevant historical context\n\nApproach:\n- Thorough local search first\n- Map relationships between content\n- Suggest categorization improvements\n- Preserve institutional knowledge\n</Category_Context>";
5
5
  export declare const WRITING_CATEGORY_PROMPT_APPEND = "<Category_Context>\nYou are working on WRITING/CONTENT-CREATION tasks.\n\n\u5199\u624B (Writer) mindset:\n- Engaging, reader-focused prose\n- Clear structure and flow\n- Appropriate voice and tone\n- Balance of depth and accessibility\n- Original perspectives and insights\n\nApproach:\n- Understand audience and purpose\n- Outline before drafting\n- Show, don't just tell\n- Support claims with evidence\n- Iterate for clarity and impact\n</Category_Context>";
6
6
  export declare const EDITING_CATEGORY_PROMPT_APPEND = "<Category_Context>\nYou are working on EDITING/REFINEMENT tasks.\n\n\u7F16\u8F91 (Editor) mindset:\n- Preserve author's voice while improving clarity\n- Ruthless about unnecessary words\n- Logical flow and coherence\n- Consistency in style and terminology\n- Reader experience first\n\nApproach:\n- Big picture structure first\n- Then paragraph-level coherence\n- Finally sentence-level polish\n- Explain significant changes\n</Category_Context>";
@@ -9,4 +9,10 @@ export declare const QUICK_CATEGORY_PROMPT_APPEND = "<Category_Context>\nYou are
9
9
  export declare const DEFAULT_CATEGORIES: Record<string, CategoryConfig>;
10
10
  export declare const CATEGORY_PROMPT_APPENDS: Record<string, string>;
11
11
  export declare const CATEGORY_DESCRIPTIONS: Record<string, string>;
12
+ /**
13
+ * Maps agent names to their corresponding category for prompt append injection.
14
+ * When chief_task is called with subagent_type, we still want to inject
15
+ * the category-specific prompt (e.g., CONFIDENCE format for fact-checker).
16
+ */
17
+ export declare const AGENT_TO_CATEGORY_MAP: Record<string, string>;
12
18
  export declare const CHIEF_TASK_DESCRIPTION: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newtype-profile",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
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",