@juicesharp/rpiv-args 2.9.0 → 2.10.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/args.ts +11 -11
- package/package.json +1 -1
package/args.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* rpiv-args — core logic.
|
|
3
3
|
*
|
|
4
4
|
* Intercepts `/skill:<name> <args>` at the input hook and emits a Pi skill
|
|
5
|
-
* wrapper. Pipeline
|
|
5
|
+
* wrapper. Pipeline:
|
|
6
6
|
* strip frontmatter → $N/$ARGUMENTS substitution (opt-in via TOKEN_REGEX)
|
|
7
|
-
* → ${SKILL_DIR}/${SESSION_ID} substitution (always-on
|
|
8
|
-
* → shell execution (always-on
|
|
7
|
+
* → ${SKILL_DIR}/${SESSION_ID} substitution (always-on)
|
|
8
|
+
* → shell execution (always-on — see executeShellInBody)
|
|
9
9
|
* → wrap in <skill name=… location=…>…</skill> block
|
|
10
10
|
*
|
|
11
|
-
* Emit-path divergence
|
|
11
|
+
* Emit-path divergence: the trailing-args policy is governed by
|
|
12
12
|
* ORIGINAL token presence (`hadTokens`). The no-token path emits
|
|
13
13
|
* byte-identical to Pi's built-in `_expandSkillCommand` (`\n\n${args}`);
|
|
14
14
|
* the token path emits the raw args in a `Skill input:`-labeled trailer
|
|
@@ -174,11 +174,11 @@ export function substituteVariables(body: string, vars: { skillDir: string; sess
|
|
|
174
174
|
// Number.isFinite is load-bearing — both NaN and Infinity must be rejected:
|
|
175
175
|
// - NaN → would silently bypass exec.js:42's `&& options.timeout > 0`
|
|
176
176
|
// short-circuit (NaN > 0 is false) and disable the timer, hiding
|
|
177
|
-
//
|
|
177
|
+
// the configured timeout.
|
|
178
178
|
// - Infinity → Node's setTimeout(fn, Infinity) clamps to 1ms → an immediate
|
|
179
179
|
// kill (the opposite of "no timeout").
|
|
180
180
|
//
|
|
181
|
-
// `0` is honored as explicit disable
|
|
181
|
+
// `0` is honored as explicit disable.
|
|
182
182
|
// ---------------------------------------------------------------------------
|
|
183
183
|
|
|
184
184
|
export function resolveShellTimeoutMs(frontmatter: { "shell-timeout"?: unknown }): number {
|
|
@@ -198,7 +198,7 @@ export function resolveShellTimeoutMs(frontmatter: { "shell-timeout"?: unknown }
|
|
|
198
198
|
// inside the fence; running inline first would eat backticks from block
|
|
199
199
|
// content and produce malformed bodies.
|
|
200
200
|
//
|
|
201
|
-
// Sequential iteration
|
|
201
|
+
// Sequential iteration — never Promise.all. Skill authors rely on
|
|
202
202
|
// `!`mkdir x`` → `!`ls x`` ordering. The git-context.ts:36-44 Promise.all
|
|
203
203
|
// precedent for parallel read-only git commands is INTENTIONALLY not copied.
|
|
204
204
|
//
|
|
@@ -209,7 +209,7 @@ export function resolveShellTimeoutMs(frontmatter: { "shell-timeout"?: unknown }
|
|
|
209
209
|
// `pi.exec` NEVER rejects (dist/core/exec.js:10-72 — every termination path
|
|
210
210
|
// calls resolve(...)). No try/catch needed here.
|
|
211
211
|
//
|
|
212
|
-
//
|
|
212
|
+
// Branch order: killed → code !== 0 → success. `killed` is checked first
|
|
213
213
|
// because a timed-out child may also report a non-zero code via `code ?? 0`
|
|
214
214
|
// (exec.js:60) or `1` via the catch (exec.js:71); the timeout message wins.
|
|
215
215
|
// ---------------------------------------------------------------------------
|
|
@@ -218,7 +218,7 @@ export function resolveShellTimeoutMs(frontmatter: { "shell-timeout"?: unknown }
|
|
|
218
218
|
* with a `[truncated: hit ...]` footer when truncation occurred. Shared
|
|
219
219
|
* by the success path (`formatShellOutput`) and the non-zero exit path
|
|
220
220
|
* in `runOneShellCommand` so a multi-MB stderr from a failed `!`npm test``
|
|
221
|
-
* cannot bypass
|
|
221
|
+
* cannot bypass the truncation budget. */
|
|
222
222
|
function truncateForLLM(content: string): string {
|
|
223
223
|
const trunc: TruncationResult = truncateTail(content, {
|
|
224
224
|
maxLines: DEFAULT_MAX_LINES,
|
|
@@ -429,8 +429,8 @@ export async function handleInput(
|
|
|
429
429
|
const body = stripFrontmatter(content).trim();
|
|
430
430
|
const timeoutMs = resolveShellTimeoutMs(frontmatter);
|
|
431
431
|
|
|
432
|
-
//
|
|
433
|
-
// suffix) is governed by ORIGINAL token presence only.
|
|
432
|
+
// Emit-path divergence (token-path drops the trailing `\n\n${args}`
|
|
433
|
+
// suffix) is governed by ORIGINAL token presence only. Variable
|
|
434
434
|
// substitution and shell execution run on BOTH paths regardless.
|
|
435
435
|
const hadTokens = TOKEN_REGEX.test(body);
|
|
436
436
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-args",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "Pi extension. Shell-style $1 / $ARGUMENTS placeholders and !`cmd` / ```! shell substitution, expanded into your Pi skills at invocation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|