newtype-profile 1.0.50 → 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 +1 -1
- package/dist/hooks/memory-system/extractor.d.ts +1 -0
- package/dist/index.js +81 -18
- 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.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
|
@@ -24605,9 +24605,11 @@ function appendMemoryEntry(projectDir, entry) {
|
|
|
24605
24605
|
try {
|
|
24606
24606
|
const memoryDir = ensureMemoryDir(projectDir);
|
|
24607
24607
|
const filePath = join48(memoryDir, getDateFileName());
|
|
24608
|
+
const safeSessionID = entry.sessionID.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
24608
24609
|
const sections = [
|
|
24609
24610
|
`## Session: ${entry.sessionID.slice(0, 12)} (${formatTime(new Date(entry.timestamp))})`,
|
|
24610
24611
|
`SessionID: ${entry.sessionID}`,
|
|
24612
|
+
`Full transcript: \`.opencode/memory/full/${safeSessionID}.md\``,
|
|
24611
24613
|
""
|
|
24612
24614
|
];
|
|
24613
24615
|
if (entry.summary) {
|
|
@@ -24695,6 +24697,16 @@ var SYSTEM_INSTRUCTION_PATTERNS = [
|
|
|
24695
24697
|
/^chief_task\(/i,
|
|
24696
24698
|
/^delegate to deputy/i
|
|
24697
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
|
+
];
|
|
24698
24710
|
function extractTextFromParts(parts) {
|
|
24699
24711
|
return parts.filter((p) => p.type === "text" && p.text).map((p) => p.text).join(`
|
|
24700
24712
|
`);
|
|
@@ -24703,6 +24715,36 @@ function isSystemInstruction(text) {
|
|
|
24703
24715
|
const trimmed = text.trim();
|
|
24704
24716
|
return SYSTEM_INSTRUCTION_PATTERNS.some((pattern) => pattern.test(trimmed));
|
|
24705
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
|
+
}
|
|
24706
24748
|
function prepareMessagesForSummary(messages) {
|
|
24707
24749
|
const result = [];
|
|
24708
24750
|
for (const msg of messages) {
|
|
@@ -24835,7 +24877,10 @@ function extractMessageText(parts) {
|
|
|
24835
24877
|
}
|
|
24836
24878
|
function extractFullTranscript(messages) {
|
|
24837
24879
|
return messages.map((message) => {
|
|
24838
|
-
|
|
24880
|
+
let text = extractMessageText(message.parts);
|
|
24881
|
+
if (message.info.role === "user") {
|
|
24882
|
+
text = stripSystemInstructionPrefix(text);
|
|
24883
|
+
}
|
|
24839
24884
|
return {
|
|
24840
24885
|
role: message.info.role,
|
|
24841
24886
|
text
|
|
@@ -51049,28 +51094,46 @@ When analyzing problems:
|
|
|
51049
51094
|
</Thinking_Framework>
|
|
51050
51095
|
|
|
51051
51096
|
<Memory_System>
|
|
51052
|
-
## \
|
|
51097
|
+
## \u8BB0\u5FC6\u7CFB\u7EDF
|
|
51053
51098
|
|
|
51054
|
-
\u4F60\u6709\u4E00\u4E2A\u6587\u4EF6\u7CFB\u7EDF\u8BB0\u5FC6\uFF0C\u7528\u4E8E\u8DE8\u4F1A\u8BDD\u4FDD\u7559\u91CD\u8981\u4FE1\u606F\
|
|
51099
|
+
\u4F60\u6709\u4E00\u4E2A\u53CC\u5C42\u6587\u4EF6\u7CFB\u7EDF\u8BB0\u5FC6\uFF0C\u7528\u4E8E\u8DE8\u4F1A\u8BDD\u4FDD\u7559\u91CD\u8981\u4FE1\u606F\u3002
|
|
51055
51100
|
|
|
51056
|
-
|
|
51057
|
-
- \`KNOWLEDGE.md\` \u2014 \u9879\u76EE\u77E5\u8BC6\u5E93\uFF08\u4ED3\u5E93\u7EA7\u3001\u7ED3\u6784\u5316\u4E8B\u5B9E\uFF09
|
|
51058
|
-
- \`.opencode/MEMORY.md\` \u2014 \u957F\u671F\u77E5\u8BC6\u6C89\u6DC0\uFF08\u6574\u7406\u540E\u7684\u7CBE\u534E\uFF09
|
|
51059
|
-
- \`.opencode/memory/\` \u2014 \u6309\u65E5\u671F\u5B58\u50A8\u7684\u5BF9\u8BDD\u8BB0\u5FC6
|
|
51060
|
-
- \`.opencode/memory/full/\` \u2014 \u6BCF\u4E2A session \u7684\u5B8C\u6574\u5BF9\u8BDD
|
|
51101
|
+
### \u5B58\u50A8\u7ED3\u6784
|
|
51061
51102
|
|
|
51062
|
-
|
|
51063
|
-
|
|
51064
|
-
|
|
51065
|
-
|
|
51103
|
+
| \u5C42\u7EA7 | \u8DEF\u5F84 | \u7528\u9014 |
|
|
51104
|
+
|------|------|------|
|
|
51105
|
+
| \u77E5\u8BC6\u5E93 | \`KNOWLEDGE.md\` | \u9879\u76EE\u7EA7\u77E5\u8BC6\uFF08\u7ED3\u6784\u5316\u4E8B\u5B9E\uFF09 |
|
|
51106
|
+
| \u957F\u671F\u8BB0\u5FC6 | \`.opencode/MEMORY.md\` | \u5F52\u6863\u7CBE\u534E\uFF087\u5929\u540E\u81EA\u52A8\u6574\u7406\uFF09 |
|
|
51107
|
+
| \u65E5\u8BB0\u6458\u8981 | \`.opencode/memory/YYYY-MM-DD.md\` | \u6BCF\u65E5\u5BF9\u8BDD\u6458\u8981\uFF08\u542B SessionID\uFF09 |
|
|
51108
|
+
| \u5B8C\u6574\u5BF9\u8BDD | \`.opencode/memory/full/<sessionID>.md\` | \u539F\u59CB\u5BF9\u8BDD\u5168\u6587 |
|
|
51066
51109
|
|
|
51067
|
-
|
|
51068
|
-
|
|
51069
|
-
|
|
51070
|
-
|
|
51071
|
-
|
|
51110
|
+
### \u68C0\u7D22\u6A21\u5F0F
|
|
51111
|
+
|
|
51112
|
+
**\u6A21\u5F0F 1\uFF1A\u5FEB\u901F\u68C0\u7D22**\uFF08\u627E\u5F97\u5230\u3001\u626B\u5F97\u5FEB\u3001\u53EF\u805A\u5408\uFF09
|
|
51113
|
+
\`\`\`
|
|
51114
|
+
grep("\u5173\u952E\u8BCD", ".opencode/memory/") # \u641C\u7D22\u6240\u6709\u6458\u8981
|
|
51115
|
+
read(".opencode/MEMORY.md") # \u67E5\u770B\u957F\u671F\u8BB0\u5FC6\u7CBE\u534E
|
|
51116
|
+
glob(".opencode/memory/*.md") # \u5217\u51FA\u6240\u6709\u65E5\u8BB0
|
|
51117
|
+
\`\`\`
|
|
51118
|
+
\u8FD4\u56DE\uFF1ATopic + Key Points + SessionID
|
|
51119
|
+
|
|
51120
|
+
**\u6A21\u5F0F 2\uFF1A\u5B8C\u6574\u8FFD\u6EAF**\uFF08\u53EF\u8FD8\u539F\u3001\u53EF\u5BA1\u8BA1\u3001\u53EF\u5F15\u7528\uFF09
|
|
51121
|
+
\`\`\`
|
|
51122
|
+
# \u4ECE\u6458\u8981\u4E2D\u627E\u5230 SessionID\uFF08\u5982 ses_abc123\uFF09
|
|
51123
|
+
read(".opencode/memory/full/ses_abc123.md")
|
|
51124
|
+
\`\`\`
|
|
51125
|
+
\u8FD4\u56DE\uFF1A\u539F\u59CB\u5BF9\u8BDD\u5168\u6587\uFF0C\u53EF\u5F15\u7528\u5177\u4F53\u5185\u5BB9
|
|
51126
|
+
|
|
51127
|
+
### \u4F55\u65F6\u4F7F\u7528
|
|
51128
|
+
|
|
51129
|
+
| \u89E6\u53D1\u4FE1\u53F7 | \u68C0\u7D22\u6A21\u5F0F |
|
|
51130
|
+
|----------|----------|
|
|
51131
|
+
| "\u4E4B\u524D\u8BA8\u8BBA\u8FC7"\u3001"\u4E0A\u6B21"\u3001"\u6211\u4EEC\u51B3\u5B9A\u7684" | \u5FEB\u901F\u68C0\u7D22 |
|
|
51132
|
+
| "\u4F60\u8FD8\u8BB0\u5F97...\u5417"\u3001"\u5927\u6982\u4EC0\u4E48\u65F6\u5019" | \u5FEB\u901F\u68C0\u7D22 |
|
|
51133
|
+
| "\u539F\u8BDD\u600E\u4E48\u8BF4\u7684"\u3001"\u5B8C\u6574\u4E0A\u4E0B\u6587" | \u5B8C\u6574\u8FFD\u6EAF |
|
|
51134
|
+
| "\u90A3\u6B21\u5BF9\u8BDD\u7684\u7EC6\u8282" | \u5B8C\u6574\u8FFD\u6EAF |
|
|
51072
51135
|
|
|
51073
|
-
**\u8BB0\u5FC6\u662F\u4F60\u7684\u8D44\u4EA7**\uFF1A\u5584\u7528\u5B83\
|
|
51136
|
+
**\u8BB0\u5FC6\u662F\u4F60\u7684\u8D44\u4EA7**\uFF1A\u5584\u7528\u5B83\u4FDD\u6301\u8FDE\u8D2F\u6027\uFF0C\u907F\u514D\u91CD\u590D\u8BA8\u8BBA\u5DF2\u51B3\u5B9A\u7684\u4E8B\u9879\u3002
|
|
51074
51137
|
</Memory_System>
|
|
51075
51138
|
|
|
51076
51139
|
<Information_Standards>
|