snipara-companion 2.0.4 → 2.0.5
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/index.d.ts +15 -1
- package/dist/index.js +56 -13
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -565,7 +565,21 @@ interface RecordAdvisorInfluenceReceiptInput {
|
|
|
565
565
|
behaviorChange: string;
|
|
566
566
|
verificationExecuted: string[];
|
|
567
567
|
outcomeLinkStatus?: AdvisorInfluenceOutcomeLinkStatus;
|
|
568
|
-
metadata?:
|
|
568
|
+
metadata?: AdvisorInfluenceReceiptMetadataInput;
|
|
569
|
+
}
|
|
570
|
+
interface AdvisorInfluenceReceiptMetadataInput extends Record<string, unknown> {
|
|
571
|
+
source?: string;
|
|
572
|
+
firstParty?: boolean;
|
|
573
|
+
planBefore?: string | null;
|
|
574
|
+
planAfter?: string | null;
|
|
575
|
+
changedBecauseOfRecommendation?: boolean | null;
|
|
576
|
+
filesAffected?: string[];
|
|
577
|
+
toolActions?: string[];
|
|
578
|
+
humanOverride?: string | null;
|
|
579
|
+
task?: string | null;
|
|
580
|
+
branch?: string | null;
|
|
581
|
+
runId?: string | null;
|
|
582
|
+
generatedAt?: string | null;
|
|
569
583
|
}
|
|
570
584
|
interface RecordAdvisorInfluenceReceiptResult {
|
|
571
585
|
project: {
|
package/dist/index.js
CHANGED
|
@@ -12046,6 +12046,50 @@ function advisorReceiptBehaviorChange(recommendation, judgmentCard) {
|
|
|
12046
12046
|
`Judgment state after adaptation: ${judgmentCard.state}.`
|
|
12047
12047
|
].filter(Boolean).join(" ");
|
|
12048
12048
|
}
|
|
12049
|
+
function advisorReceiptPlanBefore(options) {
|
|
12050
|
+
return options.task ?? options.diffSummary ?? (options.changedFiles && options.changedFiles.length > 0 ? `Work on ${options.changedFiles.slice(0, 8).join(", ")}` : null);
|
|
12051
|
+
}
|
|
12052
|
+
function advisorReceiptPlanAfter(args) {
|
|
12053
|
+
const requiredActions = args.judgmentCard.requiredActions.slice(0, 5).map((action) => action.command ?? action.title).filter(Boolean);
|
|
12054
|
+
return [
|
|
12055
|
+
args.behaviorChange,
|
|
12056
|
+
requiredActions.length > 0 ? `Visible plan now includes required action(s): ${requiredActions.join("; ")}.` : null,
|
|
12057
|
+
args.recommendation.recommendedVerification.length > 0 ? `Recommended verification stays open: ${args.recommendation.recommendedVerification.slice(0, 5).join("; ")}.` : null
|
|
12058
|
+
].filter(Boolean).join(" ");
|
|
12059
|
+
}
|
|
12060
|
+
function advisorReceiptMetadata(args) {
|
|
12061
|
+
const toolActions = normalizeStringList2([
|
|
12062
|
+
...args.recommendation.recommendedVerification,
|
|
12063
|
+
...args.judgmentCard.requiredActions.map((action) => action.command ?? action.title)
|
|
12064
|
+
]).slice(0, 20);
|
|
12065
|
+
const filesAffected = normalizeStringList2([
|
|
12066
|
+
...args.brief.changedFiles ?? [],
|
|
12067
|
+
...args.options.changedFiles ?? []
|
|
12068
|
+
]).slice(0, 80);
|
|
12069
|
+
return {
|
|
12070
|
+
source: "snipara-companion:run",
|
|
12071
|
+
firstParty: true,
|
|
12072
|
+
runVersion: "project-intelligence.production-run.v1",
|
|
12073
|
+
runId: process.env.SNIPARA_SESSION_ID ?? process.env.CODEX_SESSION_ID ?? null,
|
|
12074
|
+
generatedAt: args.judgmentCard.generatedAt,
|
|
12075
|
+
release: Boolean(args.options.release),
|
|
12076
|
+
task: args.brief.task ?? args.options.task ?? null,
|
|
12077
|
+
branch: args.brief.branch ?? args.options.branch ?? null,
|
|
12078
|
+
filesAffected,
|
|
12079
|
+
changedFiles: filesAffected,
|
|
12080
|
+
planBefore: advisorReceiptPlanBefore(args.options),
|
|
12081
|
+
planAfter: advisorReceiptPlanAfter({
|
|
12082
|
+
recommendation: args.recommendation,
|
|
12083
|
+
behaviorChange: args.behaviorChange,
|
|
12084
|
+
judgmentCard: args.judgmentCard
|
|
12085
|
+
}),
|
|
12086
|
+
changedBecauseOfRecommendation: args.agentDecision !== "ignored",
|
|
12087
|
+
toolActions,
|
|
12088
|
+
humanOverride: null,
|
|
12089
|
+
judgmentState: args.judgmentCard.state,
|
|
12090
|
+
canProceed: args.judgmentCard.canProceed
|
|
12091
|
+
};
|
|
12092
|
+
}
|
|
12049
12093
|
async function recordFirstPartyAdvisorReceipts(args) {
|
|
12050
12094
|
if (args.options.skipAdvisorReceipts) {
|
|
12051
12095
|
return {
|
|
@@ -12074,24 +12118,23 @@ async function recordFirstPartyAdvisorReceipts(args) {
|
|
|
12074
12118
|
const writes = await Promise.all(
|
|
12075
12119
|
recommendations.map(async (recommendation) => {
|
|
12076
12120
|
try {
|
|
12121
|
+
const agentDecision = advisorReceiptDecision(recommendation, args.judgmentCard);
|
|
12122
|
+
const behaviorChange = advisorReceiptBehaviorChange(recommendation, args.judgmentCard);
|
|
12077
12123
|
const result = await client.recordAdvisorInfluenceReceipt({
|
|
12078
12124
|
servedJudgmentId,
|
|
12079
12125
|
recommendation: advisorReceiptRecommendation(recommendation),
|
|
12080
|
-
agentDecision
|
|
12081
|
-
behaviorChange
|
|
12126
|
+
agentDecision,
|
|
12127
|
+
behaviorChange,
|
|
12082
12128
|
verificationExecuted: [],
|
|
12083
12129
|
outcomeLinkStatus: "pending",
|
|
12084
|
-
metadata: {
|
|
12085
|
-
|
|
12086
|
-
|
|
12087
|
-
|
|
12088
|
-
|
|
12089
|
-
|
|
12090
|
-
|
|
12091
|
-
|
|
12092
|
-
judgmentState: args.judgmentCard.state,
|
|
12093
|
-
canProceed: args.judgmentCard.canProceed
|
|
12094
|
-
}
|
|
12130
|
+
metadata: advisorReceiptMetadata({
|
|
12131
|
+
options: args.options,
|
|
12132
|
+
brief: args.brief,
|
|
12133
|
+
judgmentCard: args.judgmentCard,
|
|
12134
|
+
recommendation,
|
|
12135
|
+
agentDecision,
|
|
12136
|
+
behaviorChange
|
|
12137
|
+
})
|
|
12095
12138
|
});
|
|
12096
12139
|
return {
|
|
12097
12140
|
advisorRecommendationId: recommendation.id,
|
package/package.json
CHANGED