@leitwerk-dev/process-sdk 0.1.9 → 0.2.1
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/browser-ui-extension.d.ts +20 -0
- package/dist/browser-ui-extension.d.ts.map +1 -1
- package/dist/capabilities.d.ts +6 -0
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/{chunk-LIIP7FMU.js → chunk-5R6MVLHC.js} +1 -1
- package/dist/chunk-5R6MVLHC.js.map +1 -0
- package/dist/chunk-DVXW2ZUV.js +1 -0
- package/dist/chunk-DVXW2ZUV.js.map +1 -0
- package/dist/{chunk-TRQJ5PRM.js → chunk-I7U6HCLN.js} +1 -11
- package/dist/chunk-I7U6HCLN.js.map +1 -0
- package/dist/{chunk-5RJZ2E7D.js → chunk-TM2LTSW4.js} +2 -6
- package/dist/chunk-TM2LTSW4.js.map +1 -0
- package/dist/codecs.d.ts +1 -0
- package/dist/codecs.d.ts.map +1 -1
- package/dist/commit-message.d.ts +5 -0
- package/dist/commit-message.d.ts.map +1 -1
- package/dist/core-capabilities.d.ts +396 -44
- package/dist/core-capabilities.d.ts.map +1 -1
- package/dist/define-process.d.ts +209 -64
- package/dist/define-process.d.ts.map +1 -1
- package/dist/event-bus.d.ts +1 -0
- package/dist/event-bus.d.ts.map +1 -1
- package/dist/{extension-api-BBcwktmc.d.ts → extension-api-B4gG5w1K.d.ts} +1111 -153
- package/dist/extension-api.d.ts +481 -38
- package/dist/extension-api.d.ts.map +1 -1
- package/dist/external-action-source.d.ts +9 -0
- package/dist/external-action-source.d.ts.map +1 -0
- package/dist/external-source-poll.d.ts +22 -0
- package/dist/external-source-poll.d.ts.map +1 -0
- package/dist/flow.d.ts +380 -107
- package/dist/flow.d.ts.map +1 -1
- package/dist/form-contract.d.ts +1 -1
- package/dist/form-contract.d.ts.map +1 -1
- package/dist/fs-utils.d.ts +6 -0
- package/dist/fs-utils.d.ts.map +1 -1
- package/dist/git-binary.d.ts +2 -1
- package/dist/git-binary.d.ts.map +1 -1
- package/dist/git-binary.js +25 -33
- package/dist/git-binary.js.map +1 -1
- package/dist/graph-fragments.d.ts +16 -0
- package/dist/graph-fragments.d.ts.map +1 -1
- package/dist/host-capabilities.d.ts +9 -3
- package/dist/host-capabilities.d.ts.map +1 -1
- package/dist/index.d.ts +40 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4876 -29
- package/dist/index.js.map +1 -1
- package/dist/integration-http.d.ts +32 -0
- package/dist/integration-http.d.ts.map +1 -0
- package/dist/json-data.d.ts +3 -0
- package/dist/json-data.d.ts.map +1 -0
- package/dist/leaf-outcome-renderer.d.ts +35 -0
- package/dist/leaf-outcome-renderer.d.ts.map +1 -1
- package/dist/leaf-outcome-renderer.js +86 -64
- package/dist/leaf-outcome-renderer.js.map +1 -1
- package/dist/leaf-outcomes.d.ts +3 -0
- package/dist/leaf-outcomes.d.ts.map +1 -1
- package/dist/model-provider.d.ts +144 -12
- package/dist/model-provider.d.ts.map +1 -1
- package/dist/pi-config-public.d.ts +2 -0
- package/dist/pi-config-public.d.ts.map +1 -0
- package/dist/pi-config-public.js +15 -0
- package/dist/pi-config-public.js.map +1 -0
- package/dist/pi-config.d.ts +41 -5
- package/dist/pi-config.d.ts.map +1 -1
- package/dist/pi-config.js +20 -180
- package/dist/pi-config.js.map +1 -1
- package/dist/process-definition-internals.d.ts +4 -0
- package/dist/process-definition-internals.d.ts.map +1 -1
- package/dist/process-flow-view.d.ts +2 -0
- package/dist/process-flow-view.d.ts.map +1 -1
- package/dist/process-graph.d.ts +34 -0
- package/dist/process-graph.d.ts.map +1 -1
- package/dist/process-launcher-builder.d.ts +5 -0
- package/dist/process-launcher-builder.d.ts.map +1 -1
- package/dist/process-watcher-builder.d.ts +5 -0
- package/dist/process-watcher-builder.d.ts.map +1 -1
- package/dist/process-watcher-source.d.ts +3 -1
- package/dist/process-watcher-source.d.ts.map +1 -1
- package/dist/project-binding.d.ts +13 -0
- package/dist/project-binding.d.ts.map +1 -0
- package/dist/registry-utils.d.ts +6 -0
- package/dist/registry-utils.d.ts.map +1 -1
- package/dist/repository-feedback.d.ts +47 -0
- package/dist/repository-feedback.d.ts.map +1 -0
- package/dist/repository-git-env.d.ts +8 -2
- package/dist/repository-git-env.d.ts.map +1 -1
- package/dist/repository-http.d.ts +31 -0
- package/dist/repository-http.d.ts.map +1 -0
- package/dist/repository-https.d.ts +3 -0
- package/dist/repository-https.d.ts.map +1 -0
- package/dist/repository-issue-watcher.d.ts +51 -0
- package/dist/repository-issue-watcher.d.ts.map +1 -0
- package/dist/repository-reconciliation.d.ts +5 -0
- package/dist/repository-reconciliation.d.ts.map +1 -0
- package/dist/repository-source-config.d.ts +58 -0
- package/dist/repository-source-config.d.ts.map +1 -0
- package/dist/repository-types.d.ts +63 -0
- package/dist/repository-types.d.ts.map +1 -0
- package/dist/review-flow-public.d.ts +2 -0
- package/dist/review-flow-public.d.ts.map +1 -0
- package/dist/review-flow-public.js +11 -0
- package/dist/review-flow-public.js.map +1 -0
- package/dist/review-flow.d.ts +6 -0
- package/dist/review-flow.d.ts.map +1 -1
- package/dist/review-flow.js +12 -43
- package/dist/review-flow.js.map +1 -1
- package/dist/runtime-internals-public.d.ts +2 -0
- package/dist/runtime-internals-public.d.ts.map +1 -0
- package/dist/runtime-internals-public.js +16 -0
- package/dist/runtime-internals-public.js.map +1 -0
- package/dist/runtime-internals.js +19 -2
- package/dist/runtime-internals.js.map +1 -1
- package/dist/server-events.d.ts +67 -0
- package/dist/server-events.d.ts.map +1 -1
- package/dist/server-process-builder.d.ts +7 -0
- package/dist/server-process-builder.d.ts.map +1 -1
- package/dist/state-helpers.d.ts +8 -0
- package/dist/state-helpers.d.ts.map +1 -1
- package/dist/subprocess-env.d.ts +4 -0
- package/dist/subprocess-env.d.ts.map +1 -1
- package/dist/tool-arguments.d.ts +9 -0
- package/dist/tool-arguments.d.ts.map +1 -0
- package/dist/tool-renderers.d.ts +6 -0
- package/dist/tool-renderers.d.ts.map +1 -1
- package/dist/turn-semantics.d.ts +18 -6
- package/dist/turn-semantics.d.ts.map +1 -1
- package/dist/types.d.ts +209 -38
- package/dist/types.d.ts.map +1 -1
- package/dist/ui-process-builder.d.ts +5 -0
- package/dist/ui-process-builder.d.ts.map +1 -1
- package/dist/worker-process-builder.d.ts +5 -0
- package/dist/worker-process-builder.d.ts.map +1 -1
- package/package.json +17 -15
- package/src/browser-ui-extension.ts +20 -0
- package/src/capabilities.ts +9 -1
- package/src/codecs.ts +1 -0
- package/src/commit-message.ts +5 -0
- package/src/core-capabilities.ts +464 -59
- package/src/define-process.ts +384 -332
- package/src/event-bus.ts +1 -0
- package/src/extension-api.ts +521 -41
- package/src/external-action-source.ts +17 -0
- package/src/external-source-poll.ts +61 -0
- package/src/flow.ts +674 -677
- package/src/form-contract.ts +0 -4
- package/src/fs-utils.ts +21 -2
- package/src/git-binary.ts +2 -1
- package/src/graph-fragments.ts +16 -0
- package/src/host-capabilities.ts +9 -6
- package/src/index.ts +51 -206
- package/src/integration-http.ts +70 -0
- package/src/json-data.ts +25 -0
- package/src/leaf-outcome-renderer.ts +35 -0
- package/src/leaf-outcomes.ts +4 -9
- package/src/model-provider.ts +179 -43
- package/src/pi-config-public.ts +7 -0
- package/src/pi-config.ts +48 -8
- package/src/process-definition-internals.ts +4 -0
- package/src/process-flow-view.ts +34 -88
- package/src/process-graph.ts +59 -51
- package/src/process-launcher-builder.ts +5 -0
- package/src/process-watcher-builder.ts +5 -0
- package/src/process-watcher-source.ts +9 -10
- package/src/project-binding.ts +40 -0
- package/src/registry-utils.ts +7 -5
- package/src/repository-feedback.ts +85 -0
- package/src/repository-git-env.ts +40 -2
- package/src/repository-http.ts +88 -0
- package/src/repository-https.ts +22 -0
- package/src/repository-issue-watcher.ts +122 -0
- package/src/repository-reconciliation.ts +30 -0
- package/src/repository-source-config.ts +79 -0
- package/src/repository-types.ts +63 -0
- package/src/review-flow-public.ts +5 -0
- package/src/review-flow.ts +6 -0
- package/src/runtime-internals-public.ts +7 -0
- package/src/server-events.ts +67 -0
- package/src/server-process-builder.ts +10 -1
- package/src/state-helpers.ts +14 -4
- package/src/subprocess-env.ts +9 -0
- package/src/tool-arguments.ts +39 -0
- package/src/tool-renderers.ts +6 -0
- package/src/turn-semantics.ts +45 -76
- package/src/types.ts +216 -44
- package/src/ui-process-builder.ts +8 -1
- package/src/worker-process-builder.ts +8 -1
- package/dist/browser-ui-extension.js +0 -2
- package/dist/browser-ui-extension.js.map +0 -1
- package/dist/capabilities.js +0 -7
- package/dist/capabilities.js.map +0 -1
- package/dist/chunk-5RJZ2E7D.js.map +0 -1
- package/dist/chunk-LIIP7FMU.js.map +0 -1
- package/dist/chunk-TRQJ5PRM.js.map +0 -1
- package/dist/codecs.js +0 -9
- package/dist/codecs.js.map +0 -1
- package/dist/commit-message.js +0 -3
- package/dist/commit-message.js.map +0 -1
- package/dist/core-capabilities.js +0 -6
- package/dist/core-capabilities.js.map +0 -1
- package/dist/define-process.js +0 -1078
- package/dist/define-process.js.map +0 -1
- package/dist/event-bus.js +0 -31
- package/dist/event-bus.js.map +0 -1
- package/dist/extension-api.js +0 -5
- package/dist/extension-api.js.map +0 -1
- package/dist/flow.js +0 -1645
- package/dist/flow.js.map +0 -1
- package/dist/form-contract.js +0 -2
- package/dist/form-contract.js.map +0 -1
- package/dist/fs-utils.js +0 -23
- package/dist/fs-utils.js.map +0 -1
- package/dist/graph-fragments.js +0 -57
- package/dist/graph-fragments.js.map +0 -1
- package/dist/host-capabilities.js +0 -42
- package/dist/host-capabilities.js.map +0 -1
- package/dist/launcher-contract.js +0 -2
- package/dist/launcher-contract.js.map +0 -1
- package/dist/leaf-outcomes.js +0 -52
- package/dist/leaf-outcomes.js.map +0 -1
- package/dist/model-provider.js +0 -171
- package/dist/model-provider.js.map +0 -1
- package/dist/process-definition-internals.js +0 -25
- package/dist/process-definition-internals.js.map +0 -1
- package/dist/process-flow-view.js +0 -418
- package/dist/process-flow-view.js.map +0 -1
- package/dist/process-graph.js +0 -212
- package/dist/process-graph.js.map +0 -1
- package/dist/process-launcher-builder.js +0 -43
- package/dist/process-launcher-builder.js.map +0 -1
- package/dist/process-watcher-builder.js +0 -40
- package/dist/process-watcher-builder.js.map +0 -1
- package/dist/process-watcher-source.js +0 -52
- package/dist/process-watcher-source.js.map +0 -1
- package/dist/registry-utils.js +0 -18
- package/dist/registry-utils.js.map +0 -1
- package/dist/repository-git-env.js +0 -26
- package/dist/repository-git-env.js.map +0 -1
- package/dist/server-events.js +0 -2
- package/dist/server-events.js.map +0 -1
- package/dist/server-process-builder.js +0 -52
- package/dist/server-process-builder.js.map +0 -1
- package/dist/state-helpers.js +0 -18
- package/dist/state-helpers.js.map +0 -1
- package/dist/subprocess-env.js +0 -34
- package/dist/subprocess-env.js.map +0 -1
- package/dist/tool-renderers.js +0 -63
- package/dist/tool-renderers.js.map +0 -1
- package/dist/turn-semantics.js +0 -365
- package/dist/turn-semantics.js.map +0 -1
- package/dist/types.js +0 -23
- package/dist/types.js.map +0 -1
- package/dist/ui-process-builder.js +0 -30
- package/dist/ui-process-builder.js.map +0 -1
- package/dist/worker-process-builder.js +0 -22
- package/dist/worker-process-builder.js.map +0 -1
package/src/model-provider.ts
CHANGED
|
@@ -1,67 +1,106 @@
|
|
|
1
|
-
/** JSON values that may cross the server/worker bootstrap boundary. */
|
|
1
|
+
/** JSON values that may cross the server/worker bootstrap boundary. @public */
|
|
2
2
|
export type ProviderJsonPrimitive = string | number | boolean | null;
|
|
3
|
+
/** @public */
|
|
3
4
|
export type ProviderJsonValue =
|
|
4
5
|
| ProviderJsonPrimitive
|
|
5
6
|
| ProviderJsonValue[]
|
|
6
|
-
| {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
| {
|
|
8
|
+
/** @internal */
|
|
9
|
+
[key: string]: ProviderJsonValue;
|
|
10
|
+
};
|
|
11
|
+
/** @public */
|
|
12
|
+
export type ProviderJsonObject = {
|
|
13
|
+
/** @internal */
|
|
14
|
+
[key: string]: ProviderJsonValue;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** @public */
|
|
9
18
|
export interface ConfiguredProviderModel {
|
|
19
|
+
/** @public */
|
|
10
20
|
readonly profileId: string;
|
|
21
|
+
/** @public */
|
|
11
22
|
readonly modelId: string;
|
|
12
23
|
}
|
|
13
24
|
|
|
25
|
+
/** @public */
|
|
14
26
|
export type ProviderAvailability = "available" | "unavailable" | "stale";
|
|
15
27
|
|
|
28
|
+
/** @public */
|
|
16
29
|
export interface ProviderModelStatus {
|
|
30
|
+
/** @public */
|
|
17
31
|
readonly modelId: string;
|
|
32
|
+
/** @public */
|
|
18
33
|
readonly availability: ProviderAvailability;
|
|
19
|
-
/** Safe operator-facing reason. It must not contain credential material. */
|
|
34
|
+
/** Safe operator-facing reason. It must not contain credential material. @internal */
|
|
20
35
|
readonly safeReason?: string;
|
|
21
36
|
}
|
|
22
37
|
|
|
38
|
+
/** @public */
|
|
23
39
|
export interface ProviderCredentialStatus {
|
|
40
|
+
/** @public */
|
|
24
41
|
readonly available: boolean;
|
|
42
|
+
/** @public */
|
|
25
43
|
readonly revision: number | null;
|
|
26
44
|
}
|
|
27
45
|
|
|
46
|
+
/** @public */
|
|
28
47
|
export interface ModelProviderModelsContext<TConfig = unknown> {
|
|
48
|
+
/** @internal */
|
|
29
49
|
readonly config: TConfig;
|
|
50
|
+
/** @public */
|
|
30
51
|
readonly configuredModels: readonly ConfiguredProviderModel[];
|
|
52
|
+
/** @public */
|
|
31
53
|
readonly credentialStatus: ProviderCredentialStatus;
|
|
32
54
|
}
|
|
33
55
|
|
|
56
|
+
/** @public */
|
|
34
57
|
export interface ProviderOptionChoice {
|
|
58
|
+
/** @internal */
|
|
35
59
|
readonly value: string;
|
|
60
|
+
/** @internal */
|
|
36
61
|
readonly label: string;
|
|
37
62
|
}
|
|
38
63
|
|
|
64
|
+
/** @public */
|
|
39
65
|
export interface ProviderOptionChoicesContext<TConfig = unknown> {
|
|
66
|
+
/** @internal */
|
|
40
67
|
readonly config: TConfig;
|
|
68
|
+
/** @internal */
|
|
41
69
|
readonly credentialStatus: ProviderCredentialStatus;
|
|
42
70
|
}
|
|
43
71
|
|
|
72
|
+
/** @internal */
|
|
44
73
|
export interface ProviderOptionDefaultContext<TConfig = unknown> {
|
|
74
|
+
/** @internal */
|
|
45
75
|
readonly config: TConfig;
|
|
46
76
|
}
|
|
47
77
|
|
|
78
|
+
/** @public */
|
|
48
79
|
export interface ProviderOptionField<TConfig = unknown> {
|
|
80
|
+
/** @public */
|
|
49
81
|
readonly label: string;
|
|
82
|
+
/** @public */
|
|
50
83
|
readonly required?: boolean;
|
|
84
|
+
/** @internal */
|
|
51
85
|
readonly minLength?: number;
|
|
86
|
+
/** @public */
|
|
52
87
|
readonly maxLength?: number;
|
|
53
88
|
/**
|
|
54
89
|
* Explicit provider default. Dynamic choices are advisory and are never used
|
|
55
90
|
* as an implicit default.
|
|
56
91
|
*/
|
|
92
|
+
/** @internal */
|
|
57
93
|
readonly defaultValue?:
|
|
58
94
|
| string
|
|
59
95
|
| null
|
|
60
96
|
| ((ctx: ProviderOptionDefaultContext<TConfig>) => string | null | undefined);
|
|
61
97
|
}
|
|
62
98
|
|
|
99
|
+
/** @public */
|
|
63
100
|
export interface ProviderOptionsDefinition<TConfig = unknown> {
|
|
101
|
+
/** @public */
|
|
64
102
|
readonly fields: Readonly<Record<string, ProviderOptionField<TConfig>>>;
|
|
103
|
+
/** @public */
|
|
65
104
|
choices?(
|
|
66
105
|
ctx: ProviderOptionChoicesContext<TConfig>,
|
|
67
106
|
):
|
|
@@ -69,6 +108,7 @@ export interface ProviderOptionsDefinition<TConfig = unknown> {
|
|
|
69
108
|
| Promise<Readonly<Record<string, readonly ProviderOptionChoice[]>>>;
|
|
70
109
|
}
|
|
71
110
|
|
|
111
|
+
/** @public */
|
|
72
112
|
export function defineProviderOptions<TConfig = unknown>(
|
|
73
113
|
definition: ProviderOptionsDefinition<TConfig>,
|
|
74
114
|
): ProviderOptionsDefinition<TConfig> {
|
|
@@ -76,17 +116,11 @@ export function defineProviderOptions<TConfig = unknown>(
|
|
|
76
116
|
if (fieldId.trim() === "") {
|
|
77
117
|
throw new Error("Provider option field ids must not be empty");
|
|
78
118
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
(!Number.isInteger(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
if (
|
|
86
|
-
field.maxLength !== undefined &&
|
|
87
|
-
(!Number.isInteger(field.maxLength) || field.maxLength < 0)
|
|
88
|
-
) {
|
|
89
|
-
throw new Error(`Provider option '${fieldId}' maxLength must be a non-negative integer`);
|
|
119
|
+
for (const bound of ["minLength", "maxLength"] as const) {
|
|
120
|
+
const value = field[bound];
|
|
121
|
+
if (value !== undefined && (!Number.isInteger(value) || value < 0)) {
|
|
122
|
+
throw new Error(`Provider option '${fieldId}' ${bound} must be a non-negative integer`);
|
|
123
|
+
}
|
|
90
124
|
}
|
|
91
125
|
if (
|
|
92
126
|
field.minLength !== undefined &&
|
|
@@ -99,22 +133,42 @@ export function defineProviderOptions<TConfig = unknown>(
|
|
|
99
133
|
return { ...definition, fields: { ...definition.fields } };
|
|
100
134
|
}
|
|
101
135
|
|
|
136
|
+
/** @internal */
|
|
102
137
|
export interface ProviderOptionsResolutionInput<TConfig = unknown> {
|
|
138
|
+
/** @internal */
|
|
103
139
|
readonly definition: ProviderOptionsDefinition<TConfig> | null | undefined;
|
|
140
|
+
/** @internal */
|
|
104
141
|
readonly config: TConfig;
|
|
142
|
+
/** @internal */
|
|
105
143
|
readonly explicit?: Readonly<Record<string, unknown>> | null;
|
|
144
|
+
/** @internal */
|
|
106
145
|
readonly profileDefaults?: Readonly<Record<string, unknown>> | null;
|
|
107
146
|
}
|
|
108
147
|
|
|
148
|
+
/** @internal */
|
|
109
149
|
export interface ProviderOptionValidationIssue {
|
|
150
|
+
/** @internal */
|
|
110
151
|
readonly fieldId: string;
|
|
152
|
+
/** @internal */
|
|
111
153
|
readonly code: "unknown" | "not_string" | "too_short" | "too_long" | "required";
|
|
154
|
+
/** @internal */
|
|
112
155
|
readonly message: string;
|
|
113
156
|
}
|
|
114
157
|
|
|
158
|
+
/** @internal */
|
|
115
159
|
export type ProviderOptionsResolution =
|
|
116
|
-
| {
|
|
117
|
-
|
|
160
|
+
| {
|
|
161
|
+
/** @internal */
|
|
162
|
+
readonly ok: true;
|
|
163
|
+
/** @internal */
|
|
164
|
+
readonly value: Readonly<Record<string, string>>;
|
|
165
|
+
}
|
|
166
|
+
| {
|
|
167
|
+
/** @internal */
|
|
168
|
+
readonly ok: false;
|
|
169
|
+
/** @internal */
|
|
170
|
+
readonly issues: readonly ProviderOptionValidationIssue[];
|
|
171
|
+
};
|
|
118
172
|
|
|
119
173
|
function validateOptionValue<TConfig>(
|
|
120
174
|
fieldId: string,
|
|
@@ -149,6 +203,7 @@ function validateOptionValue<TConfig>(
|
|
|
149
203
|
* Resolve explicit values, profile defaults, then declared provider defaults.
|
|
150
204
|
* Dynamic choices deliberately do not participate in validation or fallback.
|
|
151
205
|
*/
|
|
206
|
+
/** @internal */
|
|
152
207
|
export function resolveProviderOptions<TConfig = unknown>(
|
|
153
208
|
input: ProviderOptionsResolutionInput<TConfig>,
|
|
154
209
|
): ProviderOptionsResolution {
|
|
@@ -198,7 +253,7 @@ export function resolveProviderOptions<TConfig = unknown>(
|
|
|
198
253
|
return issues.length > 0 ? { ok: false, issues } : { ok: true, value: resolved };
|
|
199
254
|
}
|
|
200
255
|
|
|
201
|
-
/** Keep only fields declared by a newly selected provider. */
|
|
256
|
+
/** Keep only fields declared by a newly selected provider. @internal */
|
|
202
257
|
export function filterProviderOptionsForDefinition<TConfig = unknown>(
|
|
203
258
|
definition: ProviderOptionsDefinition<TConfig> | null | undefined,
|
|
204
259
|
values: Readonly<Record<string, string>>,
|
|
@@ -211,24 +266,34 @@ export function filterProviderOptionsForDefinition<TConfig = unknown>(
|
|
|
211
266
|
* Runtime-independent schema boundary for non-secret provider worker config.
|
|
212
267
|
* Adapters may wrap Valibot, TypeBox, Zod, or another validator behind parse.
|
|
213
268
|
*/
|
|
269
|
+
/** @public */
|
|
214
270
|
export interface ProviderWorkerConfigSchema<TValue extends ProviderJsonObject> {
|
|
271
|
+
/** @public */
|
|
215
272
|
parse(value: unknown): TValue;
|
|
216
273
|
}
|
|
217
274
|
|
|
275
|
+
/** @public */
|
|
218
276
|
export interface ProviderWorkerConfigContext<TConfig = unknown> {
|
|
277
|
+
/** @public */
|
|
219
278
|
readonly config: TConfig;
|
|
279
|
+
/** @internal */
|
|
220
280
|
readonly options: Readonly<Record<string, string>>;
|
|
221
281
|
}
|
|
222
282
|
|
|
283
|
+
/** @public */
|
|
223
284
|
export interface ProviderWorkerConfigDefinition<
|
|
224
285
|
TConfig = unknown,
|
|
225
286
|
TValue extends ProviderJsonObject = ProviderJsonObject,
|
|
226
287
|
> {
|
|
288
|
+
/** @public */
|
|
227
289
|
readonly version: number;
|
|
290
|
+
/** @public */
|
|
228
291
|
readonly schema: ProviderWorkerConfigSchema<TValue>;
|
|
292
|
+
/** @public */
|
|
229
293
|
resolve(ctx: ProviderWorkerConfigContext<TConfig>): TValue;
|
|
230
294
|
}
|
|
231
295
|
|
|
296
|
+
/** @public */
|
|
232
297
|
export function defineWorkerConfig<
|
|
233
298
|
TConfig = unknown,
|
|
234
299
|
TValue extends ProviderJsonObject = ProviderJsonObject,
|
|
@@ -241,42 +306,63 @@ export function defineWorkerConfig<
|
|
|
241
306
|
return definition;
|
|
242
307
|
}
|
|
243
308
|
|
|
309
|
+
/** @public */
|
|
244
310
|
export interface PiWorkerReference<
|
|
245
311
|
TConfig = unknown,
|
|
246
312
|
TValue extends ProviderJsonObject = ProviderJsonObject,
|
|
247
313
|
> {
|
|
314
|
+
/** @public */
|
|
248
315
|
readonly kind: "extension_pi_worker";
|
|
316
|
+
/** @internal */
|
|
249
317
|
readonly config?: ProviderWorkerConfigDefinition<TConfig, TValue>;
|
|
250
|
-
/** Mutable, flat JSON credential files required by this provider's Pi extension. */
|
|
318
|
+
/** Mutable, flat JSON credential files required by this provider's Pi extension. @internal */
|
|
251
319
|
readonly credentialFiles?: readonly string[];
|
|
252
320
|
}
|
|
253
321
|
|
|
322
|
+
/** @public */
|
|
254
323
|
export interface PiServerReference {
|
|
324
|
+
/** @internal */
|
|
255
325
|
readonly kind: "extension_pi_server";
|
|
256
326
|
}
|
|
257
327
|
|
|
328
|
+
/** @public */
|
|
258
329
|
export interface PiServerGenerateTextInput<TConfig = unknown> {
|
|
330
|
+
/** @public */
|
|
259
331
|
readonly providerId: string;
|
|
332
|
+
/** @public */
|
|
260
333
|
readonly modelId: string;
|
|
334
|
+
/** @public */
|
|
261
335
|
readonly thinkingLevel: string;
|
|
336
|
+
/** @public */
|
|
262
337
|
readonly prompt: string;
|
|
338
|
+
/** @public */
|
|
263
339
|
readonly systemPrompt: string;
|
|
340
|
+
/** @public */
|
|
264
341
|
readonly maxTokens: number;
|
|
342
|
+
/** @public */
|
|
265
343
|
readonly config: TConfig;
|
|
344
|
+
/** @public */
|
|
266
345
|
readonly options: Readonly<Record<string, string>>;
|
|
346
|
+
/** @public */
|
|
267
347
|
readonly secrets: Readonly<Record<string, string>>;
|
|
348
|
+
/** @public */
|
|
268
349
|
readonly request: {
|
|
350
|
+
/** @public */
|
|
269
351
|
readonly timeoutMs?: number;
|
|
352
|
+
/** @internal */
|
|
270
353
|
readonly maxRetries?: number;
|
|
354
|
+
/** @public */
|
|
271
355
|
readonly maxRetryDelayMs: number;
|
|
272
356
|
};
|
|
273
357
|
}
|
|
274
358
|
|
|
275
|
-
/** Server-only provider boundary for title generation and future cheap LLM consumers. */
|
|
359
|
+
/** Server-only provider boundary for title generation and future cheap LLM consumers. @public */
|
|
276
360
|
export interface PiServerAdapter<TConfig = unknown> {
|
|
361
|
+
/** @public */
|
|
277
362
|
generateText(input: PiServerGenerateTextInput<TConfig>): Promise<string>;
|
|
278
363
|
}
|
|
279
364
|
|
|
365
|
+
/** @public */
|
|
280
366
|
export function definePiServerAdapter<TConfig = unknown>(
|
|
281
367
|
adapter: PiServerAdapter<TConfig>,
|
|
282
368
|
): PiServerAdapter<TConfig> {
|
|
@@ -286,21 +372,33 @@ export function definePiServerAdapter<TConfig = unknown>(
|
|
|
286
372
|
return adapter;
|
|
287
373
|
}
|
|
288
374
|
|
|
375
|
+
/** @public */
|
|
289
376
|
export interface BuiltinPiProviderReference {
|
|
377
|
+
/** @public */
|
|
290
378
|
readonly kind: "builtin_pi_provider";
|
|
379
|
+
/** @internal */
|
|
291
380
|
readonly providerId: string;
|
|
292
381
|
}
|
|
293
382
|
|
|
383
|
+
/** @public */
|
|
294
384
|
export interface ConfiguredPiProviderReference<TConfig = unknown> {
|
|
385
|
+
/** @public */
|
|
295
386
|
readonly kind: "configured_pi_provider";
|
|
387
|
+
/** @internal */
|
|
296
388
|
readonly providerId: string;
|
|
297
|
-
/** Resolve the credential-blind models.json document pinned into each worker snapshot. */
|
|
298
|
-
resolveModels(ctx: {
|
|
389
|
+
/** Resolve the credential-blind models.json document pinned into each worker snapshot. @internal */
|
|
390
|
+
resolveModels(ctx: {
|
|
391
|
+
/** @internal */
|
|
392
|
+
readonly config: TConfig;
|
|
393
|
+
}): ProviderJsonObject;
|
|
299
394
|
}
|
|
300
395
|
|
|
396
|
+
/** @public */
|
|
301
397
|
export function piWorker<TConfig = unknown, TValue extends ProviderJsonObject = ProviderJsonObject>(
|
|
302
398
|
input: {
|
|
399
|
+
/** @public */
|
|
303
400
|
config?: ProviderWorkerConfigDefinition<TConfig, TValue>;
|
|
401
|
+
/** @public */
|
|
304
402
|
credentialFiles?: readonly string[];
|
|
305
403
|
} = {},
|
|
306
404
|
): PiWorkerReference<TConfig, TValue> {
|
|
@@ -317,10 +415,12 @@ export function piWorker<TConfig = unknown, TValue extends ProviderJsonObject =
|
|
|
317
415
|
};
|
|
318
416
|
}
|
|
319
417
|
|
|
418
|
+
/** @public */
|
|
320
419
|
export function piServer(): PiServerReference {
|
|
321
420
|
return { kind: "extension_pi_server" };
|
|
322
421
|
}
|
|
323
422
|
|
|
423
|
+
/** @public */
|
|
324
424
|
export function builtinPiProvider(providerId: string): BuiltinPiProviderReference {
|
|
325
425
|
if (providerId.trim() === "") {
|
|
326
426
|
throw new Error("Built-in Pi provider id must not be empty");
|
|
@@ -328,6 +428,7 @@ export function builtinPiProvider(providerId: string): BuiltinPiProviderReferenc
|
|
|
328
428
|
return { kind: "builtin_pi_provider", providerId };
|
|
329
429
|
}
|
|
330
430
|
|
|
431
|
+
/** @internal */
|
|
331
432
|
export function configuredPiProvider<TConfig>(
|
|
332
433
|
providerId: string,
|
|
333
434
|
resolveModels: ConfiguredPiProviderReference<TConfig>["resolveModels"],
|
|
@@ -338,6 +439,7 @@ export function configuredPiProvider<TConfig>(
|
|
|
338
439
|
return { kind: "configured_pi_provider", providerId, resolveModels };
|
|
339
440
|
}
|
|
340
441
|
|
|
442
|
+
/** @public */
|
|
341
443
|
export type ModelProviderWorker<
|
|
342
444
|
TConfig = unknown,
|
|
343
445
|
TValue extends ProviderJsonObject = ProviderJsonObject,
|
|
@@ -346,43 +448,60 @@ export type ModelProviderWorker<
|
|
|
346
448
|
| BuiltinPiProviderReference
|
|
347
449
|
| ConfiguredPiProviderReference<TConfig>;
|
|
348
450
|
|
|
451
|
+
/** @public */
|
|
349
452
|
export type ModelProviderServer = PiServerReference | BuiltinPiProviderReference;
|
|
350
453
|
|
|
454
|
+
/** @public */
|
|
351
455
|
export interface ModelProviderSecretsContext<TConfig = unknown, TCredential = unknown> {
|
|
456
|
+
/** @internal */
|
|
352
457
|
readonly config: TConfig;
|
|
458
|
+
/** @public */
|
|
353
459
|
readonly credential: TCredential | null;
|
|
460
|
+
/** @internal */
|
|
354
461
|
readonly options: Readonly<Record<string, string>>;
|
|
355
462
|
}
|
|
356
463
|
|
|
464
|
+
/** @public */
|
|
357
465
|
export interface ParsedModelProviderConfig<TConfig = unknown, TCredential = unknown> {
|
|
358
|
-
/** Restart-scoped, non-secret provider configuration. */
|
|
466
|
+
/** Restart-scoped, non-secret provider configuration. @public */
|
|
359
467
|
readonly config: TConfig;
|
|
360
|
-
/** Optional credential used only to initialize an empty durable credential store. */
|
|
468
|
+
/** Optional credential used only to initialize an empty durable credential store. @internal */
|
|
361
469
|
readonly credential?: TCredential;
|
|
362
470
|
}
|
|
363
471
|
|
|
472
|
+
/** @public */
|
|
364
473
|
export interface ModelProviderCredentialDefinition<TCredential = unknown> {
|
|
365
|
-
/** Validates configured, durable, and worker-refreshed credential data. */
|
|
474
|
+
/** Validates configured, durable, and worker-refreshed credential data. @public */
|
|
366
475
|
parse?(value: unknown): TCredential;
|
|
367
476
|
}
|
|
368
477
|
|
|
478
|
+
/** @public */
|
|
369
479
|
export interface ModelProviderDefinition<
|
|
370
480
|
TConfig = unknown,
|
|
371
481
|
TCredential = unknown,
|
|
372
482
|
TWorkerConfig extends ProviderJsonObject = ProviderJsonObject,
|
|
373
483
|
> {
|
|
484
|
+
/** @public */
|
|
374
485
|
readonly id: string;
|
|
486
|
+
/** @public */
|
|
375
487
|
parseConfig(raw: unknown): ParsedModelProviderConfig<TConfig, TCredential>;
|
|
488
|
+
/** @public */
|
|
376
489
|
readonly worker: ModelProviderWorker<TConfig, TWorkerConfig>;
|
|
490
|
+
/** @public */
|
|
377
491
|
readonly server?: ModelProviderServer;
|
|
492
|
+
/** @public */
|
|
378
493
|
models(
|
|
379
494
|
ctx: ModelProviderModelsContext<TConfig>,
|
|
380
495
|
): readonly ProviderModelStatus[] | Promise<readonly ProviderModelStatus[]>;
|
|
496
|
+
/** @public */
|
|
381
497
|
readonly options?: ProviderOptionsDefinition<TConfig>;
|
|
498
|
+
/** @public */
|
|
382
499
|
secrets(ctx: ModelProviderSecretsContext<TConfig, TCredential>): Readonly<Record<string, string>>;
|
|
500
|
+
/** @public */
|
|
383
501
|
readonly credential?: ModelProviderCredentialDefinition<TCredential>;
|
|
384
502
|
}
|
|
385
503
|
|
|
504
|
+
/** @public */
|
|
386
505
|
export function defineModelProvider<
|
|
387
506
|
TConfig = unknown,
|
|
388
507
|
TCredential = unknown,
|
|
@@ -396,42 +515,65 @@ export function defineModelProvider<
|
|
|
396
515
|
return definition;
|
|
397
516
|
}
|
|
398
517
|
|
|
399
|
-
/** Type-erased provider definition used after its typed boundary has been established. */
|
|
518
|
+
/** Type-erased provider definition used after its typed boundary has been established. @public */
|
|
400
519
|
// biome-ignore lint/suspicious/noExplicitAny: provider sets intentionally erase provider-owned generic types
|
|
401
520
|
export type ErasedModelProviderDefinition = ModelProviderDefinition<any, any, any>;
|
|
402
521
|
|
|
522
|
+
/** @public */
|
|
403
523
|
export interface ModelProviderSetEntry {
|
|
524
|
+
/** @public */
|
|
404
525
|
readonly definition: ErasedModelProviderDefinition;
|
|
405
|
-
/** Owner-scoped fragment passed to this provider's parseConfig(). */
|
|
526
|
+
/** Owner-scoped fragment passed to this provider's parseConfig(). @public */
|
|
406
527
|
readonly rawConfig: unknown;
|
|
407
528
|
}
|
|
408
529
|
|
|
409
|
-
/** Resolves every provider owned by one extension from its owner-scoped configuration. */
|
|
530
|
+
/** Resolves every provider owned by one extension from its owner-scoped configuration. @public */
|
|
410
531
|
export type ModelProviderSet = (ownerConfig: unknown) => readonly ModelProviderSetEntry[];
|
|
411
532
|
|
|
533
|
+
/** @public */
|
|
412
534
|
export function defineModelProviders(resolve: ModelProviderSet): ModelProviderSet {
|
|
413
535
|
return resolve;
|
|
414
536
|
}
|
|
415
537
|
|
|
538
|
+
/** @public */
|
|
416
539
|
export interface PiWorkerSecretBag {
|
|
540
|
+
/** @public */
|
|
417
541
|
get(key: string): string | undefined;
|
|
542
|
+
/** @public */
|
|
418
543
|
require(key: string): string;
|
|
544
|
+
/** @public */
|
|
419
545
|
keys(): readonly string[];
|
|
420
546
|
}
|
|
421
547
|
|
|
548
|
+
/** @public */
|
|
422
549
|
export interface PiWorkerContributionContext {
|
|
423
|
-
|
|
550
|
+
/** @public */
|
|
551
|
+
readonly model: {
|
|
552
|
+
/** @public */
|
|
553
|
+
readonly providerId: string;
|
|
554
|
+
/** @public */
|
|
555
|
+
readonly modelId: string;
|
|
556
|
+
};
|
|
557
|
+
/** @public */
|
|
424
558
|
readonly options: Readonly<Record<string, string>>;
|
|
559
|
+
/** @public */
|
|
425
560
|
readonly workerConfig: ProviderJsonObject | null;
|
|
561
|
+
/** @public */
|
|
426
562
|
readonly secrets: PiWorkerSecretBag;
|
|
563
|
+
/** @public */
|
|
427
564
|
report(event: Readonly<Record<string, ProviderJsonValue>>): void;
|
|
428
565
|
}
|
|
429
566
|
|
|
567
|
+
/** @public */
|
|
430
568
|
export type PiWorkerContribution = (
|
|
431
|
-
pi: {
|
|
569
|
+
pi: {
|
|
570
|
+
/** @public */
|
|
571
|
+
registerProvider(name: string, config: object): void;
|
|
572
|
+
},
|
|
432
573
|
ctx: PiWorkerContributionContext,
|
|
433
574
|
) => void | Promise<void>;
|
|
434
575
|
|
|
576
|
+
/** @public */
|
|
435
577
|
export function definePiWorker(contribution: PiWorkerContribution): PiWorkerContribution {
|
|
436
578
|
return contribution;
|
|
437
579
|
}
|
|
@@ -441,21 +583,15 @@ export function definePiWorker(contribution: PiWorkerContribution): PiWorkerCont
|
|
|
441
583
|
* on credential status. Providers that do not perform runtime model probing can
|
|
442
584
|
* delegate their `models()` callback to this helper.
|
|
443
585
|
*/
|
|
586
|
+
/** @public */
|
|
444
587
|
export function credentialBasedModelStatuses(
|
|
445
588
|
configuredModels: readonly ConfiguredProviderModel[],
|
|
446
589
|
credentialStatus: ProviderCredentialStatus,
|
|
447
590
|
unavailableReason: string,
|
|
448
591
|
): readonly ProviderModelStatus[] {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
statuses.push({
|
|
455
|
-
modelId: configured.modelId,
|
|
456
|
-
availability: credentialStatus.available ? "available" : "unavailable",
|
|
457
|
-
...(credentialStatus.available ? {} : { safeReason: unavailableReason }),
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
return statuses;
|
|
592
|
+
return [...new Set(configuredModels.map((configured) => configured.modelId))].map((modelId) => ({
|
|
593
|
+
modelId,
|
|
594
|
+
availability: credentialStatus.available ? "available" : "unavailable",
|
|
595
|
+
...(credentialStatus.available ? {} : { safeReason: unavailableReason }),
|
|
596
|
+
}));
|
|
461
597
|
}
|
package/src/pi-config.ts
CHANGED
|
@@ -9,10 +9,14 @@ import {
|
|
|
9
9
|
type ResolvedProcessPiConfig,
|
|
10
10
|
} from "./types.js";
|
|
11
11
|
|
|
12
|
+
/** @internal */
|
|
12
13
|
type TemplateScalar = string | number | boolean;
|
|
14
|
+
/** @internal */
|
|
13
15
|
type TemplateValue = TemplateScalar | TemplateContext | readonly TemplateValue[] | undefined;
|
|
14
16
|
|
|
17
|
+
/** @internal */
|
|
15
18
|
export interface TemplateContext {
|
|
19
|
+
/** @internal */
|
|
16
20
|
[key: string]: TemplateValue;
|
|
17
21
|
}
|
|
18
22
|
|
|
@@ -33,18 +37,30 @@ function toTemplateContextRecord(value: unknown): TemplateContext {
|
|
|
33
37
|
return context;
|
|
34
38
|
}
|
|
35
39
|
|
|
40
|
+
/** @internal */
|
|
36
41
|
export function createTemplateContext(input: {
|
|
42
|
+
/** @internal */
|
|
37
43
|
params?: unknown;
|
|
44
|
+
/** @internal */
|
|
38
45
|
process?: {
|
|
46
|
+
/** @internal */
|
|
39
47
|
processId?: string | null;
|
|
48
|
+
/** @internal */
|
|
40
49
|
externalId?: string | null;
|
|
50
|
+
/** @internal */
|
|
41
51
|
externalUrl?: string | null;
|
|
52
|
+
/** @internal */
|
|
42
53
|
selectedTurnId?: string | null;
|
|
43
54
|
};
|
|
55
|
+
/** @internal */
|
|
44
56
|
projects?: ReadonlyArray<{
|
|
57
|
+
/** @internal */
|
|
45
58
|
key: string;
|
|
59
|
+
/** @internal */
|
|
46
60
|
repoLocator: string;
|
|
61
|
+
/** @internal */
|
|
47
62
|
baseBranch: string;
|
|
63
|
+
/** @internal */
|
|
48
64
|
workBranch?: string | null;
|
|
49
65
|
}>;
|
|
50
66
|
}): TemplateContext {
|
|
@@ -67,18 +83,31 @@ export function createTemplateContext(input: {
|
|
|
67
83
|
return context;
|
|
68
84
|
}
|
|
69
85
|
|
|
86
|
+
/** @internal */
|
|
70
87
|
export function interpolateTemplate(template: string, context: TemplateContext): string {
|
|
71
88
|
return Mustache.render(template, context);
|
|
72
89
|
}
|
|
73
90
|
|
|
91
|
+
/** @internal */
|
|
74
92
|
type TurnToolDefinitionLike =
|
|
75
|
-
| {
|
|
76
|
-
|
|
93
|
+
| {
|
|
94
|
+
/** @internal */
|
|
95
|
+
kind: "llm";
|
|
96
|
+
/** @internal */
|
|
97
|
+
availableTools: readonly PiBuiltInToolName[];
|
|
98
|
+
}
|
|
99
|
+
| {
|
|
100
|
+
/** @internal */
|
|
101
|
+
kind: string;
|
|
102
|
+
};
|
|
77
103
|
|
|
104
|
+
/** @internal */
|
|
78
105
|
type ProcessTurnBindingLike = {
|
|
106
|
+
/** @internal */
|
|
79
107
|
definition: TurnToolDefinitionLike;
|
|
80
108
|
};
|
|
81
109
|
|
|
110
|
+
/** @internal */
|
|
82
111
|
type ProcessToolSource = TurnToolDefinitionLike | ProcessTurnBindingLike;
|
|
83
112
|
|
|
84
113
|
function isTurnDefinitionSource(source: ProcessToolSource): source is TurnToolDefinitionLike {
|
|
@@ -89,6 +118,7 @@ function resolveToolSourceDefinition(source: ProcessToolSource): TurnToolDefinit
|
|
|
89
118
|
return isTurnDefinitionSource(source) ? source : source.definition;
|
|
90
119
|
}
|
|
91
120
|
|
|
121
|
+
/** @internal */
|
|
92
122
|
export function validatePiBuiltInToolArray(
|
|
93
123
|
toolNames: readonly unknown[],
|
|
94
124
|
context: string,
|
|
@@ -124,8 +154,11 @@ export function validatePiBuiltInToolArray(
|
|
|
124
154
|
return errors;
|
|
125
155
|
}
|
|
126
156
|
|
|
157
|
+
/** @internal */
|
|
127
158
|
export function resolveTurnAvailableToolNames(input: {
|
|
159
|
+
/** @internal */
|
|
128
160
|
turnId: string;
|
|
161
|
+
/** @internal */
|
|
129
162
|
turnDef: LlmTurnDefinition<string, unknown, unknown>;
|
|
130
163
|
}): string[] {
|
|
131
164
|
const errors = validatePiBuiltInToolArray(
|
|
@@ -138,6 +171,7 @@ export function resolveTurnAvailableToolNames(input: {
|
|
|
138
171
|
return [...input.turnDef.availableTools];
|
|
139
172
|
}
|
|
140
173
|
|
|
174
|
+
/** @internal */
|
|
141
175
|
export function collectProcessAvailableToolNames(
|
|
142
176
|
turns: Iterable<ProcessToolSource> | undefined,
|
|
143
177
|
): string[] {
|
|
@@ -196,11 +230,17 @@ Guidelines:
|
|
|
196
230
|
- Show file paths clearly when working with files.`;
|
|
197
231
|
}
|
|
198
232
|
|
|
233
|
+
/** @internal */
|
|
199
234
|
export function resolveProcessPiConfig(input: {
|
|
235
|
+
/** @internal */
|
|
200
236
|
processId: string;
|
|
237
|
+
/** @internal */
|
|
201
238
|
processPiConfig?: ProcessPiConfig;
|
|
239
|
+
/** @internal */
|
|
202
240
|
turns?: Iterable<ProcessToolSource>;
|
|
241
|
+
/** @internal */
|
|
203
242
|
configSnapshot?: ConfigSnapshot;
|
|
243
|
+
/** @internal */
|
|
204
244
|
templateContext: TemplateContext;
|
|
205
245
|
}): ResolvedProcessPiConfig {
|
|
206
246
|
const processConfig = input.configSnapshot?.process_configs?.[input.processId];
|
|
@@ -233,15 +273,11 @@ export function resolveProcessPiConfig(input: {
|
|
|
233
273
|
};
|
|
234
274
|
}
|
|
235
275
|
|
|
236
|
-
export
|
|
237
|
-
turnId: string;
|
|
238
|
-
turnDef: LlmTurnDefinition<string, unknown, unknown>;
|
|
239
|
-
}): string[] {
|
|
240
|
-
return resolveTurnAvailableToolNames(input);
|
|
241
|
-
}
|
|
276
|
+
export { resolveTurnAvailableToolNames as resolveTurnActiveToolNames };
|
|
242
277
|
|
|
243
278
|
// Mirror Pi's PI_CODING_AGENT_DIR expansion semantics from
|
|
244
279
|
// pi-mono/packages/coding-agent/src/config.ts.
|
|
280
|
+
/** @internal */
|
|
245
281
|
export function expandPiAgentDir(agentDir: string): string {
|
|
246
282
|
if (agentDir === "~") {
|
|
247
283
|
return homedir();
|
|
@@ -252,9 +288,13 @@ export function expandPiAgentDir(agentDir: string): string {
|
|
|
252
288
|
return agentDir;
|
|
253
289
|
}
|
|
254
290
|
|
|
291
|
+
/** @internal */
|
|
255
292
|
export function resolvePiAgentDir(options: {
|
|
293
|
+
/** @internal */
|
|
256
294
|
agentDir?: string | null;
|
|
295
|
+
/** @internal */
|
|
257
296
|
configSnapshot?: ConfigSnapshot;
|
|
297
|
+
/** @internal */
|
|
258
298
|
fallbackDir: string;
|
|
259
299
|
}): string {
|
|
260
300
|
const configuredAgentDir =
|