@jwilger/pi-development-system 0.80.0 → 0.81.0
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/package.json
CHANGED
package/src/context/cadence.ts
CHANGED
|
@@ -19,6 +19,9 @@ export function cadenceLine(
|
|
|
19
19
|
if (!Number.isFinite(pushed)) return undefined;
|
|
20
20
|
const minutes = Math.floor((now - pushed) / 60_000);
|
|
21
21
|
if (minutes <= pushMinutes) return undefined;
|
|
22
|
-
const bucket = Math.
|
|
22
|
+
const bucket = Math.max(
|
|
23
|
+
pushMinutes,
|
|
24
|
+
Math.floor(minutes / CADENCE_BUCKET_MINUTES) * CADENCE_BUCKET_MINUTES,
|
|
25
|
+
);
|
|
23
26
|
return `⚠ over ${bucket} min since last push — is this increment too big?`;
|
|
24
27
|
}
|
package/src/jev/judge-tools.ts
CHANGED
|
@@ -15,7 +15,7 @@ const JUDGE_NAMESPACE = {
|
|
|
15
15
|
description:
|
|
16
16
|
"Jev judgements as data: probabilities and labels a script can branch on (sizing, test-change, lenses, task readiness).",
|
|
17
17
|
instructions:
|
|
18
|
-
|
|
18
|
+
'Each tool returns JSON text: the judgement. When Jev is unavailable the call rejects with a message holding {"error": …}, so wrap calls in try/catch or Promise.allSettled. Inputs are redacted and clipped before they reach Jev. Use these inside codemode scripts; they change no state.',
|
|
19
19
|
} as const;
|
|
20
20
|
|
|
21
21
|
type Deps = { jev: (ctx: ExtensionContext) => Jev };
|
|
@@ -24,6 +24,7 @@ export const INTENT_QUESTION: ClassifierChoiceQuestion = {
|
|
|
24
24
|
|
|
25
25
|
const PROMPT_MAX = 1500;
|
|
26
26
|
const SKILL_END = "</skill>";
|
|
27
|
+
const GAP = "\n…\n";
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Pi expands `/skill:name args` into `<skill …>body</skill>\n\nargs`; the body is the skill's own
|
|
@@ -35,8 +36,8 @@ export function requestText(prompt: string): string {
|
|
|
35
36
|
const end = trimmed.startsWith("<skill ") ? trimmed.indexOf(SKILL_END) : -1;
|
|
36
37
|
const text = (end === -1 ? trimmed : trimmed.slice(end + SKILL_END.length)).trim();
|
|
37
38
|
if (text.length <= PROMPT_MAX) return text;
|
|
38
|
-
const half = Math.floor(PROMPT_MAX / 2);
|
|
39
|
-
return `${text.slice(0, half)}
|
|
39
|
+
const half = Math.floor((PROMPT_MAX - GAP.length) / 2);
|
|
40
|
+
return `${text.slice(0, half)}${GAP}${text.slice(-half)}`;
|
|
40
41
|
}
|
|
41
42
|
const isIntent = (value: string): value is Intent => INTENTS.some((i) => i === value);
|
|
42
43
|
|
|
@@ -44,7 +45,7 @@ export async function judgeIntent(
|
|
|
44
45
|
jev: Jev,
|
|
45
46
|
input: { prompt: string; phase: string },
|
|
46
47
|
): Promise<Result<{ intent: Intent; confidence: number }, JevError>> {
|
|
47
|
-
const prompt = redactSecrets(
|
|
48
|
+
const prompt = requestText(redactSecrets(input.prompt));
|
|
48
49
|
const asked = await jev.ask({ prompt, phase: input.phase }, { intent: INTENT_QUESTION });
|
|
49
50
|
if (!asked.ok) return asked;
|
|
50
51
|
const answer = asked.value.intent;
|