pi-agent-flow 2.0.0 → 2.0.2
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/README.md +126 -489
- package/agents/audit.md +7 -2
- package/agents/build.md +6 -2
- package/agents/craft.md +6 -3
- package/agents/debug.md +7 -3
- package/agents/ideas.md +8 -4
- package/agents/scout.md +8 -1
- package/dist/batch/apply-patch.d.ts +60 -0
- package/dist/batch/apply-patch.d.ts.map +1 -0
- package/dist/batch/apply-patch.js +477 -0
- package/dist/batch/apply-patch.js.map +1 -0
- package/dist/batch/batch-bash.d.ts +0 -6
- package/dist/batch/batch-bash.d.ts.map +1 -1
- package/dist/batch/batch-bash.js +52 -14
- package/dist/batch/batch-bash.js.map +1 -1
- package/dist/batch/constants.d.ts +45 -4
- package/dist/batch/constants.d.ts.map +1 -1
- package/dist/batch/constants.js +72 -4
- package/dist/batch/constants.js.map +1 -1
- package/dist/batch/execute.d.ts +8 -2
- package/dist/batch/execute.d.ts.map +1 -1
- package/dist/batch/execute.js +338 -70
- package/dist/batch/execute.js.map +1 -1
- package/dist/batch/fuzzy-edit.d.ts +4 -1
- package/dist/batch/fuzzy-edit.d.ts.map +1 -1
- package/dist/batch/fuzzy-edit.js +7 -2
- package/dist/batch/fuzzy-edit.js.map +1 -1
- package/dist/batch/index.d.ts +3 -15
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/batch/index.js +48 -78
- package/dist/batch/index.js.map +1 -1
- package/dist/batch/render.d.ts.map +1 -1
- package/dist/batch/render.js +30 -7
- package/dist/batch/render.js.map +1 -1
- package/dist/batch/shell-compress.d.ts +25 -0
- package/dist/batch/shell-compress.d.ts.map +1 -0
- package/dist/batch/shell-compress.js +602 -0
- package/dist/batch/shell-compress.js.map +1 -0
- package/dist/batch/summary.d.ts.map +1 -1
- package/dist/batch/summary.js +4 -0
- package/dist/batch/summary.js.map +1 -1
- package/dist/batch/symbols.d.ts.map +1 -1
- package/dist/batch/symbols.js +12 -7
- package/dist/batch/symbols.js.map +1 -1
- package/dist/config/config.d.ts +5 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +63 -0
- package/dist/config/config.js.map +1 -1
- package/dist/config/models.d.ts +2 -0
- package/dist/config/models.d.ts.map +1 -0
- package/dist/config/models.js +49 -0
- package/dist/config/models.js.map +1 -0
- package/dist/config/settings-resolver.js +2 -2
- package/dist/config/settings-resolver.js.map +1 -1
- package/dist/core/agents.js +2 -2
- package/dist/core/agents.js.map +1 -1
- package/dist/core/depth.d.ts +3 -3
- package/dist/core/depth.d.ts.map +1 -1
- package/dist/core/depth.js +5 -5
- package/dist/core/depth.js.map +1 -1
- package/dist/core/executor.d.ts +10 -3
- package/dist/core/executor.d.ts.map +1 -1
- package/dist/core/executor.js +7 -3
- package/dist/core/executor.js.map +1 -1
- package/dist/core/flow.d.ts +19 -3
- package/dist/core/flow.d.ts.map +1 -1
- package/dist/core/flow.js +97 -58
- package/dist/core/flow.js.map +1 -1
- package/dist/core/session-mode.d.ts +1 -1
- package/dist/core/session-mode.d.ts.map +1 -1
- package/dist/core/session-mode.js +2 -1
- package/dist/core/session-mode.js.map +1 -1
- package/dist/core/{delegation.d.ts → transition.d.ts} +9 -9
- package/dist/core/transition.d.ts.map +1 -0
- package/dist/core/{delegation.js → transition.js} +17 -24
- package/dist/core/transition.js.map +1 -0
- package/dist/flow/auto-warp.d.ts +12 -0
- package/dist/flow/auto-warp.d.ts.map +1 -0
- package/dist/flow/auto-warp.js +29 -0
- package/dist/flow/auto-warp.js.map +1 -0
- package/dist/flow/command.d.ts.map +1 -1
- package/dist/flow/command.js +7 -2
- package/dist/flow/command.js.map +1 -1
- package/dist/flow/continuation.d.ts.map +1 -1
- package/dist/flow/continuation.js +52 -15
- package/dist/flow/continuation.js.map +1 -1
- package/dist/flow/index.d.ts +5 -2
- package/dist/flow/index.d.ts.map +1 -1
- package/dist/flow/index.js +6 -3
- package/dist/flow/index.js.map +1 -1
- package/dist/flow/loop-command.d.ts +8 -0
- package/dist/flow/loop-command.d.ts.map +1 -0
- package/dist/flow/loop-command.js +102 -0
- package/dist/flow/loop-command.js.map +1 -0
- package/dist/flow/loop-templates.d.ts +7 -0
- package/dist/flow/loop-templates.d.ts.map +1 -0
- package/dist/flow/loop-templates.js +38 -0
- package/dist/flow/loop-templates.js.map +1 -0
- package/dist/flow/loop.d.ts +19 -0
- package/dist/flow/loop.d.ts.map +1 -0
- package/dist/flow/loop.js +95 -0
- package/dist/flow/loop.js.map +1 -0
- package/dist/flow/settings-command.d.ts.map +1 -1
- package/dist/flow/settings-command.js +93 -4
- package/dist/flow/settings-command.js.map +1 -1
- package/dist/flow/store.d.ts +3 -3
- package/dist/flow/store.d.ts.map +1 -1
- package/dist/flow/store.js +24 -16
- package/dist/flow/store.js.map +1 -1
- package/dist/flow/template-shared.d.ts +9 -0
- package/dist/flow/template-shared.d.ts.map +1 -0
- package/dist/flow/template-shared.js +13 -0
- package/dist/flow/template-shared.js.map +1 -0
- package/dist/flow/template-strings.d.ts.map +1 -1
- package/dist/flow/template-strings.js +2 -5
- package/dist/flow/template-strings.js.map +1 -1
- package/dist/flow/types.d.ts +15 -9
- package/dist/flow/types.d.ts.map +1 -1
- package/dist/flow/warp.d.ts +15 -0
- package/dist/flow/warp.d.ts.map +1 -0
- package/dist/flow/warp.js +207 -0
- package/dist/flow/warp.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +185 -28
- package/dist/index.js.map +1 -1
- package/dist/snapshot/cli-args.d.ts +1 -0
- package/dist/snapshot/cli-args.d.ts.map +1 -1
- package/dist/snapshot/cli-args.js +12 -0
- package/dist/snapshot/cli-args.js.map +1 -1
- package/dist/snapshot/runner-events.d.ts +5 -0
- package/dist/snapshot/runner-events.d.ts.map +1 -1
- package/dist/snapshot/runner-events.js +89 -15
- package/dist/snapshot/runner-events.js.map +1 -1
- package/dist/snapshot/snapshot.d.ts +22 -19
- package/dist/snapshot/snapshot.d.ts.map +1 -1
- package/dist/snapshot/snapshot.js +1063 -167
- package/dist/snapshot/snapshot.js.map +1 -1
- package/dist/steering/flow-prompt.d.ts +2 -2
- package/dist/steering/flow-prompt.d.ts.map +1 -1
- package/dist/steering/flow-prompt.js +4 -4
- package/dist/steering/flow-prompt.js.map +1 -1
- package/dist/steering/sliding-prompt.d.ts.map +1 -1
- package/dist/steering/sliding-prompt.js +9 -6
- package/dist/steering/sliding-prompt.js.map +1 -1
- package/dist/steering/tool-utils.d.ts +31 -8
- package/dist/steering/tool-utils.d.ts.map +1 -1
- package/dist/steering/tool-utils.js +63 -30
- package/dist/steering/tool-utils.js.map +1 -1
- package/dist/tools/ask-user.d.ts +0 -17
- package/dist/tools/ask-user.d.ts.map +1 -1
- package/dist/tools/ask-user.js +13 -37
- package/dist/tools/ask-user.js.map +1 -1
- package/dist/tools/timed-bash.d.ts +1 -1
- package/dist/tools/timed-bash.d.ts.map +1 -1
- package/dist/tools/timed-bash.js +19 -8
- package/dist/tools/timed-bash.js.map +1 -1
- package/dist/tools/web-tool.d.ts.map +1 -1
- package/dist/tools/web-tool.js +11 -13
- package/dist/tools/web-tool.js.map +1 -1
- package/dist/tui/render-utils.d.ts +5 -1
- package/dist/tui/render-utils.d.ts.map +1 -1
- package/dist/tui/render-utils.js +36 -10
- package/dist/tui/render-utils.js.map +1 -1
- package/dist/tui/render.d.ts +9 -0
- package/dist/tui/render.d.ts.map +1 -1
- package/dist/tui/render.js +112 -100
- package/dist/tui/render.js.map +1 -1
- package/dist/tui/scramble/constants.d.ts +8 -8
- package/dist/tui/scramble/constants.d.ts.map +1 -1
- package/dist/tui/scramble/constants.js +7 -7
- package/dist/tui/scramble/constants.js.map +1 -1
- package/dist/tui/scramble/index.d.ts +1 -1
- package/dist/tui/scramble/index.d.ts.map +1 -1
- package/dist/tui/scramble/index.js +1 -1
- package/dist/tui/scramble/index.js.map +1 -1
- package/dist/tui/scramble/manager.d.ts +1 -5
- package/dist/tui/scramble/manager.d.ts.map +1 -1
- package/dist/tui/scramble/manager.js +16 -64
- package/dist/tui/scramble/manager.js.map +1 -1
- package/dist/tui/scramble/utils.js +1 -1
- package/dist/tui/scramble/utils.js.map +1 -1
- package/dist/types/flow.d.ts +2 -0
- package/dist/types/flow.d.ts.map +1 -1
- package/dist/types/flow.js +11 -2
- package/dist/types/flow.js.map +1 -1
- package/dist/types/output.d.ts +6 -0
- package/dist/types/output.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/core/delegation.d.ts.map +0 -1
- package/dist/core/delegation.js.map +0 -1
- package/dist/flow/warp-command.d.ts +0 -9
- package/dist/flow/warp-command.d.ts.map +0 -1
- package/dist/flow/warp-command.js +0 -405
- package/dist/flow/warp-command.js.map +0 -1
package/agents/audit.md
CHANGED
|
@@ -11,16 +11,21 @@ mission: During this audit flow your mission is to verify and remediate quality
|
|
|
11
11
|
workflow:
|
|
12
12
|
1 Scope: identify the files behavior or change set to audit
|
|
13
13
|
2 Inspect: review security correctness maintainability and performance risks use batch with o read s offset l limit for targeted file reading instead of bash sed head tail
|
|
14
|
-
3 Classify: assign severity and explain the impact of each issue found
|
|
14
|
+
3 Classify: assign severity and explain the impact of each issue found use P0 critical immediate action P1 serious fix soon P2 moderate schedule fix P3 minor note and track
|
|
15
15
|
4 Fix: apply safe localized fixes directly with available tools
|
|
16
16
|
5 Verify: run relevant tests or checks after fixes when practical
|
|
17
|
-
6 Report: distinguish fixed issues from remaining risks
|
|
17
|
+
6 Report: distinguish fixed issues from remaining risks give overall verdict CLEAN CAUTION or AT_RISK with confidence 0.0-1.0
|
|
18
18
|
|
|
19
19
|
rules:
|
|
20
|
+
A real issue causes data loss exposes secrets crashes produces wrong results violates contracts regresses perf >20% blocks CI or introduces a race style-only without behavioral impact is not an issue
|
|
20
21
|
Be specific cite exact file paths and line numbers
|
|
21
22
|
If code is clean say so do not invent issues
|
|
22
23
|
Fix issues autonomously when the fix is safe and localized
|
|
23
24
|
Do not apply risky rewrites or broad redesigns from audit flag them with severity instead
|
|
25
|
+
Enumerate exhaustively before judging completeness do not stop at the first few issues
|
|
24
26
|
If a fix requires broader redesign recommend craft in next steps
|
|
25
27
|
If root cause is unclear recommend debug rather than guessing
|
|
28
|
+
Markers: Prefix substantive claims with [V] verified, [I] inferred, [A] assumed, or [U] unknown.
|
|
29
|
+
Bite-first: Output raw evidence (code, paths, logs) before any prose explanation.
|
|
30
|
+
No preamble: Start immediately with evidence or action. Skip all conversational filler.
|
|
26
31
|
See _conventions for tmp scripts and batch reads
|
package/agents/build.md
CHANGED
|
@@ -12,9 +12,9 @@ workflow:
|
|
|
12
12
|
1 Analyze: read existing code for context
|
|
13
13
|
2 Plan: outline approach before modifying
|
|
14
14
|
3 Test: write or identify a failing test when practical
|
|
15
|
-
4 Execute: implement changes following core principles
|
|
15
|
+
4 Execute: implement changes following core principles size gate 800 lines or 500 complex lines per stage if exceeded split or recommend craft guard breaking changes with explicit migration note
|
|
16
16
|
5 Verify: run tests and checks refactor only if working
|
|
17
|
-
6 Ship:
|
|
17
|
+
6 Ship: self-review changes and rate confidence 0.0-1.0 before committing push monitor CI fix failures until green
|
|
18
18
|
7 Cleanup: delete old branch local and remote if requested otherwise leave the branch for the user to merge
|
|
19
19
|
|
|
20
20
|
rules:
|
|
@@ -24,5 +24,9 @@ Commit with conventional messages feat fix refactor
|
|
|
24
24
|
Do not merge to main unless the user explicitly requests it
|
|
25
25
|
If merging use squash merge
|
|
26
26
|
Update relevant docs if none changed, state why
|
|
27
|
+
Prefer integration tests for coverage over unit tests alone when behavior crosses module boundaries
|
|
27
28
|
Unexpected errors recommend debug do not guess
|
|
29
|
+
Markers: Prefix substantive claims with [V] verified, [I] inferred, [A] assumed, or [U] unknown.
|
|
30
|
+
Bite-first: Output raw evidence (code, paths, logs) before any prose explanation.
|
|
31
|
+
No preamble: Start immediately with evidence or action. Skip all conversational filler.
|
|
28
32
|
See _conventions for tmp scripts and batch reads
|
package/agents/craft.md
CHANGED
|
@@ -10,10 +10,10 @@ mission: During this craft flow your mission is to design a clear well structure
|
|
|
10
10
|
|
|
11
11
|
workflow:
|
|
12
12
|
1 Understand: define the problem constraints existing behavior and success criteria
|
|
13
|
-
2 Explore: map relevant patterns dependencies and existing architecture use batch with o read s offset l limit for targeted file reading instead of bash sed head tail
|
|
13
|
+
2 Explore: map relevant patterns dependencies and existing architecture use batch with o read s offset l limit for targeted file reading instead of bash sed head tail enumerate exhaustively
|
|
14
14
|
3 Evaluate: assess whether the change fits existing patterns or requires a clean migration prefer incremental improvement when safe endorse full cut redesign when the architecture demands it
|
|
15
|
-
4 Design: produce a concrete plan with ordered tasks data flow module boundaries and interface contracts
|
|
16
|
-
5 Review: check risks edge cases test strategy migration path and
|
|
15
|
+
4 Design: produce a concrete plan with ordered tasks data flow module boundaries and interface contracts tag priorities P0-P3 cap each stage at 800 lines or 500 complex design bounded context buffers for large reads
|
|
16
|
+
5 Review: check risks edge cases test strategy migration path and transfer to build include breaking-changes checklist require integration tests and give architecture soundness verdict
|
|
17
17
|
|
|
18
18
|
rules:
|
|
19
19
|
Follow SOLID (Single Responsibility Open Closed Liskov Substitution Interface Segregation Dependency Inversion) DRY (Do Not Repeat Yourself) KISS (Keep It Simple Stupid)
|
|
@@ -23,4 +23,7 @@ When redesigning preserve data integrity and migration paths never orphan existi
|
|
|
23
23
|
Favor clean migration if a redesign is warranted cut fully rather than leaving half measures
|
|
24
24
|
Document trade offs explicitly when the optimal path is unclear
|
|
25
25
|
Do not implement changes from this flow unless explicitly requested
|
|
26
|
+
Markers: Prefix substantive claims with [V] verified, [I] inferred, [A] assumed, or [U] unknown.
|
|
27
|
+
Bite-first: Output raw evidence (code, paths, logs) before any prose explanation.
|
|
28
|
+
No preamble: Start immediately with evidence or action. Skip all conversational filler.
|
|
26
29
|
See _conventions for tmp scripts and batch reads
|
package/agents/debug.md
CHANGED
|
@@ -13,15 +13,19 @@ workflow:
|
|
|
13
13
|
2 Hypothesize: list three to five concrete causes subsystem branch timing data shape each must be falsifiable
|
|
14
14
|
3 Instrument: add minimal temporary logs or probes so one run can support or reject several hypotheses in parallel tag each log with hypothesisId prefer existing test hooks or stderr over noisy prints
|
|
15
15
|
4 Run once: clear prior logs if applicable reproduce read the evidence before editing logic
|
|
16
|
-
5 Conclude: for each hypothesis state CONFIRMED REJECTED or INCONCLUSIVE with
|
|
17
|
-
6 Fix: only after a hypothesis is confirmed by evidence no speculative guards revert any change tied to a rejected hypothesis
|
|
16
|
+
5 Conclude: for each hypothesis state CONFIRMED REJECTED or INCONCLUSIVE with confidence HIGH 0.8-1.0 MEDIUM 0.5-0.8 or LOW <0.5 and cite lines log stack trace assertion
|
|
17
|
+
6 Fix: only after a hypothesis is confirmed by evidence no speculative guards revert any change tied to a rejected hypothesis if fix exceeds 50 lines recommend craft instead of a broad patch
|
|
18
18
|
7 Verify: same repro plus tests compare before and after evidence no sleep or polling hacks as fixes unless the product contract truly requires delay
|
|
19
|
-
8 Finalize: remove temporary instrumentation after verification or when
|
|
19
|
+
8 Finalize: remove temporary instrumentation after verification or when root state confirms if applicable update relevant docs, runbooks, or troubleshooting notes after finishing Documentation-only updates are required after finishing the work give overall verdict FIXED CONFIRMED INCONCLUSIVE or CANNOT_REPRODUCE with confidence 0.0-1.0
|
|
20
20
|
|
|
21
21
|
rules:
|
|
22
22
|
Evidence before edits read errors failing tests and traces before wide code reads
|
|
23
23
|
Targeted reads use batch with o read s and l avoid bash sed head tail for source
|
|
24
24
|
No fix without proof do not ship guesses if blocked report what evidence is still missing
|
|
25
25
|
Keep instrumentation through verification do not strip logs until the post fix run proves the fix or the user confirms
|
|
26
|
+
Prefer integration tests or existing test reproduction over manual steps when available
|
|
26
27
|
State missing evidence or environment gaps do not invent a fix
|
|
28
|
+
Markers: Prefix substantive claims with [V] verified, [I] inferred, [A] assumed, or [U] unknown.
|
|
29
|
+
Bite-first: Output raw evidence (code, paths, logs) before any prose explanation.
|
|
30
|
+
No preamble: Start immediately with evidence or action. Skip all conversational filler.
|
|
27
31
|
See _conventions for tmp scripts and batch reads
|
package/agents/ideas.md
CHANGED
|
@@ -9,16 +9,20 @@ tier: full
|
|
|
9
9
|
mission: During this ideas flow your mission is to generate and compare possible directions. Use inherited context as background and constraints but avoid anchoring too tightly on prior solutions.
|
|
10
10
|
|
|
11
11
|
workflow:
|
|
12
|
-
1 Diverge: explore many possibilities without judging too early
|
|
13
|
-
2 Evaluate: compare trade offs risks effort and reversibility
|
|
14
|
-
3 Recommend: identify the strongest options and
|
|
15
|
-
4 Package: present choices clearly enough for planning or implementation
|
|
12
|
+
1 Diverge: explore many possibilities without judging too early enumerate exhaustively before narrowing
|
|
13
|
+
2 Evaluate: compare trade offs risks effort and reversibility tag each option P0-P3 and assess change size against 800/500 line caps plus breaking-changes risk
|
|
14
|
+
3 Recommend: identify the strongest options explain why and give overall verdict with justification and confidence_score 0.0-1.0
|
|
15
|
+
4 Package: present choices clearly enough for planning or implementation transfer
|
|
16
16
|
|
|
17
17
|
rules:
|
|
18
18
|
Stay focused on the requested intent creativity should still serve the objective
|
|
19
19
|
Prefer several distinct options over variations of the same idea
|
|
20
20
|
Make assumptions explicit when evidence is limited
|
|
21
21
|
If file context is needed use batch with o read s offset l limit for targeted reading instead of bash sed head tail
|
|
22
|
+
Prefer integration-testable ideas over brittle manual-only designs
|
|
22
23
|
Do not implement changes from this flow
|
|
24
|
+
Markers: Prefix substantive claims with [V] verified, [I] inferred, [A] assumed, or [U] unknown.
|
|
25
|
+
Bite-first: Output raw evidence (code, paths, logs) before any prose explanation.
|
|
26
|
+
No preamble: Start immediately with evidence or action. Skip all conversational filler.
|
|
23
27
|
See _conventions for batch reads and tmp scripts
|
|
24
28
|
See decision gates for material choices that require user preference
|
package/agents/scout.md
CHANGED
|
@@ -12,12 +12,19 @@ workflow:
|
|
|
12
12
|
1 Survey: use ls find and grep to locate relevant files and symbols before reading whole files
|
|
13
13
|
2 Inspect: use batch with o read s offset l limit for targeted file reading instead of bash sed head tail
|
|
14
14
|
3 Trace: if batch returns a context map for a large file use the reported line ranges for targeted follow up reads then follow code paths dependencies configuration and tests that explain the requested area
|
|
15
|
-
4 Report: cite concrete evidence with precise file paths and line ranges stop when the requested context is mapped
|
|
15
|
+
4 Report: cite concrete evidence with precise file paths and line ranges stop when the requested context is mapped enumerate exhaustively before declaring completeness
|
|
16
|
+
5 Validate: cross-check evidence, verify inferences against source, mark gaps with [U], and confirm sufficiency.
|
|
16
17
|
|
|
17
18
|
rules:
|
|
19
|
+
Keep context reads bounded cap grep ls find output highlight any artifact over 1k tokens as [P0] and read in chunks
|
|
18
20
|
This is a read oriented flow do not modify files
|
|
19
21
|
Cite every finding with a precise file path and line number or range
|
|
20
22
|
Include relevant snippets or evidence inline so citations are verifiable
|
|
21
23
|
Show actual code or data not excessive summaries
|
|
22
24
|
If something is not found say so directly do not guess
|
|
25
|
+
Workflow: Scouts must complete 5 steps (Survey → Inspect → Trace → Report → Validate). Reject and resend if Validate is missing.
|
|
26
|
+
When tracing code paths surface any breaking-changes footprint deprecated APIs or altered contracts
|
|
27
|
+
Snap mode: when session mode is snap, prioritize Survey and Inspect. Skip deep Trace. Emit partial findings fast — incomplete maps are acceptable.
|
|
28
|
+
Markers: Preserve exactly ([V] Verified, [I] Inferred, [A] Assumed, [U] Unknown). Never present [A] or [U] as facts to the user. Dispatch a validation scout if critical claims are [A]/[U].
|
|
29
|
+
Output: Zero preamble or filler. Start immediately with the answer or tool call.
|
|
23
30
|
See _conventions for batch reads and tmp scripts
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* apply-patch — 1:1 port of OpenAI Codex CLI apply_patch tool.
|
|
3
|
+
*
|
|
4
|
+
* Parses patch text into hunks, locates context via 4-stage fuzzy matching,
|
|
5
|
+
* computes replacements, and applies them to the filesystem.
|
|
6
|
+
*/
|
|
7
|
+
export interface UpdateFileChunk {
|
|
8
|
+
changeContext?: string;
|
|
9
|
+
oldLines: string[];
|
|
10
|
+
newLines: string[];
|
|
11
|
+
isEndOfFile: boolean;
|
|
12
|
+
}
|
|
13
|
+
export type Hunk = {
|
|
14
|
+
type: "add";
|
|
15
|
+
path: string;
|
|
16
|
+
contents: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: "delete";
|
|
19
|
+
path: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: "update";
|
|
22
|
+
path: string;
|
|
23
|
+
movePath?: string;
|
|
24
|
+
chunks: UpdateFileChunk[];
|
|
25
|
+
};
|
|
26
|
+
export interface ApplyPatchArgs {
|
|
27
|
+
patch: string;
|
|
28
|
+
hunks: Hunk[];
|
|
29
|
+
environmentId?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare class ParseError extends Error {
|
|
32
|
+
readonly kind: "invalid-patch" | "invalid-hunk";
|
|
33
|
+
readonly lineNumber?: number | undefined;
|
|
34
|
+
constructor(kind: "invalid-patch" | "invalid-hunk", message: string, lineNumber?: number | undefined);
|
|
35
|
+
}
|
|
36
|
+
export declare class ComputeReplacementsError extends Error {
|
|
37
|
+
constructor(message: string);
|
|
38
|
+
}
|
|
39
|
+
export declare function parsePatch(patch: string): ApplyPatchArgs;
|
|
40
|
+
export declare function seekSequence(lines: string[], pattern: string[], start: number, eof: boolean): number | undefined;
|
|
41
|
+
export declare function computeReplacements(originalLines: string[], filePath: string, chunks: UpdateFileChunk[]): Array<{
|
|
42
|
+
startIdx: number;
|
|
43
|
+
oldLen: number;
|
|
44
|
+
newLines: string[];
|
|
45
|
+
}>;
|
|
46
|
+
export declare function applyReplacements(lines: string[], replacements: Array<{
|
|
47
|
+
startIdx: number;
|
|
48
|
+
oldLen: number;
|
|
49
|
+
newLines: string[];
|
|
50
|
+
}>): string[];
|
|
51
|
+
export interface AffectedPaths {
|
|
52
|
+
added: string[];
|
|
53
|
+
modified: string[];
|
|
54
|
+
deleted: string[];
|
|
55
|
+
}
|
|
56
|
+
export declare function applyPatch(patchText: string, cwd: string): Promise<{
|
|
57
|
+
affected: AffectedPaths;
|
|
58
|
+
exact: boolean;
|
|
59
|
+
}>;
|
|
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