@howaboua/pi-durable-apply-patch 0.0.0-stage → 0.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.
@@ -0,0 +1,5 @@
1
+ import type { Context } from "@earendil-works/chord";
2
+ import { type ExecutionEnv } from "@earendil-works/pi-durable/env";
3
+ import { type PatchOutcome } from "./patch-outcome.ts";
4
+ /** Apply ordered file actions through the conversation environment. Never replay interrupted mutations. */
5
+ export declare function executePatch(env: ExecutionEnv, input: string, context: Context): Promise<PatchOutcome>;
@@ -0,0 +1,17 @@
1
+ import type { Context } from "@earendil-works/chord";
2
+ import { type ExecutionEnv, FileError, type Result } from "@earendil-works/pi-durable/env";
3
+ export declare function checkAbort(context: Context): void;
4
+ /** Environment-only mutations and the accuracy of their recoverable contents. */
5
+ export declare class PatchFileMutations {
6
+ private accuracy;
7
+ private readonly env;
8
+ private readonly context;
9
+ constructor(env: ExecutionEnv, context: Context);
10
+ get exact(): boolean;
11
+ markUncertain(): void;
12
+ read(path: string): Promise<Result<string, FileError>>;
13
+ noteSupport(path: string): Promise<void>;
14
+ optionalRead(path: string): Promise<string | null>;
15
+ write(path: string, contents: string, allowParents: boolean): Promise<void>;
16
+ remove(path: string, oldContent: string | null, label: string): Promise<void>;
17
+ }
@@ -0,0 +1,70 @@
1
+ import { Type } from "@earendil-works/pi-ai";
2
+ import { type ExecutePatchResult, type FileChange } from "./patch-outcome.ts";
3
+ export { executePatch } from "./executor.ts";
4
+ export type { ExecutePatchResult, FileChange, PatchOutcome, } from "./patch-outcome.ts";
5
+ export { ExecutePatchError } from "./patch-outcome.ts";
6
+ export type ApplyPatchToolDetails = {
7
+ status: "success" | "partial_failure";
8
+ result: ExecutePatchResult;
9
+ changes: FileChange[];
10
+ exact: boolean;
11
+ failedTargets: string[];
12
+ serializationWarnings?: string[];
13
+ };
14
+ /** A normal Durable registration, automatically discoverable by Code and Notebook. */
15
+ export declare function createApplyPatchTool(): {
16
+ name: string;
17
+ description: string;
18
+ parameters: Type.TObject<{
19
+ input: Type.TString;
20
+ }>;
21
+ constrainedSampling?: false | import("@earendil-works/pi-ai").ConstrainedSamplingConfig;
22
+ replay?: "safe" | "unsafe";
23
+ executionMode?: import("@earendil-works/pi-durable").ToolExecutionMode;
24
+ prepareArguments?(args: unknown): {
25
+ input: string;
26
+ };
27
+ structuredOutputSchema?: Type.TSchema;
28
+ callers?: readonly ("model" | "tools")[];
29
+ deferred?: true;
30
+ outputLimits?: {
31
+ readonly maxBytes?: number;
32
+ readonly maxLines?: number;
33
+ readonly retain?: "head" | "tail";
34
+ };
35
+ execute(args: {
36
+ input: string;
37
+ }, api: import("@earendil-works/pi-durable").ToolExecutionApi<ApplyPatchToolDetails>, context: import("@earendil-works/chord").Context): Promise<import("@earendil-works/pi-durable").ToolExecutionResult<ApplyPatchToolDetails>>;
38
+ executionHints: {
39
+ deferLoading: boolean;
40
+ usage: string;
41
+ };
42
+ };
43
+ export declare const ApplyPatch: import("@earendil-works/pi-durable").Extension<{
44
+ name: string;
45
+ description: string;
46
+ parameters: Type.TObject<{
47
+ input: Type.TString;
48
+ }>;
49
+ constrainedSampling?: false | import("@earendil-works/pi-ai").ConstrainedSamplingConfig;
50
+ replay?: "safe" | "unsafe";
51
+ executionMode?: import("@earendil-works/pi-durable").ToolExecutionMode;
52
+ prepareArguments?(args: unknown): {
53
+ input: string;
54
+ };
55
+ structuredOutputSchema?: Type.TSchema;
56
+ callers?: readonly ("model" | "tools")[];
57
+ deferred?: true;
58
+ outputLimits?: {
59
+ readonly maxBytes?: number;
60
+ readonly maxLines?: number;
61
+ readonly retain?: "head" | "tail";
62
+ };
63
+ execute(args: {
64
+ input: string;
65
+ }, api: import("@earendil-works/pi-durable").ToolExecutionApi<ApplyPatchToolDetails>, context: import("@earendil-works/chord").Context): Promise<import("@earendil-works/pi-durable").ToolExecutionResult<ApplyPatchToolDetails>>;
66
+ executionHints: {
67
+ deferLoading: boolean;
68
+ usage: string;
69
+ };
70
+ }>;