pantheon-cli 0.2.87 → 0.2.92
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/pantheon.mjs +515 -50
- package/package.json +1 -1
package/dist/pantheon.mjs
CHANGED
|
@@ -40554,15 +40554,22 @@ function commandHead(command) {
|
|
|
40554
40554
|
const sub = (words[index + 1] || "").toLowerCase();
|
|
40555
40555
|
return /^[a-z][a-z0-9-]*$/.test(sub) ? `${head} ${sub}` : head;
|
|
40556
40556
|
}
|
|
40557
|
-
var CORRECTION_OPENS = /^\s*(?:no\b|nope\b|don'?t\b|stop\b|actually\b|wrong\b|that'?s not\b|not (?:what|quite|right)\b|instead\b|never\b|why (?:did|are|would) you\b|you (?:should|shouldn'?t|need to|keep)\b)/i;
|
|
40558
|
-
var CORRECTION_ANYWHERE = /\b(?:that'?s not what i (?:asked|meant|said)|not what i (?:asked|meant|wanted)|i (?:already )?(?:said|told you)|you (?:keep|again) )/i;
|
|
40559
|
-
var MAX_CORRECTIONS_PER_SESSION =
|
|
40557
|
+
var CORRECTION_OPENS = /^\s*(?:no\b|nope\b|don'?t\b|do not\b|stop\b|actually\b|wrong\b|that'?s not\b|not (?:what|quite|right)\b|instead\b|never\b|why (?:did|are|would) you\b|you (?:should|shouldn'?t|need to|keep)\b)/i;
|
|
40558
|
+
var CORRECTION_ANYWHERE = /\b(?:that'?s not what i (?:asked|meant|said)|not what i (?:asked|meant|wanted)|i (?:already )?(?:said|told you)|you (?:keep|again) |(?:shoul(?:d)? not|shouldn'?t|must not|never).{0,100}\b(?:block|stop|affect|fail))/i;
|
|
40559
|
+
var MAX_CORRECTIONS_PER_SESSION = 256;
|
|
40560
40560
|
var WRAPPED = /<user_query>([\s\S]*?)<\/user_query>/i;
|
|
40561
40561
|
var CONTEXT_BLOCK = /<(timestamp|system_reminder|system_notification|attached_files|external_links|open_and_recently_viewed_files|previous_conversation_summary|agent_transcripts|rules|user_info|git_status)>[\s\S]*?<\/\1>/gi;
|
|
40562
40562
|
function humanText(raw) {
|
|
40563
40563
|
const inner = raw.match(WRAPPED);
|
|
40564
40564
|
return (inner ? inner[1] : raw).replace(CONTEXT_BLOCK, " ").replace(/<\/?[a-z_]+>/gi, " ").replace(/\s+/g, " ").trim();
|
|
40565
40565
|
}
|
|
40566
|
+
function correctionFocus(text2) {
|
|
40567
|
+
const recurrence = text2.match(
|
|
40568
|
+
/\b(?:about this\s+)?i (?:already )?(?:said|told you)|\b(?:again|you keep)\b/i
|
|
40569
|
+
);
|
|
40570
|
+
if (!recurrence?.index) return text2;
|
|
40571
|
+
return text2.slice(Math.max(0, recurrence.index - 80));
|
|
40572
|
+
}
|
|
40566
40573
|
function extractCorrections(turns) {
|
|
40567
40574
|
const out = [];
|
|
40568
40575
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -40571,13 +40578,326 @@ function extractCorrections(turns) {
|
|
|
40571
40578
|
const text2 = humanText(turn.text || "");
|
|
40572
40579
|
if (text2.length < 8) continue;
|
|
40573
40580
|
if (!CORRECTION_OPENS.test(text2) && !CORRECTION_ANYWHERE.test(text2)) continue;
|
|
40574
|
-
const
|
|
40581
|
+
const focused = correctionFocus(text2);
|
|
40582
|
+
const fingerprint2 = focused.slice(0, 80).toLowerCase();
|
|
40575
40583
|
if (seen.has(fingerprint2)) continue;
|
|
40576
40584
|
seen.add(fingerprint2);
|
|
40577
|
-
out.push({ turnId: turn.id, text:
|
|
40578
|
-
|
|
40585
|
+
out.push({ turnId: turn.id, text: focused.slice(0, 600) });
|
|
40586
|
+
}
|
|
40587
|
+
return out.slice(-MAX_CORRECTIONS_PER_SESSION);
|
|
40588
|
+
}
|
|
40589
|
+
var CORRECTION_STOP_WORDS = /* @__PURE__ */ new Set([
|
|
40590
|
+
"already",
|
|
40591
|
+
"and",
|
|
40592
|
+
"about",
|
|
40593
|
+
"after",
|
|
40594
|
+
"again",
|
|
40595
|
+
"also",
|
|
40596
|
+
"anything",
|
|
40597
|
+
"because",
|
|
40598
|
+
"before",
|
|
40599
|
+
"both",
|
|
40600
|
+
"can",
|
|
40601
|
+
"could",
|
|
40602
|
+
"did",
|
|
40603
|
+
"does",
|
|
40604
|
+
"doing",
|
|
40605
|
+
"for",
|
|
40606
|
+
"from",
|
|
40607
|
+
"hand",
|
|
40608
|
+
"have",
|
|
40609
|
+
"into",
|
|
40610
|
+
"make",
|
|
40611
|
+
"must",
|
|
40612
|
+
"never",
|
|
40613
|
+
"now",
|
|
40614
|
+
"not",
|
|
40615
|
+
"off",
|
|
40616
|
+
"only",
|
|
40617
|
+
"should",
|
|
40618
|
+
"that",
|
|
40619
|
+
"the",
|
|
40620
|
+
"their",
|
|
40621
|
+
"them",
|
|
40622
|
+
"then",
|
|
40623
|
+
"there",
|
|
40624
|
+
"these",
|
|
40625
|
+
"this",
|
|
40626
|
+
"those",
|
|
40627
|
+
"told",
|
|
40628
|
+
"user",
|
|
40629
|
+
"want",
|
|
40630
|
+
"with",
|
|
40631
|
+
"would",
|
|
40632
|
+
"you",
|
|
40633
|
+
"your"
|
|
40634
|
+
]);
|
|
40635
|
+
var CORRECTION_ALIASES = {
|
|
40636
|
+
affect: "block",
|
|
40637
|
+
affected: "block",
|
|
40638
|
+
affecting: "block",
|
|
40639
|
+
artifact: "file",
|
|
40640
|
+
artifacts: "file",
|
|
40641
|
+
attachment: "file",
|
|
40642
|
+
attachments: "file",
|
|
40643
|
+
big: "large",
|
|
40644
|
+
blocked: "block",
|
|
40645
|
+
blocking: "block",
|
|
40646
|
+
files: "file",
|
|
40647
|
+
handed: "handoff",
|
|
40648
|
+
handing: "handoff",
|
|
40649
|
+
huge: "large",
|
|
40650
|
+
ignored: "skip",
|
|
40651
|
+
ignoring: "skip",
|
|
40652
|
+
omitted: "skip",
|
|
40653
|
+
omitting: "skip",
|
|
40654
|
+
oversized: "large",
|
|
40655
|
+
persisted: "continue",
|
|
40656
|
+
persisting: "continue",
|
|
40657
|
+
proceeded: "continue",
|
|
40658
|
+
proceeding: "continue",
|
|
40659
|
+
skipped: "skip",
|
|
40660
|
+
skipping: "skip",
|
|
40661
|
+
stop: "block",
|
|
40662
|
+
stopped: "block",
|
|
40663
|
+
stopping: "block",
|
|
40664
|
+
submitted: "continue",
|
|
40665
|
+
submitting: "continue"
|
|
40666
|
+
};
|
|
40667
|
+
function correctionTokens(text2) {
|
|
40668
|
+
return new Set(
|
|
40669
|
+
text2.toLowerCase().replace(/[^a-z0-9]+/g, " ").split(/\s+/).map((word) => CORRECTION_ALIASES[word] || word).filter((word) => word.length >= 3 && !CORRECTION_STOP_WORDS.has(word))
|
|
40670
|
+
);
|
|
40671
|
+
}
|
|
40672
|
+
var CORRECTION_ANCHORS = /* @__PURE__ */ new Set([
|
|
40673
|
+
"agent",
|
|
40674
|
+
"build",
|
|
40675
|
+
"button",
|
|
40676
|
+
"cli",
|
|
40677
|
+
"context",
|
|
40678
|
+
"deploy",
|
|
40679
|
+
"design",
|
|
40680
|
+
"drive",
|
|
40681
|
+
"file",
|
|
40682
|
+
"github",
|
|
40683
|
+
"handoff",
|
|
40684
|
+
"install",
|
|
40685
|
+
"layout",
|
|
40686
|
+
"mcp",
|
|
40687
|
+
"page",
|
|
40688
|
+
"provider",
|
|
40689
|
+
"skill",
|
|
40690
|
+
"storage",
|
|
40691
|
+
"test",
|
|
40692
|
+
"vault"
|
|
40693
|
+
]);
|
|
40694
|
+
var CORRECTION_ACTIONS = /* @__PURE__ */ new Set([
|
|
40695
|
+
"add",
|
|
40696
|
+
"block",
|
|
40697
|
+
"continue",
|
|
40698
|
+
"default",
|
|
40699
|
+
"keep",
|
|
40700
|
+
"remove",
|
|
40701
|
+
"show",
|
|
40702
|
+
"skip",
|
|
40703
|
+
"use"
|
|
40704
|
+
]);
|
|
40705
|
+
var CORRECTION_TOPIC_PRIORITY = [
|
|
40706
|
+
"handoff",
|
|
40707
|
+
"file",
|
|
40708
|
+
"large",
|
|
40709
|
+
"skip",
|
|
40710
|
+
"block",
|
|
40711
|
+
"context",
|
|
40712
|
+
"storage",
|
|
40713
|
+
"provider",
|
|
40714
|
+
"drive",
|
|
40715
|
+
"github",
|
|
40716
|
+
"mcp",
|
|
40717
|
+
"skill"
|
|
40718
|
+
];
|
|
40719
|
+
function correctionSimilarity(left, right) {
|
|
40720
|
+
const common = [...left].filter((token) => right.has(token));
|
|
40721
|
+
if (common.includes("handoff") && common.includes("file") && common.some((token) => token === "block" || token === "skip")) {
|
|
40722
|
+
return 1;
|
|
40579
40723
|
}
|
|
40580
|
-
|
|
40724
|
+
if (common.length < 3 || !common.some((token) => CORRECTION_ANCHORS.has(token)) || !common.some((token) => CORRECTION_ACTIONS.has(token))) {
|
|
40725
|
+
return 0;
|
|
40726
|
+
}
|
|
40727
|
+
const overlap = common.length / Math.min(left.size, right.size);
|
|
40728
|
+
return common.length >= 5 && overlap >= 0.25 ? Math.max(0.4, overlap) : overlap;
|
|
40729
|
+
}
|
|
40730
|
+
function correctionClassification(text2) {
|
|
40731
|
+
if (/\b(?:handoff|storage|provider|drive|github|vault|data|file|security|privacy|sync)\b/i.test(
|
|
40732
|
+
text2
|
|
40733
|
+
) && /\b(?:must|never|should not|shouldn'?t|cannot|can'?t|do not|don'?t|block|always)\b/i.test(
|
|
40734
|
+
text2
|
|
40735
|
+
)) {
|
|
40736
|
+
return "product-invariant";
|
|
40737
|
+
}
|
|
40738
|
+
if (/\b(?:command|install|build|deploy|publish|test|migration|config|setup|run)\b/i.test(
|
|
40739
|
+
text2
|
|
40740
|
+
)) {
|
|
40741
|
+
return "procedure";
|
|
40742
|
+
}
|
|
40743
|
+
return "preference";
|
|
40744
|
+
}
|
|
40745
|
+
function correctionTopic(evidence, classification) {
|
|
40746
|
+
const frequency = /* @__PURE__ */ new Map();
|
|
40747
|
+
for (const item of evidence) {
|
|
40748
|
+
for (const token of correctionTokens(item.text)) {
|
|
40749
|
+
frequency.set(token, (frequency.get(token) || 0) + 1);
|
|
40750
|
+
}
|
|
40751
|
+
}
|
|
40752
|
+
const words = [...frequency].filter(([, count]) => count >= Math.min(2, evidence.length)).sort((a, b) => {
|
|
40753
|
+
const aPriority = CORRECTION_TOPIC_PRIORITY.indexOf(a[0]);
|
|
40754
|
+
const bPriority = CORRECTION_TOPIC_PRIORITY.indexOf(b[0]);
|
|
40755
|
+
return b[1] - a[1] || (aPriority < 0 ? Number.MAX_SAFE_INTEGER : aPriority) - (bPriority < 0 ? Number.MAX_SAFE_INTEGER : bPriority) || a[0].localeCompare(b[0]);
|
|
40756
|
+
}).map(([word]) => word).slice(0, 5);
|
|
40757
|
+
return skillName(
|
|
40758
|
+
words.length ? words.join("-") : `${classification}-correction`
|
|
40759
|
+
);
|
|
40760
|
+
}
|
|
40761
|
+
function detectRecurringCorrections(sessions, options = {}) {
|
|
40762
|
+
const observations = sessions.flatMap(
|
|
40763
|
+
(session) => extractCorrections(session.turns).map((hit) => ({
|
|
40764
|
+
sessionId: session.id,
|
|
40765
|
+
turnId: hit.turnId,
|
|
40766
|
+
text: hit.text,
|
|
40767
|
+
tokens: correctionTokens(hit.text)
|
|
40768
|
+
}))
|
|
40769
|
+
);
|
|
40770
|
+
const groups = [];
|
|
40771
|
+
for (const observation of observations) {
|
|
40772
|
+
const group = groups.find(
|
|
40773
|
+
(candidate) => candidate.evidence.some(
|
|
40774
|
+
(evidence) => correctionSimilarity(evidence.tokens, observation.tokens) >= 0.4
|
|
40775
|
+
)
|
|
40776
|
+
);
|
|
40777
|
+
if (!group) {
|
|
40778
|
+
groups.push({
|
|
40779
|
+
evidence: [observation]
|
|
40780
|
+
});
|
|
40781
|
+
continue;
|
|
40782
|
+
}
|
|
40783
|
+
group.evidence.push(observation);
|
|
40784
|
+
}
|
|
40785
|
+
return groups.flatMap((group) => {
|
|
40786
|
+
const sessionIds = new Set(group.evidence.map((item) => item.sessionId));
|
|
40787
|
+
const turnRange = /* @__PURE__ */ new Map();
|
|
40788
|
+
for (const item of group.evidence) {
|
|
40789
|
+
const range = turnRange.get(item.sessionId) ?? {
|
|
40790
|
+
min: item.turnId,
|
|
40791
|
+
max: item.turnId
|
|
40792
|
+
};
|
|
40793
|
+
range.min = Math.min(range.min, item.turnId);
|
|
40794
|
+
range.max = Math.max(range.max, item.turnId);
|
|
40795
|
+
turnRange.set(item.sessionId, range);
|
|
40796
|
+
}
|
|
40797
|
+
const separated = [...turnRange.values()].some(
|
|
40798
|
+
(range) => range.max - range.min >= 25
|
|
40799
|
+
);
|
|
40800
|
+
const explicitRepeat = group.evidence.some(
|
|
40801
|
+
(item) => /\b(?:again|already|repeated|told you)\b|\byou keep\b/i.test(
|
|
40802
|
+
item.text
|
|
40803
|
+
)
|
|
40804
|
+
);
|
|
40805
|
+
if (sessionIds.size < 2 && !(group.evidence.length >= 2 && separated) && !explicitRepeat) {
|
|
40806
|
+
return [];
|
|
40807
|
+
}
|
|
40808
|
+
const classification = correctionClassification(
|
|
40809
|
+
group.evidence.map((item) => item.text).join(" ")
|
|
40810
|
+
);
|
|
40811
|
+
const suggestedName = correctionTopic(group.evidence, classification);
|
|
40812
|
+
const key = `correction::${suggestedName}`;
|
|
40813
|
+
const coverage = options.known?.has(key) ? "existing-skill" : documented(
|
|
40814
|
+
options.docs || "",
|
|
40815
|
+
group.evidence.map((item) => item.text).join(" ")
|
|
40816
|
+
) ? "project-docs" : "undocumented";
|
|
40817
|
+
const sorted = [...group.evidence].sort(
|
|
40818
|
+
(a, b) => a.sessionId.localeCompare(b.sessionId) || a.turnId - b.turnId
|
|
40819
|
+
);
|
|
40820
|
+
const evidence = sorted.length <= 6 ? sorted : [sorted[0], ...sorted.slice(-5)];
|
|
40821
|
+
const recurrence = sessionIds.size > 1 ? `${group.evidence.length} corrections across ${sessionIds.size} sessions` : explicitRepeat && group.evidence.length === 1 ? "an explicit repeated-correction statement" : `${group.evidence.length} corrections separated within one long session`;
|
|
40822
|
+
return [
|
|
40823
|
+
{
|
|
40824
|
+
key,
|
|
40825
|
+
suggestedName,
|
|
40826
|
+
classification,
|
|
40827
|
+
coverage,
|
|
40828
|
+
why: `Detected ${recurrence}; classified as a ${classification.replace("-", " ")}.`,
|
|
40829
|
+
occurrences: group.evidence.length,
|
|
40830
|
+
sessions: sessionIds.size,
|
|
40831
|
+
evidence: evidence.map(({ sessionId, turnId, text: text2 }) => ({
|
|
40832
|
+
sessionId,
|
|
40833
|
+
turnId,
|
|
40834
|
+
text: text2
|
|
40835
|
+
}))
|
|
40836
|
+
}
|
|
40837
|
+
];
|
|
40838
|
+
}).sort(
|
|
40839
|
+
(a, b) => Number(b.coverage === "undocumented") - Number(a.coverage === "undocumented") || b.sessions - a.sessions || b.occurrences - a.occurrences || b.evidence.at(-1).turnId - a.evidence.at(-1).turnId
|
|
40840
|
+
).slice(0, options.limit ?? 5);
|
|
40841
|
+
}
|
|
40842
|
+
var KNOWLEDGE_ALGORITHM = /\b(?:algorithm|ranking|scoring|forgetting curve|ebbinghaus|batching|chunking|compression|backoff|retry (?:logic|policy|strategy|with backoff)|idempotenc\w*|reconciliation|tombston\w*|envelope encryption|optimistic concurrency|hash(?:ing)?|deduplicat\w*)\b/i;
|
|
40843
|
+
var KNOWLEDGE_ALGORITHM_CONCEPT = /\b(?:algorithm|ranking|scoring|forgetting curve|ebbinghaus)\b/i;
|
|
40844
|
+
var KNOWLEDGE_GENERIC_METHOD = /\b(?:approach|strategy|method)\b/i;
|
|
40845
|
+
var KNOWLEDGE_PROBLEM = /\b(?:problem|issue|error|failure|failed|limit|race|conflict|timeout|slow|stuck|overflow|payload|performance)\b/i;
|
|
40846
|
+
var KNOWLEDGE_SOLUTION = /\b(?:root cause|fixed by|resolved by|solved by|the fix (?:is|was)|the solution (?:is|was)|we fixed|we resolved|prevents? .{0,80}\bby)\b/i;
|
|
40847
|
+
var KNOWLEDGE_FACT = /\b(?:we use|uses|is stored|stores|is configured|defaults? to|requires?|must always|must never|only reaches users|is published|is encrypted|belongs to)\b/i;
|
|
40848
|
+
var KNOWLEDGE_APPLIED = /\b(?:use|used|using|implemented|applied|solved|fixed|resolved|works?|prevents?|changed|migrat\w*)\b/i;
|
|
40849
|
+
var KNOWLEDGE_VERIFIED = /\b(?:tests? pass(?:ed)?|verified|confirmed|working|succeeded|build pass(?:ed)?|no longer fails?)\b/i;
|
|
40850
|
+
var MAX_KNOWLEDGE_PER_KIND = 12;
|
|
40851
|
+
function knowledgeText(turn) {
|
|
40852
|
+
const raw = turn.role === "user" ? humanText(turn.text || "") : (turn.text || "").replace(/\s+/g, " ").trim();
|
|
40853
|
+
if (turn.role === "assistant" && (/^\*\*(?:Addressing|Analyzing|Checking|Considering|Deciding|Diagnosing|Evaluating|Explaining|Exploring|Implementing|Inspecting|Planning|Reviewing|Thinking|Updating)\b/i.test(
|
|
40854
|
+
raw
|
|
40855
|
+
) || /^(?:I need to|I(?:'m| am) (?:thinking|considering|wondering|going to inspect))\b/i.test(
|
|
40856
|
+
raw
|
|
40857
|
+
))) {
|
|
40858
|
+
return "";
|
|
40859
|
+
}
|
|
40860
|
+
return raw.replace(
|
|
40861
|
+
/\s+\*\*(?:Addressing|Analyzing|Checking|Considering|Deciding|Diagnosing|Evaluating|Explaining|Exploring|Finalizing|Implementing|Inspecting|Planning|Reviewing|Thinking|Updating)[^*]*\*\*[\s\S]*$/i,
|
|
40862
|
+
""
|
|
40863
|
+
).replace(/\*\*(?:Inspecting|Exploring|Thinking|Implementing)[^*]*\*\*/gi, " ").replace(/\s+/g, " ").trim().slice(0, 800);
|
|
40864
|
+
}
|
|
40865
|
+
function extractKnowledge(sessionId, turns) {
|
|
40866
|
+
const found = [];
|
|
40867
|
+
const seen = /* @__PURE__ */ new Set();
|
|
40868
|
+
for (const turn of turns) {
|
|
40869
|
+
if (turn.role !== "user" && turn.role !== "assistant") continue;
|
|
40870
|
+
const text2 = knowledgeText(turn);
|
|
40871
|
+
if (text2.length < 20) continue;
|
|
40872
|
+
const kinds = [];
|
|
40873
|
+
if (KNOWLEDGE_ALGORITHM.test(text2) && (KNOWLEDGE_ALGORITHM_CONCEPT.test(text2) || KNOWLEDGE_APPLIED.test(text2) && KNOWLEDGE_PROBLEM.test(text2)) || KNOWLEDGE_GENERIC_METHOD.test(text2) && KNOWLEDGE_APPLIED.test(text2) && KNOWLEDGE_PROBLEM.test(text2)) {
|
|
40874
|
+
kinds.push("algorithm");
|
|
40875
|
+
}
|
|
40876
|
+
if (KNOWLEDGE_SOLUTION.test(text2)) kinds.push("solution");
|
|
40877
|
+
if (KNOWLEDGE_FACT.test(text2)) kinds.push("fact");
|
|
40878
|
+
for (const kind of kinds) {
|
|
40879
|
+
const fingerprint2 = `${kind}:${text2.toLowerCase().replace(/[^a-z0-9]+/g, " ").slice(0, 140)}`;
|
|
40880
|
+
if (seen.has(fingerprint2)) continue;
|
|
40881
|
+
seen.add(fingerprint2);
|
|
40882
|
+
const applied = KNOWLEDGE_APPLIED.test(text2);
|
|
40883
|
+
const verified = KNOWLEDGE_VERIFIED.test(text2);
|
|
40884
|
+
const confidence = kind === "fact" ? turn.role === "user" || /\b(?:must|requires?|configured)\b/i.test(text2) ? "high" : "medium" : applied && (kind === "algorithm" || verified) ? "high" : "medium";
|
|
40885
|
+
found.push({
|
|
40886
|
+
sessionId,
|
|
40887
|
+
turnId: turn.id,
|
|
40888
|
+
text: text2,
|
|
40889
|
+
kind,
|
|
40890
|
+
role: turn.role,
|
|
40891
|
+
confidence,
|
|
40892
|
+
why: kind === "fact" ? "States a potentially durable project fact or invariant; verify it against current source before drafting." : kind === "algorithm" ? applied ? "Names a method or algorithm that the conversation applied." : "Names a method or algorithm that may be reusable." : verified ? "Describes a fix with an outcome signal." : "Describes an explicit problem-and-solution relationship."
|
|
40893
|
+
});
|
|
40894
|
+
}
|
|
40895
|
+
}
|
|
40896
|
+
return ["fact", "algorithm", "solution"].flatMap(
|
|
40897
|
+
(kind) => found.filter((signal) => signal.kind === kind).sort(
|
|
40898
|
+
(a, b) => Number(b.confidence === "high") - Number(a.confidence === "high") || b.turnId - a.turnId
|
|
40899
|
+
).slice(0, MAX_KNOWLEDGE_PER_KIND)
|
|
40900
|
+
);
|
|
40581
40901
|
}
|
|
40582
40902
|
function extractRoutines(turns) {
|
|
40583
40903
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -41419,10 +41739,12 @@ function collectAttachedArtifacts(turns, cwd = process.cwd()) {
|
|
|
41419
41739
|
}
|
|
41420
41740
|
return found;
|
|
41421
41741
|
}
|
|
41422
|
-
function missingGeneratedFiles(turns, artifacts = []) {
|
|
41742
|
+
function missingGeneratedFiles(turns, artifacts = [], skipped = []) {
|
|
41423
41743
|
const mentioned2 = mentionedDocuments(turns).map((doc) => doc.name);
|
|
41424
41744
|
if (!mentioned2.length) return null;
|
|
41425
|
-
const attached = new Set(
|
|
41745
|
+
const attached = new Set(
|
|
41746
|
+
[...artifacts.map((item) => item.name), ...skipped.map((item) => item.name)].map((name) => artifactKey(name).toLowerCase())
|
|
41747
|
+
);
|
|
41426
41748
|
const missing = mentioned2.filter((name) => !attached.has(artifactKey(name).toLowerCase()));
|
|
41427
41749
|
if (!missing.length) return null;
|
|
41428
41750
|
return `This chat created or named these files but they were not attached: ${missing.join(", ")}. Attach each existing file without recreating it: use { name, path } when the local MCP process can read the file, { name, url } for a downloadable HTTPS file, or inline base64 only as a fallback. Never generate a replacement artifact merely to complete a handoff.`;
|
|
@@ -41879,7 +42201,11 @@ function writeHandoff(home, input) {
|
|
|
41879
42201
|
const sweepPatch = sweep?.artifacts.find((artifact) => artifact.name === WORKSPACE_PATCH);
|
|
41880
42202
|
const consolidatedOverflow = sweepPatch && !artifacts.some((artifact) => artifact.content === sweepPatch.content) ? Math.max((sweep?.consolidatedFiles ?? 0) - 1, 0) : 0;
|
|
41881
42203
|
if (!captured && !input.transcriptImport) {
|
|
41882
|
-
const missing = missingGeneratedFiles(
|
|
42204
|
+
const missing = missingGeneratedFiles(
|
|
42205
|
+
turns,
|
|
42206
|
+
artifacts,
|
|
42207
|
+
input.skippedArtifacts
|
|
42208
|
+
);
|
|
41883
42209
|
if (missing) throw new Error(missing);
|
|
41884
42210
|
}
|
|
41885
42211
|
const source = input.source || captured?.session.source || input.transcriptImport?.source;
|
|
@@ -41932,10 +42258,14 @@ function writeHandoff(home, input) {
|
|
|
41932
42258
|
artifacts: session.artifacts,
|
|
41933
42259
|
// Files this session made that the archive would not take. Silence here is
|
|
41934
42260
|
// how a handoff comes to promise more than it holds.
|
|
41935
|
-
skipped: [
|
|
42261
|
+
skipped: [
|
|
42262
|
+
...input.skippedArtifacts ?? [],
|
|
42263
|
+
...sweep?.skipped ?? [],
|
|
42264
|
+
...fitted.skipped
|
|
42265
|
+
].slice(0, MAX_SKIP_REPORT),
|
|
41936
42266
|
// The list above is capped. Reporting its length as the total understates
|
|
41937
42267
|
// the loss by however many it left out.
|
|
41938
|
-
skippedTotal: (sweep?.skippedTotal ?? 0) + fitted.skippedTotal + consolidatedOverflow,
|
|
42268
|
+
skippedTotal: (input.skippedArtifactTotal ?? input.skippedArtifacts?.length ?? 0) + (sweep?.skippedTotal ?? 0) + fitted.skippedTotal + consolidatedOverflow,
|
|
41939
42269
|
// Usually empty. Only a failure that recurred across separate conversations
|
|
41940
42270
|
// and is not already documented gets this far.
|
|
41941
42271
|
skillCandidates: spaceSkillCandidates(root, cwd),
|
|
@@ -41956,7 +42286,11 @@ function writePark(home, input) {
|
|
|
41956
42286
|
collectDiskArtifacts(turns)
|
|
41957
42287
|
);
|
|
41958
42288
|
if (turns.length) {
|
|
41959
|
-
const missing = missingGeneratedFiles(
|
|
42289
|
+
const missing = missingGeneratedFiles(
|
|
42290
|
+
turns,
|
|
42291
|
+
artifacts,
|
|
42292
|
+
input.skippedArtifacts
|
|
42293
|
+
);
|
|
41960
42294
|
if (missing) throw new Error(missing);
|
|
41961
42295
|
}
|
|
41962
42296
|
const session = turns.length ? writeSession(root, input.source, turns, artifacts) : { sessionId: null, artifacts: writeArtifacts(join3(root, "sessions", "inbox"), artifacts) };
|
|
@@ -42068,16 +42402,20 @@ function skillReview(home, space, cwd) {
|
|
|
42068
42402
|
when: skill.when,
|
|
42069
42403
|
sessions: skill.sessions
|
|
42070
42404
|
}));
|
|
42071
|
-
const
|
|
42405
|
+
const allCorrections = [];
|
|
42406
|
+
const knowledge = [];
|
|
42072
42407
|
const routines = /* @__PURE__ */ new Map();
|
|
42073
42408
|
let turns = 0;
|
|
42074
42409
|
for (const session of sessions) {
|
|
42075
42410
|
turns += session.turns.length;
|
|
42076
42411
|
for (const hit of extractCorrections(session.turns)) {
|
|
42077
|
-
|
|
42078
|
-
|
|
42079
|
-
|
|
42412
|
+
allCorrections.push({
|
|
42413
|
+
sessionId: session.id,
|
|
42414
|
+
turnId: hit.turnId,
|
|
42415
|
+
text: hit.text
|
|
42416
|
+
});
|
|
42080
42417
|
}
|
|
42418
|
+
knowledge.push(...extractKnowledge(session.id, session.turns));
|
|
42081
42419
|
for (const [head, use] of extractRoutines(session.turns)) {
|
|
42082
42420
|
const seen = routines.get(head) ?? {
|
|
42083
42421
|
runs: 0,
|
|
@@ -42097,7 +42435,38 @@ function skillReview(home, space, cwd) {
|
|
|
42097
42435
|
example: use.example
|
|
42098
42436
|
}));
|
|
42099
42437
|
const documented2 = docs ? shortlist.filter((item) => mentioned(docs, item.head)).map((item) => item.head) : [];
|
|
42100
|
-
const
|
|
42438
|
+
const known = knownSkillKeys(root);
|
|
42439
|
+
const candidates = detectCandidates(sessions, { known, docs });
|
|
42440
|
+
const recurringCorrections = detectRecurringCorrections(sessions, {
|
|
42441
|
+
known,
|
|
42442
|
+
docs
|
|
42443
|
+
});
|
|
42444
|
+
const recurringEvidence = new Set(
|
|
42445
|
+
recurringCorrections.flatMap(
|
|
42446
|
+
(candidate) => candidate.evidence.map(
|
|
42447
|
+
(evidence) => `${evidence.sessionId}#${evidence.turnId}`
|
|
42448
|
+
)
|
|
42449
|
+
)
|
|
42450
|
+
);
|
|
42451
|
+
const corrections = [...allCorrections].sort((a, b) => {
|
|
42452
|
+
const aRecurring = recurringEvidence.has(`${a.sessionId}#${a.turnId}`);
|
|
42453
|
+
const bRecurring = recurringEvidence.has(`${b.sessionId}#${b.turnId}`);
|
|
42454
|
+
return Number(bRecurring) - Number(aRecurring) || b.sessionId.localeCompare(a.sessionId) || b.turnId - a.turnId;
|
|
42455
|
+
}).slice(0, REVIEW_CORRECTIONS);
|
|
42456
|
+
const reasons = [
|
|
42457
|
+
!sessions.length ? "No archived sessions were available." : null,
|
|
42458
|
+
allCorrections.length > 0 && !recurringCorrections.length ? `${allCorrections.length} correction signal${allCorrections.length === 1 ? " was" : "s were"} found, but none repeated across sessions, far-apart turns, or explicit recurrence language.` : null,
|
|
42459
|
+
sessions.length < 2 && !candidates.length ? "Resolved tool-failure candidates require recurrence across at least two sessions." : null,
|
|
42460
|
+
recurringCorrections.some(
|
|
42461
|
+
(candidate) => candidate.coverage !== "undocumented"
|
|
42462
|
+
) ? "Some recurring feedback is already covered by project documentation or an existing skill." : null,
|
|
42463
|
+
knowledge.length === 0 ? "No durable fact, algorithm, or explicit problem-and-solution signal was found." : null
|
|
42464
|
+
].filter((reason) => Boolean(reason));
|
|
42465
|
+
const reusableKnowledge = {
|
|
42466
|
+
facts: knowledge.filter((signal) => signal.kind === "fact"),
|
|
42467
|
+
algorithms: knowledge.filter((signal) => signal.kind === "algorithm"),
|
|
42468
|
+
solutions: knowledge.filter((signal) => signal.kind === "solution")
|
|
42469
|
+
};
|
|
42101
42470
|
return {
|
|
42102
42471
|
space: slug,
|
|
42103
42472
|
slots: { used: live.length, cap: MAX_LIVE_SKILLS },
|
|
@@ -42105,14 +42474,28 @@ function skillReview(home, space, cwd) {
|
|
|
42105
42474
|
drafts,
|
|
42106
42475
|
scanned: { sessions: sessions.length, turns },
|
|
42107
42476
|
candidates,
|
|
42477
|
+
recurringCorrections,
|
|
42478
|
+
reusableKnowledge,
|
|
42108
42479
|
corrections,
|
|
42109
42480
|
routines: shortlist,
|
|
42110
42481
|
documented: documented2,
|
|
42482
|
+
diagnostics: {
|
|
42483
|
+
correctionsFound: allCorrections.length,
|
|
42484
|
+
recurringCorrections: recurringCorrections.length,
|
|
42485
|
+
factsFound: reusableKnowledge.facts.length,
|
|
42486
|
+
algorithmsFound: reusableKnowledge.algorithms.length,
|
|
42487
|
+
solutionsFound: reusableKnowledge.solutions.length,
|
|
42488
|
+
reasons
|
|
42489
|
+
},
|
|
42111
42490
|
note: reviewNote({
|
|
42112
42491
|
slug,
|
|
42113
42492
|
slots: live.length,
|
|
42114
42493
|
sessions: sessions.length,
|
|
42115
|
-
signals: corrections.length + shortlist.length + candidates.length
|
|
42494
|
+
signals: corrections.length + shortlist.length + candidates.length + recurringCorrections.length + knowledge.length,
|
|
42495
|
+
corrections: allCorrections.length,
|
|
42496
|
+
recurring: recurringCorrections.length,
|
|
42497
|
+
knowledge: knowledge.length,
|
|
42498
|
+
reasons
|
|
42116
42499
|
})
|
|
42117
42500
|
};
|
|
42118
42501
|
}
|
|
@@ -42126,9 +42509,17 @@ function reviewNote(input) {
|
|
|
42126
42509
|
parts.push(
|
|
42127
42510
|
`Nothing is archived in "${input.slug}" yet, so there is no history to review. Anything worth writing has to come from the conversation you are in right now.`
|
|
42128
42511
|
);
|
|
42512
|
+
} else if (input.recurring || input.knowledge) {
|
|
42513
|
+
parts.push(
|
|
42514
|
+
`Found ${input.recurring} recurring correction cluster${input.recurring === 1 ? "" : "s"} and ${input.knowledge} reusable-knowledge signal${input.knowledge === 1 ? "" : "s"}. Read their cited turns first. A demonstrated algorithm or solved problem can justify a skill without a correction; temporary facts should remain memory rather than becoming permanent guidance.`
|
|
42515
|
+
);
|
|
42129
42516
|
} else if (!input.signals) {
|
|
42130
42517
|
parts.push(
|
|
42131
|
-
`Nothing recurring turned up across ${input.sessions} archived session${input.sessions === 1 ? "" : "s"}.
|
|
42518
|
+
`Nothing recurring turned up across ${input.sessions} archived session${input.sessions === 1 ? "" : "s"}. ${input.reasons.join(" ") || "No correction or resolved-failure evidence cleared the recurrence gate."}`
|
|
42519
|
+
);
|
|
42520
|
+
} else if (input.corrections) {
|
|
42521
|
+
parts.push(
|
|
42522
|
+
`Found ${input.corrections} correction signal${input.corrections === 1 ? "" : "s"}, but no recurring correction cluster. ${input.reasons.join(" ")}`
|
|
42132
42523
|
);
|
|
42133
42524
|
} else {
|
|
42134
42525
|
parts.push(
|
|
@@ -44483,6 +44874,29 @@ var MAX_ARTIFACTS = 200;
|
|
|
44483
44874
|
var MAX_TRANSCRIPT_EXPORT_BYTES = 256 * 1024 * 1024;
|
|
44484
44875
|
var MAX_REDIRECTS = 4;
|
|
44485
44876
|
var FETCH_TIMEOUT_MS = 15e3;
|
|
44877
|
+
var MAX_SKIP_REPORT2 = 12;
|
|
44878
|
+
var ArtifactLimitError = class extends Error {
|
|
44879
|
+
constructor(reason) {
|
|
44880
|
+
super(reason);
|
|
44881
|
+
this.reason = reason;
|
|
44882
|
+
}
|
|
44883
|
+
reason;
|
|
44884
|
+
};
|
|
44885
|
+
function sizeLabel(bytes) {
|
|
44886
|
+
return `${Math.ceil(bytes / 1024)}KB`;
|
|
44887
|
+
}
|
|
44888
|
+
function artifactInputName(input) {
|
|
44889
|
+
if (input.name) return basename4(input.name);
|
|
44890
|
+
if ("path" in input) return basename4(input.path) || "artifact";
|
|
44891
|
+
if ("url" in input) {
|
|
44892
|
+
try {
|
|
44893
|
+
return basename4(new URL(input.url).pathname) || "artifact";
|
|
44894
|
+
} catch {
|
|
44895
|
+
return "artifact";
|
|
44896
|
+
}
|
|
44897
|
+
}
|
|
44898
|
+
return "artifact";
|
|
44899
|
+
}
|
|
44486
44900
|
var SECRET_PATH3 = /(^|\/)(\.env(\.[\w-]+)*|\.npmrc|\.netrc|\.pgpass|id_(rsa|dsa|ecdsa|ed25519)|(credentials|secrets?)(\.[\w-]+)?)$|\.(pem|key|p12|pfx|keystore|jks)$/i;
|
|
44487
44901
|
var MIME_BY_EXTENSION = {
|
|
44488
44902
|
".avif": "image/avif",
|
|
@@ -44565,7 +44979,9 @@ async function localArtifact(input, options) {
|
|
|
44565
44979
|
if (!info.isFile()) throw new Error(`Artifact path is not a file: ${input.path}`);
|
|
44566
44980
|
if (info.size === 0) throw new Error(`Artifact is empty: ${input.path}`);
|
|
44567
44981
|
if (info.size > MAX_FILE_BYTES) {
|
|
44568
|
-
throw new
|
|
44982
|
+
throw new ArtifactLimitError(
|
|
44983
|
+
`${sizeLabel(info.size)}, over the ${MAX_FILE_BYTES / 1024 / 1024}MB per-file limit`
|
|
44984
|
+
);
|
|
44569
44985
|
}
|
|
44570
44986
|
return {
|
|
44571
44987
|
name: publicName(input.name || canonical2),
|
|
@@ -44697,7 +45113,9 @@ function mimeMatches(name, received) {
|
|
|
44697
45113
|
async function responseBytes(response) {
|
|
44698
45114
|
const length = Number(response.headers.get("content-length") || 0);
|
|
44699
45115
|
if (length > MAX_FILE_BYTES) {
|
|
44700
|
-
throw new
|
|
45116
|
+
throw new ArtifactLimitError(
|
|
45117
|
+
`${sizeLabel(length)}, over the ${MAX_FILE_BYTES / 1024 / 1024}MB per-file limit`
|
|
45118
|
+
);
|
|
44701
45119
|
}
|
|
44702
45120
|
if (!response.body) throw new Error("Artifact URL returned no file.");
|
|
44703
45121
|
const reader = response.body.getReader();
|
|
@@ -44709,7 +45127,9 @@ async function responseBytes(response) {
|
|
|
44709
45127
|
size += value.byteLength;
|
|
44710
45128
|
if (size > MAX_FILE_BYTES) {
|
|
44711
45129
|
await reader.cancel();
|
|
44712
|
-
throw new
|
|
45130
|
+
throw new ArtifactLimitError(
|
|
45131
|
+
`over the ${MAX_FILE_BYTES / 1024 / 1024}MB per-file limit`
|
|
45132
|
+
);
|
|
44713
45133
|
}
|
|
44714
45134
|
chunks.push(value);
|
|
44715
45135
|
}
|
|
@@ -44769,37 +45189,69 @@ function inlineBytes(input) {
|
|
|
44769
45189
|
return { name, bytes: Buffer.from(input.content, "utf8") };
|
|
44770
45190
|
}
|
|
44771
45191
|
async function materializeArtifacts(artifacts, options) {
|
|
44772
|
-
if (!artifacts?.length)
|
|
44773
|
-
|
|
44774
|
-
|
|
45192
|
+
if (!artifacts?.length) {
|
|
45193
|
+
return {
|
|
45194
|
+
artifacts: [],
|
|
45195
|
+
skipped: [],
|
|
45196
|
+
skippedTotal: 0
|
|
45197
|
+
};
|
|
44775
45198
|
}
|
|
44776
45199
|
const cwd = resolve4(
|
|
44777
45200
|
/*turbopackIgnore: true*/
|
|
44778
45201
|
options.cwd || process.cwd()
|
|
44779
45202
|
);
|
|
44780
45203
|
const stored = [];
|
|
45204
|
+
const skipped = [];
|
|
45205
|
+
let skippedTotal = 0;
|
|
44781
45206
|
let total = 0;
|
|
44782
|
-
|
|
44783
|
-
|
|
44784
|
-
|
|
44785
|
-
|
|
44786
|
-
|
|
44787
|
-
|
|
45207
|
+
const skip = (input, reason) => {
|
|
45208
|
+
skippedTotal += 1;
|
|
45209
|
+
if (skipped.length < MAX_SKIP_REPORT2) {
|
|
45210
|
+
skipped.push({ name: artifactInputName(input), reason });
|
|
45211
|
+
}
|
|
45212
|
+
};
|
|
45213
|
+
for (const [index, input] of artifacts.entries()) {
|
|
45214
|
+
if (index >= MAX_ARTIFACTS) {
|
|
45215
|
+
skip(input, `over the ${MAX_ARTIFACTS}-artifact handoff limit`);
|
|
45216
|
+
continue;
|
|
45217
|
+
}
|
|
45218
|
+
let artifact;
|
|
45219
|
+
try {
|
|
45220
|
+
artifact = "path" in input ? await localArtifact(input, {
|
|
45221
|
+
cwd,
|
|
45222
|
+
allowLocalPaths: options.allowLocalPaths,
|
|
45223
|
+
clientRoots: options.clientRoots
|
|
45224
|
+
}) : "url" in input ? await remoteArtifact(input) : inlineBytes(input);
|
|
45225
|
+
} catch (error2) {
|
|
45226
|
+
if (error2 instanceof ArtifactLimitError) {
|
|
45227
|
+
skip(input, error2.reason);
|
|
45228
|
+
continue;
|
|
45229
|
+
}
|
|
45230
|
+
throw error2;
|
|
45231
|
+
}
|
|
44788
45232
|
if (!artifact.bytes.length) throw new Error(`Artifact is empty: ${artifact.name}`);
|
|
44789
45233
|
if (artifact.bytes.length > MAX_FILE_BYTES) {
|
|
44790
|
-
|
|
45234
|
+
skip(
|
|
45235
|
+
input,
|
|
45236
|
+
`${sizeLabel(artifact.bytes.length)}, over the ${MAX_FILE_BYTES / 1024 / 1024}MB per-file limit`
|
|
45237
|
+
);
|
|
45238
|
+
continue;
|
|
44791
45239
|
}
|
|
44792
|
-
total
|
|
44793
|
-
|
|
44794
|
-
|
|
45240
|
+
if (total + artifact.bytes.length > MAX_TOTAL_BYTES) {
|
|
45241
|
+
skip(
|
|
45242
|
+
input,
|
|
45243
|
+
`${sizeLabel(artifact.bytes.length)}, over the remaining ${MAX_TOTAL_BYTES / 1024 / 1024}MB total handoff budget`
|
|
45244
|
+
);
|
|
45245
|
+
continue;
|
|
44795
45246
|
}
|
|
45247
|
+
total += artifact.bytes.length;
|
|
44796
45248
|
stored.push({
|
|
44797
45249
|
name: artifact.name,
|
|
44798
45250
|
content: artifact.bytes.toString("base64"),
|
|
44799
45251
|
encoding: "base64"
|
|
44800
45252
|
});
|
|
44801
45253
|
}
|
|
44802
|
-
return stored;
|
|
45254
|
+
return { artifacts: stored, skipped, skippedTotal };
|
|
44803
45255
|
}
|
|
44804
45256
|
function artifactMime(name) {
|
|
44805
45257
|
return expectedMime(name) || "application/octet-stream";
|
|
@@ -44979,7 +45431,7 @@ var skillDraftSchema = external_exports.object({
|
|
|
44979
45431
|
sessions: external_exports.number().optional().describe("Deprecated. Pantheon derives this count from cited evidence."),
|
|
44980
45432
|
evidence: external_exports.array(skillCitationSchema).optional().describe("Archived turns actually read with pantheon_get_turns.")
|
|
44981
45433
|
});
|
|
44982
|
-
var AUTO_SKILL_REVIEW = "Continue the review now. Read
|
|
45434
|
+
var AUTO_SKILL_REVIEW = "Continue the review now. Inspect recurringCorrections and reusableKnowledge first, including durable facts, algorithms that were applied, and explicit problem-and-solution evidence. Read every promising item's cited turns with pantheon_get_turns. A demonstrated reusable method can justify a skill even without a correction; temporary status facts belong in memory instead. Then inspect deterministic candidates, raw signals, and diagnostics, compare everything with existing skills and project documentation, and submit up to five justified lessons together with pantheon_save_skill_drafts. Do not ask permission: drafts are inert until promoted. Save none only after all evidence classes and diagnostics have been considered.";
|
|
44983
45435
|
function evidenceSessions(evidence) {
|
|
44984
45436
|
return evidence?.length ? new Set(evidence.map((item) => item.sessionId)).size : 1;
|
|
44985
45437
|
}
|
|
@@ -45309,7 +45761,7 @@ ${GUIDE}` }]
|
|
|
45309
45761
|
request.transcriptConversation
|
|
45310
45762
|
)
|
|
45311
45763
|
) : null;
|
|
45312
|
-
const
|
|
45764
|
+
const materialized = await materializeArtifacts(request.artifacts, {
|
|
45313
45765
|
cwd,
|
|
45314
45766
|
allowLocalPaths: allowCapture,
|
|
45315
45767
|
clientRoots
|
|
@@ -45323,7 +45775,9 @@ ${GUIDE}` }]
|
|
|
45323
45775
|
() => writeHandoff(home, {
|
|
45324
45776
|
...request,
|
|
45325
45777
|
cwd,
|
|
45326
|
-
artifacts,
|
|
45778
|
+
artifacts: materialized.artifacts,
|
|
45779
|
+
skippedArtifacts: materialized.skipped,
|
|
45780
|
+
skippedArtifactTotal: materialized.skippedTotal,
|
|
45327
45781
|
transcript: imported?.turns || (preflight.mode === "supplied" ? request.transcript : void 0),
|
|
45328
45782
|
transcriptImport: imported ? { sessionId: imported.sessionId, source: imported.source } : void 0,
|
|
45329
45783
|
source: imported?.source || request.source || (preflight.mode === "supplied" ? `${clientName || "agent"} supplied transcript` : captureClient.source),
|
|
@@ -45423,7 +45877,7 @@ ${GUIDE}` }]
|
|
|
45423
45877
|
},
|
|
45424
45878
|
async (input) => safe(async () => {
|
|
45425
45879
|
const request = input;
|
|
45426
|
-
const
|
|
45880
|
+
const materialized = await materializeArtifacts(request.artifacts, {
|
|
45427
45881
|
cwd: request.cwd,
|
|
45428
45882
|
allowLocalPaths: allowCapture,
|
|
45429
45883
|
clientRoots: request.artifacts?.some((item) => "path" in item) ? await clientFileRoots() : []
|
|
@@ -45432,9 +45886,20 @@ ${GUIDE}` }]
|
|
|
45432
45886
|
home,
|
|
45433
45887
|
vault,
|
|
45434
45888
|
(result) => `park ${result.slug}`,
|
|
45435
|
-
() => writePark(home, {
|
|
45889
|
+
() => writePark(home, {
|
|
45890
|
+
...request,
|
|
45891
|
+
artifacts: materialized.artifacts,
|
|
45892
|
+
skippedArtifacts: materialized.skipped,
|
|
45893
|
+
skippedArtifactTotal: materialized.skippedTotal
|
|
45894
|
+
})
|
|
45436
45895
|
);
|
|
45437
|
-
return {
|
|
45896
|
+
return {
|
|
45897
|
+
ok: sync2.ok !== false,
|
|
45898
|
+
...written,
|
|
45899
|
+
skipped: materialized.skipped,
|
|
45900
|
+
skippedTotal: materialized.skippedTotal,
|
|
45901
|
+
sync: sync2
|
|
45902
|
+
};
|
|
45438
45903
|
})
|
|
45439
45904
|
);
|
|
45440
45905
|
registerTool(
|
|
@@ -45660,7 +46125,7 @@ ${GUIDE}` }]
|
|
|
45660
46125
|
registerTool(
|
|
45661
46126
|
server,
|
|
45662
46127
|
"pantheon_skill_review",
|
|
45663
|
-
`Review a Pantheon space for lessons worth writing down as a skill. Trigger: /pantheon-skills <space>. Returns
|
|
46128
|
+
`Review a Pantheon space for lessons worth writing down as a skill. Trigger: /pantheon-skills <space>. Returns live and draft triggers; recurringCorrections; reusableKnowledge grouped into durable facts, algorithms, and solved problems; deterministic failure candidates; raw signals; and diagnostics. Read cited turns with pantheon_get_turns before deciding. A demonstrated reusable algorithm or solution can justify a skill without a correction. Durable trigger-scoped project facts may also qualify; temporary state belongs in memory instead. Judge the current conversation because some clients omit tool output. Then submit AT MOST ${MAX_REVIEW_DRAFTS} justified lessons together with pantheon_save_skill_drafts. Do not duplicate existing skills or guidance in AGENTS.md or the README. Drafts are inert until promoted. Report only saved names and what they teach; say "Nothing worth creating a skill for." only after reviewing every evidence class and diagnostics. No preamble.`,
|
|
45664
46129
|
{ space: external_exports.string(), cwd: external_exports.string().optional() },
|
|
45665
46130
|
async ({ space, cwd }) => safe(async () => {
|
|
45666
46131
|
await refreshForRead(home);
|
|
@@ -45931,7 +46396,7 @@ ${block2}`);
|
|
|
45931
46396
|
}
|
|
45932
46397
|
var spaceGate = 'A space is the short name the human chose for a conscience (preorders, auth-refactor). The argument is: $ARGUMENTS\n\nIf that arrived blank, or as an unexpanded placeholder rather than a name, ask: "What should this conscience be named?" and wait. Never invent a name. Otherwise use it exactly as typed \u2014 any single short slug counts, including one that is not in the vault yet.';
|
|
45933
46398
|
var quiet = 'Do not narrate. No preamble about which tools you can see, whether Pantheon MCP is connected, or what you are about to do. Run it and report what happened, briefly. If a call fails, say what failed in one line. If a write call ends with "Connection closed" or a timeout, do not say Pantheon is not connected and do not claim the write failed: Drive may still be uploading or may already have committed. Say the receipt was lost and the outcome is unconfirmed, tell the human to reload MCP, and repeat the same command safely; Pantheon deduplicates archived turns and files.';
|
|
45934
|
-
var autoSkillReview = "When a successful handoff adds new turns, immediately process its skillReview result. If that field is missing even though turns were added, call pantheon_skill_review for the same space. Read
|
|
46399
|
+
var autoSkillReview = "When a successful handoff adds new turns, immediately process its skillReview result. If that field is missing even though turns were added, call pantheon_skill_review for the same space. Inspect recurringCorrections and reusableKnowledge first: durable facts, algorithms that were applied, and explicit problem-and-solution evidence. Read every promising item's cited turns. A demonstrated reusable method can justify a skill without a correction; temporary status facts belong in memory instead. Then inspect deterministic candidates, raw signals, and diagnostics, compare everything with existing skills and project documentation, and submit at most five justified lessons together with pantheon_save_skill_drafts. Do not ask permission: drafts are inert until promoted. Save none only after considering every evidence class and diagnostics. Only report the handoff after this review and any saves are complete.";
|
|
45935
46400
|
var handoffToolDecides = "If pantheon_handoff is available, ALWAYS make the first call with the human's space while omitting transcript, transcriptFile, and transcriptFallback. This universal auto mode lets Pantheon attempt capture only through a verified adapter for the calling client. Never infer support from the platform yourself. If the response status is transcript_required, immediately retry with the same space and attachments, transcriptFallback:true, and every real user and assistant turn visible in your current context copied verbatim and in order. Set truncated:true if older turns are no longer visible. If status is capture_first_required, retry without transcript fields first. Never report these intermediate responses, send a recap, or ask the human to export, locate, or copy anything.";
|
|
45936
46401
|
var slashCommands = [
|
|
45937
46402
|
{
|
|
@@ -45977,15 +46442,15 @@ ${quiet}`
|
|
|
45977
46442
|
description: "Review a Pantheon space for lessons worth writing down",
|
|
45978
46443
|
body: `${spaceGate}
|
|
45979
46444
|
|
|
45980
|
-
Only then call pantheon_skill_review with that space, passing cwd when the project folder is not the server's working directory. If
|
|
46445
|
+
Only then call pantheon_skill_review with that space, passing cwd when the project folder is not the server's working directory. If unavailable, say only "Skill review unavailable. Reload Pantheon MCP." Inspect recurringCorrections and reusableKnowledge first. reusableKnowledge groups durable facts, algorithms, and explicit solved-problem evidence. Then inspect deterministic candidates, raw corrections, routines, and diagnostics. Read every promising item's cited turns with pantheon_get_turns before deciding.
|
|
45981
46446
|
|
|
45982
|
-
|
|
46447
|
+
A demonstrated reusable algorithm or solution can justify a skill even when nobody corrected the agent. Durable project facts may qualify when they produce trigger-scoped guidance; temporary status facts belong in memory instead. Judge THIS conversation too because many clients omit tool output.
|
|
45983
46448
|
|
|
45984
|
-
Save AT MOST FIVE
|
|
46449
|
+
Save AT MOST FIVE justified lessons. Compare each against live and draft triggers, coverage, AGENTS.md, and the README. Do not duplicate documented guidance or reject a product invariant merely because its evidence is inside one long conversation.
|
|
45985
46450
|
|
|
45986
|
-
Submit
|
|
46451
|
+
Submit justified lessons together with pantheon_save_skill_drafts without asking permission. Drafts remain inert until promoted. Cite exact turns. Only call pantheon_dismiss_skill when the human explicitly rejects a deterministic candidate.
|
|
45987
46452
|
|
|
45988
|
-
Report
|
|
46453
|
+
Report saved names and what each teaches. Say "Nothing worth creating a skill for." only after every evidence class and diagnostics have been considered.
|
|
45989
46454
|
|
|
45990
46455
|
${quiet}`
|
|
45991
46456
|
},
|
package/package.json
CHANGED