@leitwerk-dev/showcase-processes 0.2.0 → 0.3.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/README.md +10 -0
- package/dist/file-external.d.ts +14 -1
- package/dist/file-external.d.ts.map +1 -1
- package/dist/filesystem-watcher.d.ts +12 -1
- package/dist/filesystem-watcher.d.ts.map +1 -1
- package/dist/index.d.ts +2 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +53 -54
- package/dist/index.js.map +1 -1
- package/dist/poem-leaf-outcome.d.ts +31 -0
- package/dist/poem-leaf-outcome.d.ts.map +1 -1
- package/dist/process-definition.d.ts +21 -8
- package/dist/process-definition.d.ts.map +1 -1
- package/dist/testing/harness.d.ts +13 -0
- package/dist/testing/harness.d.ts.map +1 -0
- package/dist/trigger-files.d.ts +15 -0
- package/dist/trigger-files.d.ts.map +1 -0
- package/dist/turns/external-complete.d.ts +5 -0
- package/dist/turns/external-complete.d.ts.map +1 -1
- package/dist/turns/poem-creator.d.ts +12 -0
- package/dist/turns/poem-creator.d.ts.map +1 -1
- package/dist/turns/run-single-prompt.d.ts +6 -0
- package/dist/turns/run-single-prompt.d.ts.map +1 -1
- package/dist/ui/assets/leaf-outcome-element.js +12 -0
- package/dist/ui/assets/leaf-outcome-element.js.map +1 -1
- package/dist/ui/assets/poem-leaf-outcome-element.js +12 -0
- package/dist/ui/assets/poem-leaf-outcome-element.js.map +1 -1
- package/package.json +4 -4
- package/src/file-external.ts +13 -7
- package/src/filesystem-watcher.ts +14 -7
- package/src/index.ts +15 -10
- package/src/poem-leaf-outcome.ts +31 -0
- package/src/process-definition.ts +31 -5
- package/src/testing/harness.ts +105 -0
- package/src/trigger-files.ts +47 -0
- package/src/turns/external-complete.ts +5 -0
- package/src/turns/poem-creator.ts +12 -0
- package/src/turns/run-single-prompt.ts +6 -0
package/README.md
CHANGED
|
@@ -69,3 +69,13 @@ Review, Assess Poem, and Review Feedback for the poem process. The human
|
|
|
69
69
|
review and automated assessment remain distinct; turn ids and routing are unchanged.
|
|
70
70
|
|
|
71
71
|
Poem review outcomes publish their existing concise summary separately from the full review result. This adds no turn or model call and leaves human review routing unchanged.
|
|
72
|
+
|
|
73
|
+
## API support
|
|
74
|
+
|
|
75
|
+
The following exported declarations are `@public`:
|
|
76
|
+
|
|
77
|
+
- `@leitwerk-dev/showcase-processes`: `default`.
|
|
78
|
+
|
|
79
|
+
See the [SDK compatibility policy](../../docs/process-sdk.md#api-compatibility) for member classifications and support guarantees.
|
|
80
|
+
|
|
81
|
+
Filesystem trigger helpers are internal to this extension. A missing file is ignored; a failed admission retains the trigger file for a later poll.
|
package/dist/file-external.d.ts
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import type { CoreServerSetupDeps, ExternalActionSource } from "@leitwerk-dev/process-sdk";
|
|
2
2
|
import { type PollResult } from "@leitwerk-dev/watcher-utils";
|
|
3
|
+
/** @internal */
|
|
3
4
|
export type FileExternalConsumeMode = "delete" | "keep";
|
|
5
|
+
/** @internal */
|
|
4
6
|
export interface FileExternalInput {
|
|
7
|
+
/** @internal */
|
|
5
8
|
path: string;
|
|
9
|
+
/** @internal */
|
|
6
10
|
pollInterval: string;
|
|
11
|
+
/** @internal */
|
|
7
12
|
consume: FileExternalConsumeMode;
|
|
8
13
|
}
|
|
14
|
+
/** @internal */
|
|
9
15
|
export declare const FILE_EXTERNAL_PRESENCE_KIND = "@leitwerk-dev/showcase-processes.file.presence";
|
|
16
|
+
/** @internal */
|
|
10
17
|
export declare const FILE_EXTERNAL_INSTRUCTION_KIND = "@leitwerk-dev/showcase-processes.file.instruction";
|
|
18
|
+
/** @internal */
|
|
11
19
|
export declare const fileExternal: {
|
|
20
|
+
/** @internal */
|
|
12
21
|
presence(input: FileExternalInput): ExternalActionSource;
|
|
22
|
+
/** @internal */
|
|
13
23
|
instruction(input: FileExternalInput): ExternalActionSource;
|
|
14
24
|
};
|
|
15
|
-
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare function createFileExternalSourceProvider(deps: CoreServerSetupDeps, aliases?: Partial<Record<string, string>>): {
|
|
27
|
+
poll(): Promise<PollResult>;
|
|
28
|
+
};
|
|
16
29
|
//# sourceMappingURL=file-external.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-external.d.ts","sourceRoot":"","sources":["../src/file-external.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,mBAAmB,EACnB,oBAAoB,EAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"file-external.d.ts","sourceRoot":"","sources":["../src/file-external.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,mBAAmB,EACnB,oBAAoB,EAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAmB,KAAK,UAAU,EAAmB,MAAM,6BAA6B,CAAC;AAGhG,gBAAgB;AAChB,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAExD,gBAAgB;AAChB,MAAM,WAAW,iBAAiB;IACjC,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,OAAO,EAAE,uBAAuB,CAAC;CACjC;AAED,gBAAgB;AAChB,eAAO,MAAM,2BAA2B,mDAAmD,CAAC;AAC5F,gBAAgB;AAChB,eAAO,MAAM,8BAA8B,sDAAsD,CAAC;AA4BlG,gBAAgB;AAChB,eAAO,MAAM,YAAY;IACxB,gBAAgB;oBACA,iBAAiB,GAAG,oBAAoB;IAaxD,gBAAgB;uBACG,iBAAiB,GAAG,oBAAoB;CAa3D,CAAC;AA0IF,gBAAgB;AAChB,wBAAgB,gCAAgC,CAC/C,IAAI,EAAE,mBAAmB,EACzB,OAAO,GAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;;EAwC7C"}
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import type { CoreServerSetupDeps } from "@leitwerk-dev/process-sdk";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export interface FilesystemWatcherEvent {
|
|
4
|
+
/** @internal */
|
|
3
5
|
filePath: string;
|
|
6
|
+
/** @internal */
|
|
4
7
|
content: string;
|
|
5
8
|
}
|
|
9
|
+
/** @internal */
|
|
6
10
|
export interface FilesystemWatcherConfig {
|
|
11
|
+
/** @internal */
|
|
7
12
|
pollInterval: string;
|
|
13
|
+
/** @internal */
|
|
8
14
|
filePath: string;
|
|
9
15
|
}
|
|
16
|
+
/** @internal */
|
|
10
17
|
export declare const filesystemWatcherSource: import("@leitwerk-dev/process-sdk").ProcessWatcherSource<FilesystemWatcherConfig, FilesystemWatcherEvent>;
|
|
18
|
+
/** @internal */
|
|
11
19
|
export declare function createFilesystemWatcherProvider(deps: CoreServerSetupDeps): {
|
|
12
|
-
|
|
20
|
+
/** @internal */
|
|
21
|
+
pollers: {
|
|
22
|
+
poll(): Promise<import("@leitwerk-dev/watcher-utils").PollResult>;
|
|
23
|
+
}[];
|
|
13
24
|
};
|
|
14
25
|
//# sourceMappingURL=filesystem-watcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem-watcher.d.ts","sourceRoot":"","sources":["../src/filesystem-watcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"filesystem-watcher.d.ts","sourceRoot":"","sources":["../src/filesystem-watcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAQrE,gBAAgB;AAChB,MAAM,WAAW,sBAAsB;IACtC,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB;IAChB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,gBAAgB;AAChB,MAAM,WAAW,uBAAuB;IACvC,gBAAgB;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAgBD,gBAAgB;AAChB,eAAO,MAAM,uBAAuB,2GAoClC,CAAC;AAEH,gBAAgB;AAChB,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,mBAAmB;IAqCvE,gBAAgB;;;;EAGjB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import type { LeitwerkExtensionModule } from "@leitwerk-dev/process-sdk";
|
|
2
|
-
|
|
3
|
-
file_triggers?: {
|
|
4
|
-
poll_interval?: string;
|
|
5
|
-
poem_review_path?: string;
|
|
6
|
-
complete_prompt_path?: string;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export declare const manifest: {
|
|
10
|
-
readonly id: "showcase-processes";
|
|
11
|
-
readonly version: "0.1.0";
|
|
12
|
-
};
|
|
2
|
+
/** @public */
|
|
13
3
|
declare const singlePromptExtension: LeitwerkExtensionModule;
|
|
14
4
|
export default singlePromptExtension;
|
|
15
|
-
export
|
|
16
|
-
export * from "./filesystem-watcher.js";
|
|
17
|
-
export * from "./poem-leaf-outcome.js";
|
|
18
|
-
export * from "./process-definition.js";
|
|
19
|
-
export * from "./turns/external-complete.js";
|
|
20
|
-
export * from "./turns/poem-creator.js";
|
|
21
|
-
export * from "./turns/run-single-prompt.js";
|
|
5
|
+
export { buildPoemLeafOutcomeFallbackMarkdown, buildPoemLeafOutcomePayload, } from "./poem-leaf-outcome.js";
|
|
22
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AA0CzE,cAAc;AACd,QAAA,MAAM,qBAAqB,EAAE,uBA4B5B,CAAC;AAEF,eAAe,qBAAqB,CAAC;AACrC,OAAO,EACN,oCAAoC,EACpC,2BAA2B,GAC3B,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,39 @@
|
|
|
2
2
|
import { coreHostCapabilities } from "@leitwerk-dev/process-sdk";
|
|
3
3
|
|
|
4
4
|
// src/file-external.ts
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { emptyPollResult, parseDurationMs } from "@leitwerk-dev/watcher-utils";
|
|
6
|
+
|
|
7
|
+
// src/trigger-files.ts
|
|
8
|
+
import { readFile, unlink } from "fs/promises";
|
|
9
|
+
function errorCode(error) {
|
|
10
|
+
if (typeof error !== "object" || error === null || !("code" in error)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const code = error.code;
|
|
14
|
+
return typeof code === "string" ? code : null;
|
|
15
|
+
}
|
|
16
|
+
async function readTriggerFile(filePath) {
|
|
17
|
+
try {
|
|
18
|
+
return { exists: true, content: await readFile(filePath, "utf8") };
|
|
19
|
+
} catch (error) {
|
|
20
|
+
if (errorCode(error) === "ENOENT") {
|
|
21
|
+
return { exists: false };
|
|
22
|
+
}
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function consumeTriggerFile(filePath) {
|
|
27
|
+
try {
|
|
28
|
+
await unlink(filePath);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (errorCode(error) === "ENOENT") {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/file-external.ts
|
|
11
38
|
var FILE_EXTERNAL_PRESENCE_KIND = "@leitwerk-dev/showcase-processes.file.presence";
|
|
12
39
|
var FILE_EXTERNAL_INSTRUCTION_KIND = "@leitwerk-dev/showcase-processes.file.instruction";
|
|
13
40
|
function normalizeConfig(input) {
|
|
@@ -30,6 +57,7 @@ function fileLabel(kind, path) {
|
|
|
30
57
|
return kind === "presence" ? `File present: ${path}` : `File instruction: ${path}`;
|
|
31
58
|
}
|
|
32
59
|
var fileExternal = {
|
|
60
|
+
/** @internal */
|
|
33
61
|
presence(input) {
|
|
34
62
|
const config = normalizeConfig(input);
|
|
35
63
|
return {
|
|
@@ -43,6 +71,7 @@ var fileExternal = {
|
|
|
43
71
|
}
|
|
44
72
|
};
|
|
45
73
|
},
|
|
74
|
+
/** @internal */
|
|
46
75
|
instruction(input) {
|
|
47
76
|
const config = normalizeConfig(input);
|
|
48
77
|
return {
|
|
@@ -210,12 +239,7 @@ import {
|
|
|
210
239
|
defineProcessWatcherSource,
|
|
211
240
|
parseProcessWatcherLaunchModelConfig
|
|
212
241
|
} from "@leitwerk-dev/process-sdk";
|
|
213
|
-
import {
|
|
214
|
-
consumeTriggerFile as consumeTriggerFile2,
|
|
215
|
-
emptyPollResult as emptyPollResult2,
|
|
216
|
-
parseDurationMs as parseDurationMs2,
|
|
217
|
-
readTriggerFile as readTriggerFile2
|
|
218
|
-
} from "@leitwerk-dev/watcher-utils";
|
|
242
|
+
import { emptyPollResult as emptyPollResult2, parseDurationMs as parseDurationMs2 } from "@leitwerk-dev/watcher-utils";
|
|
219
243
|
function record(value, subject) {
|
|
220
244
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
221
245
|
throw new Error(`${subject} must be an object`);
|
|
@@ -272,7 +296,7 @@ function createFilesystemWatcherProvider(deps) {
|
|
|
272
296
|
defaultIntervalMs: 1e3,
|
|
273
297
|
async pollOnce() {
|
|
274
298
|
const result = emptyPollResult2();
|
|
275
|
-
const file = await
|
|
299
|
+
const file = await readTriggerFile(watcher.config.filePath);
|
|
276
300
|
if (!file.exists || file.content.trim() === "") return result;
|
|
277
301
|
const content = file.content.trim();
|
|
278
302
|
const sourceEventKey = createHash("sha256").update(`${watcher.config.filePath}\0${content}`).digest("hex");
|
|
@@ -284,7 +308,7 @@ function createFilesystemWatcherProvider(deps) {
|
|
|
284
308
|
}
|
|
285
309
|
);
|
|
286
310
|
if (launched.process) {
|
|
287
|
-
await
|
|
311
|
+
await consumeTriggerFile(watcher.config.filePath);
|
|
288
312
|
result.created.push(launched.process.id);
|
|
289
313
|
}
|
|
290
314
|
if (launched.error) {
|
|
@@ -296,7 +320,10 @@ function createFilesystemWatcherProvider(deps) {
|
|
|
296
320
|
}
|
|
297
321
|
})
|
|
298
322
|
);
|
|
299
|
-
return {
|
|
323
|
+
return {
|
|
324
|
+
/** @internal */
|
|
325
|
+
pollers
|
|
326
|
+
};
|
|
300
327
|
}
|
|
301
328
|
|
|
302
329
|
// src/process-definition.ts
|
|
@@ -394,19 +421,22 @@ function buildPoemLeafOutcomeFallbackMarkdown(input) {
|
|
|
394
421
|
}
|
|
395
422
|
|
|
396
423
|
// src/turns/external-complete.ts
|
|
397
|
-
var externalCompleteActionId = "complete_external_prompt";
|
|
398
424
|
var externalPromptCompletionTurnId = "await_external_prompt_completion";
|
|
399
425
|
var externalPromptCompletionTurnDescription = "Wait for an external completion trigger after the single prompt finishes";
|
|
400
|
-
var externalPromptCompletionTriggerLabel = "Configured prompt-complete file";
|
|
401
|
-
var externalPromptCompletionTriggerDescription = "Write any content to the configured prompt-complete trigger file (default: /tmp/complete-prompt) to complete the process. The file is removed after a successful completion.";
|
|
402
426
|
|
|
403
427
|
// src/turns/poem-creator.ts
|
|
404
428
|
var poemCreatorActionIds = {
|
|
429
|
+
/** @internal */
|
|
405
430
|
completePoem: "complete_poem",
|
|
431
|
+
/** @internal */
|
|
406
432
|
requestRevision: "request_poem_revision",
|
|
433
|
+
/** @internal */
|
|
407
434
|
runAutoReview: "run_poem_auto_review",
|
|
435
|
+
/** @internal */
|
|
408
436
|
acceptReview: "accept_poem_review",
|
|
437
|
+
/** @internal */
|
|
409
438
|
requestReviewChanges: "request_poem_review_changes",
|
|
439
|
+
/** @internal */
|
|
410
440
|
dismissReview: "dismiss_poem_review"
|
|
411
441
|
};
|
|
412
442
|
function formatGermanyDay(now) {
|
|
@@ -1059,7 +1089,7 @@ var poemReviewFeedbackSpec = flow.human(poemTurnIds.poemReviewFeedback).descript
|
|
|
1059
1089
|
})
|
|
1060
1090
|
}))
|
|
1061
1091
|
).definition;
|
|
1062
|
-
var
|
|
1092
|
+
var poemCreatorProcessDefinition = flow.process("poem_creator_process").displayName("Poem Creator").entry(poemTurnIds.draftPoem).codecs({
|
|
1063
1093
|
params: promptProcessParamsCodec,
|
|
1064
1094
|
state: poemCreatorStateCodec
|
|
1065
1095
|
}).initialState(() => ({
|
|
@@ -1167,10 +1197,13 @@ ${message}` : reviewInstruction;
|
|
|
1167
1197
|
};
|
|
1168
1198
|
}
|
|
1169
1199
|
}).define();
|
|
1200
|
+
var poemCreatorProcess = poemCreatorProcessDefinition;
|
|
1170
1201
|
|
|
1171
1202
|
// src/index.ts
|
|
1172
1203
|
var manifest = {
|
|
1204
|
+
/** @internal */
|
|
1173
1205
|
id: "showcase-processes",
|
|
1206
|
+
/** @internal */
|
|
1174
1207
|
version: "0.1.0"
|
|
1175
1208
|
};
|
|
1176
1209
|
var fileTriggerDefaults = {
|
|
@@ -1209,42 +1242,8 @@ var singlePromptExtension = {
|
|
|
1209
1242
|
};
|
|
1210
1243
|
var index_default = singlePromptExtension;
|
|
1211
1244
|
export {
|
|
1212
|
-
FILE_EXTERNAL_INSTRUCTION_KIND,
|
|
1213
|
-
FILE_EXTERNAL_PRESENCE_KIND,
|
|
1214
|
-
buildDefaultPoemPrompt,
|
|
1215
|
-
buildDraftPoemInstruction,
|
|
1216
1245
|
buildPoemLeafOutcomeFallbackMarkdown,
|
|
1217
1246
|
buildPoemLeafOutcomePayload,
|
|
1218
|
-
|
|
1219
|
-
buildRevisePoemInstruction,
|
|
1220
|
-
buildSinglePromptInstruction,
|
|
1221
|
-
buildSinglePromptWithToolInstruction,
|
|
1222
|
-
createFileExternalSourceProvider,
|
|
1223
|
-
createFilesystemWatcherProvider,
|
|
1224
|
-
createRunSinglePromptTurn,
|
|
1225
|
-
createRunSinglePromptWithToolTurn,
|
|
1226
|
-
index_default as default,
|
|
1227
|
-
externalCompleteActionId,
|
|
1228
|
-
externalPromptCompletionTriggerDescription,
|
|
1229
|
-
externalPromptCompletionTriggerLabel,
|
|
1230
|
-
externalPromptCompletionTurnDescription,
|
|
1231
|
-
externalPromptCompletionTurnId,
|
|
1232
|
-
extractLeafEntryMarkdown,
|
|
1233
|
-
fileExternal,
|
|
1234
|
-
filesystemWatcherSource,
|
|
1235
|
-
k8sSmokeLongProcess,
|
|
1236
|
-
k8sSmokeProcess,
|
|
1237
|
-
k8sSmokeSpecializedProcess,
|
|
1238
|
-
leaveFeedbackToolRenderer,
|
|
1239
|
-
manifest,
|
|
1240
|
-
parsePoemLeafMarkdown,
|
|
1241
|
-
poemCreatorActionIds,
|
|
1242
|
-
poemCreatorProcess,
|
|
1243
|
-
resolvePoemLeafMarkdown,
|
|
1244
|
-
runSinglePrompt,
|
|
1245
|
-
runSinglePromptWithTool,
|
|
1246
|
-
singlePromptExternalCompleteProcess,
|
|
1247
|
-
singlePromptProcess,
|
|
1248
|
-
singlePromptWithToolProcess
|
|
1247
|
+
index_default as default
|
|
1249
1248
|
};
|
|
1250
1249
|
//# sourceMappingURL=index.js.map
|