newtype-profile 1.0.51 → 1.0.52

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.51",
2256
+ version: "1.0.52",
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",
@@ -11,6 +11,7 @@ interface MessageWrapper {
11
11
  info: MessageInfo;
12
12
  parts: MessagePart[];
13
13
  }
14
+ export declare function stripSystemInstructionPrefix(text: string): string;
14
15
  /** Filter and prepare messages for LLM summarization */
15
16
  export declare function prepareMessagesForSummary(messages: MessageWrapper[]): {
16
17
  role: string;
package/dist/index.js CHANGED
@@ -24697,6 +24697,16 @@ var SYSTEM_INSTRUCTION_PATTERNS = [
24697
24697
  /^chief_task\(/i,
24698
24698
  /^delegate to deputy/i
24699
24699
  ];
24700
+ var SYSTEM_INSTRUCTION_BLOCKS = [
24701
+ /^\[search-mode\][\s\S]*?(?=\n\n|$)/i,
24702
+ /^\[analyze-mode\][\s\S]*?(?=\n\n|$)/i,
24703
+ /^\[write-mode\][\s\S]*?(?=\n\n|$)/i,
24704
+ /^\[edit-mode\][\s\S]*?(?=\n\n|$)/i,
24705
+ /^MAXIMIZE SEARCH EFFORT[\s\S]*?(?=\n\n|$)/i,
24706
+ /^ANALYSIS MODE\.[\s\S]*?(?=\n\n|$)/i,
24707
+ /^<command-instruction>[\s\S]*?<\/command-instruction>\s*/i,
24708
+ /^<user-request>[\s\S]*?<\/user-request>\s*/i
24709
+ ];
24700
24710
  function extractTextFromParts(parts) {
24701
24711
  return parts.filter((p) => p.type === "text" && p.text).map((p) => p.text).join(`
24702
24712
  `);
@@ -24705,6 +24715,36 @@ function isSystemInstruction(text) {
24705
24715
  const trimmed = text.trim();
24706
24716
  return SYSTEM_INSTRUCTION_PATTERNS.some((pattern) => pattern.test(trimmed));
24707
24717
  }
24718
+ function stripSystemInstructionPrefix(text) {
24719
+ let result = text.trim();
24720
+ for (const pattern of SYSTEM_INSTRUCTION_BLOCKS) {
24721
+ result = result.replace(pattern, "").trim();
24722
+ }
24723
+ const lines = result.split(`
24724
+ `);
24725
+ const cleanedLines = [];
24726
+ let foundContent = false;
24727
+ for (const line of lines) {
24728
+ const trimmedLine = line.trim();
24729
+ if (!foundContent) {
24730
+ if (trimmedLine === "" || trimmedLine === "---") {
24731
+ continue;
24732
+ }
24733
+ if (SYSTEM_INSTRUCTION_PATTERNS.some((p) => p.test(trimmedLine))) {
24734
+ continue;
24735
+ }
24736
+ if (trimmedLine.startsWith("Deputy will dispatch") || trimmedLine.startsWith("Plus direct tools:") || trimmedLine.startsWith("NEVER stop at first") || trimmedLine.startsWith("SYNTHESIZE")) {
24737
+ continue;
24738
+ }
24739
+ foundContent = true;
24740
+ }
24741
+ if (foundContent) {
24742
+ cleanedLines.push(line);
24743
+ }
24744
+ }
24745
+ return cleanedLines.join(`
24746
+ `).trim();
24747
+ }
24708
24748
  function prepareMessagesForSummary(messages) {
24709
24749
  const result = [];
24710
24750
  for (const msg of messages) {
@@ -24837,7 +24877,10 @@ function extractMessageText(parts) {
24837
24877
  }
24838
24878
  function extractFullTranscript(messages) {
24839
24879
  return messages.map((message) => {
24840
- const text = extractMessageText(message.parts);
24880
+ let text = extractMessageText(message.parts);
24881
+ if (message.info.role === "user") {
24882
+ text = stripSystemInstructionPrefix(text);
24883
+ }
24841
24884
  return {
24842
24885
  role: message.info.role,
24843
24886
  text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newtype-profile",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
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",