@leitwerk-dev/server 0.1.7 → 0.1.9
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/app.d.ts.map +1 -1
- package/dist/app.js +24 -15
- package/dist/app.js.map +1 -1
- package/dist/{chunk-GIWHTJSL.js → chunk-2ESDXLNE.js} +228 -101
- package/dist/chunk-2ESDXLNE.js.map +1 -0
- package/dist/{chunk-OO6VH4FX.js → chunk-DFHOPJRZ.js} +405 -259
- package/dist/chunk-DFHOPJRZ.js.map +1 -0
- package/dist/config/config-loader.d.ts.map +1 -1
- package/dist/config/config-loader.js +14 -25
- package/dist/config/config-loader.js.map +1 -1
- package/dist/config/config-types.d.ts +5 -17
- package/dist/config/config-types.d.ts.map +1 -1
- package/dist/db/skill-repo.d.ts +2 -2
- package/dist/db/skill-repo.d.ts.map +1 -1
- package/dist/db/skill-repo.js +24 -32
- package/dist/db/skill-repo.js.map +1 -1
- package/dist/external-source-service.d.ts.map +1 -1
- package/dist/external-source-service.js +5 -2
- package/dist/external-source-service.js.map +1 -1
- package/dist/future-execution/execution.d.ts +1 -1
- package/dist/future-execution/execution.d.ts.map +1 -1
- package/dist/future-execution/execution.js +1 -13
- package/dist/future-execution/execution.js.map +1 -1
- package/dist/integration-tool-registry.js +1 -1
- package/dist/integration-tool-registry.js.map +1 -1
- package/dist/model-providers/builtin-server-adapter.d.ts.map +1 -1
- package/dist/model-providers/builtin-server-adapter.js +10 -2
- package/dist/model-providers/builtin-server-adapter.js.map +1 -1
- package/dist/process-action-registry.d.ts +2 -4
- package/dist/process-action-registry.d.ts.map +1 -1
- package/dist/process-action-registry.js +31 -28
- package/dist/process-action-registry.js.map +1 -1
- package/dist/process-engine/engine.d.ts.map +1 -1
- package/dist/process-engine/engine.js +4 -4
- package/dist/process-engine/engine.js.map +1 -1
- package/dist/process-engine/operation.d.ts +4 -0
- package/dist/process-engine/operation.d.ts.map +1 -1
- package/dist/process-engine/ops/execute-action.d.ts.map +1 -1
- package/dist/process-engine/ops/execute-action.js +0 -3
- package/dist/process-engine/ops/execute-action.js.map +1 -1
- package/dist/process-engine/ops/worker-failure.d.ts +2 -0
- package/dist/process-engine/ops/worker-failure.d.ts.map +1 -1
- package/dist/process-engine/ops/worker-failure.js +2 -0
- package/dist/process-engine/ops/worker-failure.js.map +1 -1
- package/dist/process-engine/runner.d.ts +2 -2
- package/dist/process-engine/runner.d.ts.map +1 -1
- package/dist/process-engine/runner.js +13 -1
- package/dist/process-engine/runner.js.map +1 -1
- package/dist/process-engine/types.d.ts +10 -4
- package/dist/process-engine/types.d.ts.map +1 -1
- package/dist/process-engine/writes/build-server-transition-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-server-transition-writes.js +2 -8
- package/dist/process-engine/writes/build-server-transition-writes.js.map +1 -1
- package/dist/process-engine/writes/build-turn-outcome-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-outcome-writes.js +1 -2
- package/dist/process-engine/writes/build-turn-outcome-writes.js.map +1 -1
- package/dist/process-engine/writes/build-turn-selection-writes.d.ts +1 -2
- package/dist/process-engine/writes/build-turn-selection-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-turn-selection-writes.js +1 -57
- package/dist/process-engine/writes/build-turn-selection-writes.js.map +1 -1
- package/dist/process-engine/writes/build-worker-failure-writes.d.ts +3 -1
- package/dist/process-engine/writes/build-worker-failure-writes.d.ts.map +1 -1
- package/dist/process-engine/writes/build-worker-failure-writes.js +2 -1
- package/dist/process-engine/writes/build-worker-failure-writes.js.map +1 -1
- package/dist/process-launch-executor.d.ts +6 -4
- package/dist/process-launch-executor.d.ts.map +1 -1
- package/dist/process-launch-executor.js +16 -1
- package/dist/process-launch-executor.js.map +1 -1
- package/dist/process-launch-plan.d.ts.map +1 -1
- package/dist/process-launch-plan.js +1 -0
- package/dist/process-launch-plan.js.map +1 -1
- package/dist/process-operator-attention.d.ts +1 -1
- package/dist/process-operator-attention.d.ts.map +1 -1
- package/dist/process-operator-attention.js +1 -1
- package/dist/process-operator-attention.js.map +1 -1
- package/dist/process-ui-snapshot-presenter.d.ts.map +1 -1
- package/dist/process-ui-snapshot-presenter.js +24 -3
- package/dist/process-ui-snapshot-presenter.js.map +1 -1
- package/dist/process-watcher-registry.d.ts.map +1 -1
- package/dist/process-watcher-registry.js +13 -5
- package/dist/process-watcher-registry.js.map +1 -1
- package/dist/routes/skills.d.ts.map +1 -1
- package/dist/routes/skills.js +1 -2
- package/dist/routes/skills.js.map +1 -1
- package/dist/server-automatic-turn-drainer.d.ts.map +1 -1
- package/dist/server-automatic-turn-drainer.js +15 -0
- package/dist/server-automatic-turn-drainer.js.map +1 -1
- package/dist/server-bootstrap/build-host-capabilities.d.ts.map +1 -1
- package/dist/server-bootstrap/build-host-capabilities.js +1 -0
- package/dist/server-bootstrap/build-host-capabilities.js.map +1 -1
- package/dist/skills/skill-frontmatter.d.ts +4 -0
- package/dist/skills/skill-frontmatter.d.ts.map +1 -0
- package/dist/skills/skill-frontmatter.js +13 -0
- package/dist/skills/skill-frontmatter.js.map +1 -0
- package/dist/skills/source-importer.d.ts +2 -3
- package/dist/skills/source-importer.d.ts.map +1 -1
- package/dist/skills/source-importer.js +16 -62
- package/dist/skills/source-importer.js.map +1 -1
- package/dist/supervisor/accepted-turn-start-replay.d.ts +9 -0
- package/dist/supervisor/accepted-turn-start-replay.d.ts.map +1 -0
- package/dist/supervisor/accepted-turn-start-replay.js +23 -0
- package/dist/supervisor/accepted-turn-start-replay.js.map +1 -0
- package/dist/supervisor/ipc-handler.d.ts +9 -0
- package/dist/supervisor/ipc-handler.d.ts.map +1 -1
- package/dist/supervisor/ipc-handler.js +9 -4
- package/dist/supervisor/ipc-handler.js.map +1 -1
- package/dist/supervisor/stale-heartbeat-watchdog.d.ts +1 -1
- package/dist/supervisor/stale-heartbeat-watchdog.d.ts.map +1 -1
- package/dist/supervisor/stale-heartbeat-watchdog.js +47 -5
- package/dist/supervisor/stale-heartbeat-watchdog.js.map +1 -1
- package/dist/supervisor/worker-event-ingestor.d.ts.map +1 -1
- package/dist/supervisor/worker-event-ingestor.js +16 -0
- package/dist/supervisor/worker-event-ingestor.js.map +1 -1
- package/dist/supervisor/worker-start-payload-builder.d.ts +2 -4
- package/dist/supervisor/worker-start-payload-builder.d.ts.map +1 -1
- package/dist/supervisor/worker-start-payload-builder.js +3 -1
- package/dist/supervisor/worker-start-payload-builder.js.map +1 -1
- package/dist/supervisor/worker-supervisor.d.ts +4 -5
- package/dist/supervisor/worker-supervisor.d.ts.map +1 -1
- package/dist/supervisor/worker-supervisor.js +31 -0
- package/dist/supervisor/worker-supervisor.js.map +1 -1
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts +12 -3
- package/dist/supervisor/worker-turn-ipc-recorder.d.ts.map +1 -1
- package/dist/supervisor/worker-turn-ipc-recorder.js +129 -33
- package/dist/supervisor/worker-turn-ipc-recorder.js.map +1 -1
- package/dist/supervisor/worker-websocket-ipc.d.ts.map +1 -1
- package/dist/supervisor/worker-websocket-ipc.js +20 -10
- package/dist/supervisor/worker-websocket-ipc.js.map +1 -1
- package/dist/test-helpers/fake-worker-supervisor.d.ts.map +1 -1
- package/dist/test-helpers/fake-worker-supervisor.js +4 -0
- package/dist/test-helpers/fake-worker-supervisor.js.map +1 -1
- package/dist/test-helpers/ipc-handler-harness.d.ts.map +1 -1
- package/dist/test-helpers/ipc-handler-harness.js +1 -20
- package/dist/test-helpers/ipc-handler-harness.js.map +1 -1
- package/dist/test-helpers/process-fixtures.d.ts +1 -1
- package/dist/test-helpers/process-fixtures.d.ts.map +1 -1
- package/dist/test-helpers/process-fixtures.js +0 -6
- package/dist/test-helpers/process-fixtures.js.map +1 -1
- package/dist/turn-progress.d.ts +12 -0
- package/dist/turn-progress.d.ts.map +1 -0
- package/dist/turn-progress.js +108 -0
- package/dist/turn-progress.js.map +1 -0
- package/dist/{writes-DUwQe8MD.d.ts → writes-DNXpryd0.d.ts} +68 -36
- package/package.json +10 -10
- package/src/app.ts +25 -15
- package/src/config/config-loader.ts +33 -25
- package/src/config/config-types.ts +6 -13
- package/src/db/skill-repo.ts +26 -36
- package/src/external-source-service.ts +5 -2
- package/src/future-execution/execution.ts +2 -13
- package/src/integration-tool-registry.ts +1 -1
- package/src/model-providers/builtin-server-adapter.ts +10 -2
- package/src/process-action-registry.ts +48 -40
- package/src/process-engine/engine.ts +6 -4
- package/src/process-engine/operation.ts +5 -0
- package/src/process-engine/ops/execute-action.ts +0 -3
- package/src/process-engine/ops/worker-failure.ts +4 -0
- package/src/process-engine/runner.ts +13 -0
- package/src/process-engine/types.ts +14 -2
- package/src/process-engine/writes/build-server-transition-writes.ts +1 -14
- package/src/process-engine/writes/build-turn-outcome-writes.ts +1 -2
- package/src/process-engine/writes/build-turn-selection-writes.ts +0 -75
- package/src/process-engine/writes/build-worker-failure-writes.ts +4 -1
- package/src/process-launch-executor.ts +24 -15
- package/src/process-launch-plan.ts +1 -0
- package/src/process-operator-attention.ts +7 -3
- package/src/process-ui-snapshot-presenter.ts +24 -6
- package/src/process-watcher-registry.ts +15 -5
- package/src/routes/skills.ts +1 -3
- package/src/server-automatic-turn-drainer.ts +20 -1
- package/src/server-bootstrap/build-host-capabilities.ts +1 -0
- package/src/skills/skill-frontmatter.ts +13 -0
- package/src/skills/source-importer.ts +20 -82
- package/src/supervisor/accepted-turn-start-replay.ts +40 -0
- package/src/supervisor/ipc-handler.ts +18 -4
- package/src/supervisor/stale-heartbeat-watchdog.ts +55 -6
- package/src/supervisor/worker-event-ingestor.ts +15 -0
- package/src/supervisor/worker-start-payload-builder.ts +5 -2
- package/src/supervisor/worker-supervisor.ts +43 -4
- package/src/supervisor/worker-turn-ipc-recorder.ts +185 -46
- package/src/supervisor/worker-websocket-ipc.ts +28 -13
- package/src/test-helpers/fake-worker-supervisor.ts +4 -0
- package/src/test-helpers/ipc-handler-harness.ts +1 -22
- package/src/test-helpers/process-fixtures.ts +1 -6
- package/src/turn-progress.ts +114 -0
- package/dist/chunk-GIWHTJSL.js.map +0 -1
- package/dist/chunk-OO6VH4FX.js.map +0 -1
- package/dist/skills/catalog-sync.d.ts +0 -9
- package/dist/skills/catalog-sync.d.ts.map +0 -1
- package/dist/skills/catalog-sync.js +0 -7
- package/dist/skills/catalog-sync.js.map +0 -1
- package/src/skills/catalog-sync.ts +0 -13
|
@@ -6,6 +6,7 @@ var __export = (target2, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/config/config-loader.ts
|
|
8
8
|
import { existsSync, readFileSync } from "fs";
|
|
9
|
+
import { isIP } from "net";
|
|
9
10
|
import { resolve } from "path";
|
|
10
11
|
import { parseDurationMs } from "@leitwerk-dev/watcher-utils";
|
|
11
12
|
import { createDefu } from "defu";
|
|
@@ -189,20 +190,20 @@ var authConfigSchema = v.looseObject({
|
|
|
189
190
|
allowlist: v.optional(stringArraySchema)
|
|
190
191
|
});
|
|
191
192
|
var safeSkillIdSchema = v.pipe(v.string(), v.regex(SAFE_SKILL_ID_PATTERN));
|
|
192
|
-
var
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
193
|
+
var kubernetesHostAliasIpSchema = v.pipe(
|
|
194
|
+
v.string(),
|
|
195
|
+
v.nonEmpty(),
|
|
196
|
+
v.check((value) => isIP(value) !== 0, "Expected an IPv4 or IPv6 address")
|
|
197
|
+
);
|
|
198
|
+
var kubernetesHostnameSchema = v.pipe(
|
|
199
|
+
v.string(),
|
|
200
|
+
v.nonEmpty(),
|
|
201
|
+
v.maxLength(253),
|
|
202
|
+
v.regex(
|
|
203
|
+
/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/u,
|
|
204
|
+
"Expected a lowercase DNS hostname"
|
|
205
|
+
)
|
|
206
|
+
);
|
|
206
207
|
var skillRepositorySchema = v.strictObject({
|
|
207
208
|
id: safeSkillIdSchema,
|
|
208
209
|
label: v.optional(v.pipe(v.string(), v.nonEmpty())),
|
|
@@ -211,7 +212,6 @@ var skillRepositorySchema = v.strictObject({
|
|
|
211
212
|
path: v.optional(v.pipe(v.string(), v.nonEmpty()))
|
|
212
213
|
});
|
|
213
214
|
var configSchema = v.looseObject({
|
|
214
|
-
skills: v.optional(v.array(skillSchema)),
|
|
215
215
|
skill_repositories: v.optional(v.array(skillRepositorySchema)),
|
|
216
216
|
commit_messages: v.optional(
|
|
217
217
|
v.strictObject({
|
|
@@ -373,7 +373,15 @@ var configSchema = v.looseObject({
|
|
|
373
373
|
v.looseObject({
|
|
374
374
|
node_selector: v.optional(v.record(v.string(), v.string())),
|
|
375
375
|
tolerations: v.optional(v.array(v.unknown())),
|
|
376
|
-
annotations: v.optional(v.record(v.string(), v.string()))
|
|
376
|
+
annotations: v.optional(v.record(v.string(), v.string())),
|
|
377
|
+
host_aliases: v.optional(
|
|
378
|
+
v.array(
|
|
379
|
+
v.strictObject({
|
|
380
|
+
ip: kubernetesHostAliasIpSchema,
|
|
381
|
+
hostnames: v.pipe(v.array(kubernetesHostnameSchema), v.nonEmpty())
|
|
382
|
+
})
|
|
383
|
+
)
|
|
384
|
+
)
|
|
377
385
|
})
|
|
378
386
|
),
|
|
379
387
|
image_pull_secrets: v.optional(stringArraySchema),
|
|
@@ -745,6 +753,7 @@ function hasOwnKey(value, key) {
|
|
|
745
753
|
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.hasOwn(value, key);
|
|
746
754
|
}
|
|
747
755
|
function collectLegacyConfigKeyErrors(config) {
|
|
756
|
+
const errors = Object.hasOwn(config, "skills") ? ["skills was removed; configure Git sources through skill_repositories"] : [];
|
|
748
757
|
const legacyKeys = [
|
|
749
758
|
{
|
|
750
759
|
section: "pi",
|
|
@@ -757,7 +766,10 @@ function collectLegacyConfigKeyErrors(config) {
|
|
|
757
766
|
message: "local_worker.process_volume_root was removed; remove the key because local workers use storage.process_workspaces_dir and storage.tree_files_dir directly"
|
|
758
767
|
}
|
|
759
768
|
];
|
|
760
|
-
|
|
769
|
+
errors.push(
|
|
770
|
+
...legacyKeys.filter(({ section, key }) => hasOwnKey(config[section], key)).map(({ message }) => message)
|
|
771
|
+
);
|
|
772
|
+
return errors;
|
|
761
773
|
}
|
|
762
774
|
function collectCommitMessageConfigErrors(config) {
|
|
763
775
|
const section = config.commit_messages;
|
|
@@ -800,12 +812,7 @@ function validateResolvedConfig(config) {
|
|
|
800
812
|
return shapeErrors;
|
|
801
813
|
}
|
|
802
814
|
const resolvedConfig = config;
|
|
803
|
-
const skillIds = /* @__PURE__ */ new Set();
|
|
804
815
|
const skillErrors = [];
|
|
805
|
-
for (const skill of resolvedConfig.skills ?? []) {
|
|
806
|
-
if (skillIds.has(skill.id)) skillErrors.push(`Duplicate skill id '${skill.id}' at skills`);
|
|
807
|
-
skillIds.add(skill.id);
|
|
808
|
-
}
|
|
809
816
|
const repositoryIds = /* @__PURE__ */ new Set();
|
|
810
817
|
for (const repository of resolvedConfig.skill_repositories ?? []) {
|
|
811
818
|
if (repositoryIds.has(repository.id)) {
|
|
@@ -869,7 +876,6 @@ function sanitizeConfigForLogging(value, path2 = []) {
|
|
|
869
876
|
}
|
|
870
877
|
function getDefaultConfig() {
|
|
871
878
|
return {
|
|
872
|
-
skills: [],
|
|
873
879
|
skill_repositories: [],
|
|
874
880
|
commit_messages: {
|
|
875
881
|
templates: {},
|
|
@@ -966,7 +972,7 @@ function getDefaultConfig() {
|
|
|
966
972
|
access_modes: ["ReadWriteOnce"],
|
|
967
973
|
mount_path: "/state"
|
|
968
974
|
},
|
|
969
|
-
pod: { node_selector: {}, tolerations: [], annotations: {} },
|
|
975
|
+
pod: { node_selector: {}, tolerations: [], annotations: {}, host_aliases: [] },
|
|
970
976
|
image_pull_secrets: [],
|
|
971
977
|
image_pull_secret_copies: []
|
|
972
978
|
},
|
|
@@ -2803,13 +2809,13 @@ import { and as and7, asc as asc5, count as count2, desc as desc6, eq as eq9, in
|
|
|
2803
2809
|
|
|
2804
2810
|
// src/launch-title.ts
|
|
2805
2811
|
var MAX_PROCESS_TITLE_LENGTH = 80;
|
|
2806
|
-
function truncateTextAtWordBoundary(value,
|
|
2807
|
-
if (value.length <=
|
|
2812
|
+
function truncateTextAtWordBoundary(value, maxLength2) {
|
|
2813
|
+
if (value.length <= maxLength2) {
|
|
2808
2814
|
return value;
|
|
2809
2815
|
}
|
|
2810
|
-
const sliced = value.slice(0, Math.max(1,
|
|
2816
|
+
const sliced = value.slice(0, Math.max(1, maxLength2 - 1)).trimEnd();
|
|
2811
2817
|
const lastWhitespace = sliced.lastIndexOf(" ");
|
|
2812
|
-
const base = lastWhitespace >= Math.floor(
|
|
2818
|
+
const base = lastWhitespace >= Math.floor(maxLength2 * 0.6) ? sliced.slice(0, lastWhitespace) : sliced;
|
|
2813
2819
|
return `${base.trimEnd()}\u2026`;
|
|
2814
2820
|
}
|
|
2815
2821
|
function normalizeProcessTitleInput(value) {
|
|
@@ -3951,6 +3957,19 @@ function referencedSkillIds(markdown, availableSkillIds) {
|
|
|
3951
3957
|
return explicitSkillReferenceIds(markdown).filter((id) => availableSkillIds.has(id));
|
|
3952
3958
|
}
|
|
3953
3959
|
|
|
3960
|
+
// src/skills/skill-frontmatter.ts
|
|
3961
|
+
import { parseFrontmatter } from "@earendil-works/pi-coding-agent";
|
|
3962
|
+
function skillFrontmatter(markdown) {
|
|
3963
|
+
try {
|
|
3964
|
+
return parseFrontmatter(markdown).frontmatter;
|
|
3965
|
+
} catch {
|
|
3966
|
+
return {};
|
|
3967
|
+
}
|
|
3968
|
+
}
|
|
3969
|
+
function isSkillModelInvocable(markdown) {
|
|
3970
|
+
return skillFrontmatter(markdown)["disable-model-invocation"] !== true;
|
|
3971
|
+
}
|
|
3972
|
+
|
|
3954
3973
|
// src/db/skill-repo.ts
|
|
3955
3974
|
function revisionForBundle(db, item, timestamp) {
|
|
3956
3975
|
const existing = db.select({ id: skillRevisions.id }).from(skillRevisions).where(
|
|
@@ -4016,8 +4035,14 @@ function candidateSummaries(db) {
|
|
|
4016
4035
|
sourcePath: skillCatalogEntries.sourcePath,
|
|
4017
4036
|
sourceRevision: skillCatalogEntries.sourceRevision,
|
|
4018
4037
|
bundleDigest: skillCatalogEntries.bundleDigest,
|
|
4038
|
+
bundleBytes: skillCatalogEntries.bundleBytes,
|
|
4019
4039
|
available: skillCatalogEntries.available
|
|
4020
|
-
}).from(skillCatalogEntries).all()
|
|
4040
|
+
}).from(skillCatalogEntries).all().map((candidate2) => ({
|
|
4041
|
+
...candidate2,
|
|
4042
|
+
modelInvocable: isSkillModelInvocable(
|
|
4043
|
+
skillMarkdown(candidate2.skillId, candidate2.bundleBytes, candidate2.bundleDigest)
|
|
4044
|
+
)
|
|
4045
|
+
}));
|
|
4021
4046
|
}
|
|
4022
4047
|
function processUsage(db, skillId) {
|
|
4023
4048
|
return db.select({
|
|
@@ -4069,13 +4094,13 @@ function recordRevisionDependencies(db, revisionId, markdown) {
|
|
|
4069
4094
|
db.insert(skillRevisionDependencies).values({ skillRevisionId: revisionId, dependencySkillId, position }).run();
|
|
4070
4095
|
}
|
|
4071
4096
|
}
|
|
4072
|
-
function activateSkill(db, item,
|
|
4097
|
+
function activateSkill(db, item, timestamp, markdown = skillMarkdown(item.skillId, item.bundle.bytes, item.bundle.digest)) {
|
|
4073
4098
|
db.insert(skills).values({
|
|
4074
4099
|
id: item.skillId,
|
|
4075
4100
|
label: item.label,
|
|
4076
4101
|
description: item.description,
|
|
4077
4102
|
activeRevisionId: null,
|
|
4078
|
-
registrationKind,
|
|
4103
|
+
registrationKind: "catalog",
|
|
4079
4104
|
createdAt: timestamp,
|
|
4080
4105
|
updatedAt: timestamp
|
|
4081
4106
|
}).onConflictDoNothing().run();
|
|
@@ -4085,7 +4110,7 @@ function activateSkill(db, item, registrationKind, timestamp, markdown = skillMa
|
|
|
4085
4110
|
label: item.label,
|
|
4086
4111
|
description: item.description,
|
|
4087
4112
|
activeRevisionId: revisionId,
|
|
4088
|
-
registrationKind,
|
|
4113
|
+
registrationKind: "catalog",
|
|
4089
4114
|
updatedAt: timestamp
|
|
4090
4115
|
}).where(eq18(skills.id, item.skillId)).run();
|
|
4091
4116
|
return revisionId;
|
|
@@ -4099,15 +4124,12 @@ function catalogView(db) {
|
|
|
4099
4124
|
description: skills.description,
|
|
4100
4125
|
activeRevisionId: skillRevisions.id,
|
|
4101
4126
|
activeSourceRevision: skillRevisions.sourceRevision,
|
|
4102
|
-
activeDigest: skillRevisions.bundleDigest
|
|
4103
|
-
|
|
4104
|
-
}).from(skills).innerJoin(skillRevisions, eq18(skills.activeRevisionId, skillRevisions.id)).orderBy(asc12(skills.label), asc12(skills.id)).all();
|
|
4127
|
+
activeDigest: skillRevisions.bundleDigest
|
|
4128
|
+
}).from(skills).innerJoin(skillRevisions, eq18(skills.activeRevisionId, skillRevisions.id)).where(eq18(skills.registrationKind, "catalog")).orderBy(asc12(skills.label), asc12(skills.id)).all();
|
|
4105
4129
|
const installedById = new Map(installedRows.map((row) => [row.id, row]));
|
|
4106
4130
|
const availableSkills = candidates.map((candidate2) => {
|
|
4107
4131
|
const active = installedById.get(candidate2.skillId);
|
|
4108
|
-
const registered =
|
|
4109
|
-
active?.registrationKind === "catalog" && active.activeDigest === candidate2.bundleDigest
|
|
4110
|
-
);
|
|
4132
|
+
const registered = active?.activeDigest === candidate2.bundleDigest;
|
|
4111
4133
|
return {
|
|
4112
4134
|
repositoryId: candidate2.repositoryId,
|
|
4113
4135
|
id: candidate2.skillId,
|
|
@@ -4116,11 +4138,9 @@ function catalogView(db) {
|
|
|
4116
4138
|
sourcePath: candidate2.sourcePath,
|
|
4117
4139
|
sourceRevision: candidate2.sourceRevision,
|
|
4118
4140
|
registered,
|
|
4119
|
-
updateAvailable: Boolean(
|
|
4120
|
-
candidate2.available && active?.registrationKind === "catalog" && !registered
|
|
4121
|
-
),
|
|
4122
|
-
conflict: candidate2.available && active?.registrationKind === "configuration",
|
|
4141
|
+
updateAvailable: Boolean(candidate2.available && active && !registered),
|
|
4123
4142
|
stale: !candidate2.available,
|
|
4143
|
+
modelInvocable: candidate2.modelInvocable,
|
|
4124
4144
|
usage: usage.get(candidate2.skillId) ?? emptyUsage()
|
|
4125
4145
|
};
|
|
4126
4146
|
});
|
|
@@ -4136,9 +4156,9 @@ function catalogView(db) {
|
|
|
4136
4156
|
description: skill.description,
|
|
4137
4157
|
activeRevisionId: skill.activeRevisionId,
|
|
4138
4158
|
activeSourceRevision: skill.activeSourceRevision,
|
|
4139
|
-
registrationKind: skill.registrationKind,
|
|
4140
4159
|
sourceRepositoryId: matching.length === 1 ? matching[0]?.repositoryId ?? null : activeSource.length === 1 ? activeSource[0]?.repositoryId ?? null : null,
|
|
4141
|
-
updateAvailable:
|
|
4160
|
+
updateAvailable: available.length === 1 && available[0]?.bundleDigest !== skill.activeDigest,
|
|
4161
|
+
modelInvocable: activeSource[0]?.modelInvocable ?? true,
|
|
4142
4162
|
usage: usage.get(skill.id) ?? emptyUsage()
|
|
4143
4163
|
};
|
|
4144
4164
|
});
|
|
@@ -4174,15 +4194,10 @@ function createSkillRepo(db) {
|
|
|
4174
4194
|
for (const id of ids) add(id);
|
|
4175
4195
|
return [...resolved.values()];
|
|
4176
4196
|
},
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
if (old.registrationKind === "configuration" && !configured.has(old.id)) {
|
|
4182
|
-
db.update(skills).set({ activeRevisionId: null, updatedAt: timestamp }).where(eq18(skills.id, old.id)).run();
|
|
4183
|
-
}
|
|
4184
|
-
}
|
|
4185
|
-
for (const item of imported) activateSkill(db, item, "configuration", timestamp);
|
|
4197
|
+
deactivateConfiguredSkills() {
|
|
4198
|
+
db.update(skills).set({ activeRevisionId: null, updatedAt: now() }).where(
|
|
4199
|
+
and14(eq18(skills.registrationKind, "configuration"), isNotNull(skills.activeRevisionId))
|
|
4200
|
+
).run();
|
|
4186
4201
|
},
|
|
4187
4202
|
backfillDependencies() {
|
|
4188
4203
|
for (const revision of db.select().from(skillRevisions).all()) {
|
|
@@ -4212,7 +4227,7 @@ function createSkillRepo(db) {
|
|
|
4212
4227
|
label: item.label,
|
|
4213
4228
|
description: item.description,
|
|
4214
4229
|
sourcePath: item.sourcePath,
|
|
4215
|
-
sourceRevision: item.sourceRevision
|
|
4230
|
+
sourceRevision: item.sourceRevision,
|
|
4216
4231
|
bundleDigest: item.bundle.digest,
|
|
4217
4232
|
bundleBytes: Buffer.from(item.bundle.bytes),
|
|
4218
4233
|
discoveredAt: timestamp,
|
|
@@ -4246,10 +4261,6 @@ function createSkillRepo(db) {
|
|
|
4246
4261
|
`Remote skill '${requestedRepositoryId ? `${requestedRepositoryId}/` : ""}${id}' is no longer available`
|
|
4247
4262
|
);
|
|
4248
4263
|
}
|
|
4249
|
-
const current = db.select().from(skills).where(eq18(skills.id, id)).get();
|
|
4250
|
-
if (current?.activeRevisionId && current.registrationKind === "configuration") {
|
|
4251
|
-
throw new Error(`Skill '${id}' is managed by configuration`);
|
|
4252
|
-
}
|
|
4253
4264
|
visiting.add(id);
|
|
4254
4265
|
const markdown = skillMarkdown(id, candidate2.bundleBytes, candidate2.bundleDigest);
|
|
4255
4266
|
for (const dependencyId of referencedSkillIds(markdown, availableIds)) {
|
|
@@ -4265,7 +4276,6 @@ function createSkillRepo(db) {
|
|
|
4265
4276
|
bundle: { digest: candidate2.bundleDigest, bytes: candidate2.bundleBytes },
|
|
4266
4277
|
sourceRevision: candidate2.sourceRevision
|
|
4267
4278
|
},
|
|
4268
|
-
"catalog",
|
|
4269
4279
|
timestamp,
|
|
4270
4280
|
markdown
|
|
4271
4281
|
);
|
|
@@ -4279,7 +4289,7 @@ function createSkillRepo(db) {
|
|
|
4279
4289
|
},
|
|
4280
4290
|
remove(skillId) {
|
|
4281
4291
|
const current = db.select().from(skills).where(eq18(skills.id, skillId)).get();
|
|
4282
|
-
if (!current?.activeRevisionId
|
|
4292
|
+
if (!current?.activeRevisionId) return false;
|
|
4283
4293
|
db.update(skills).set({ activeRevisionId: null, updatedAt: now() }).where(eq18(skills.id, skillId)).run();
|
|
4284
4294
|
return true;
|
|
4285
4295
|
},
|
|
@@ -4526,7 +4536,9 @@ function createAllRepos(db, options = {}) {
|
|
|
4526
4536
|
// src/process-action-registry.ts
|
|
4527
4537
|
import {
|
|
4528
4538
|
createServerProcessBuilder,
|
|
4539
|
+
getExternalActionArmingId,
|
|
4529
4540
|
getExternalSourceTransitionId,
|
|
4541
|
+
isAutomaticTurnDefinition,
|
|
4530
4542
|
isExternalTurnDefinition,
|
|
4531
4543
|
isHumanTurnDefinition,
|
|
4532
4544
|
resolveHumanTurnView,
|
|
@@ -4543,15 +4555,6 @@ function resolveProcessContextData(processDef, process2) {
|
|
|
4543
4555
|
function getTurnReviewSemanticRef(turnDef) {
|
|
4544
4556
|
return "reviewSemanticRef" in turnDef ? turnDef.reviewSemanticRef ?? null : null;
|
|
4545
4557
|
}
|
|
4546
|
-
function getTurnReviewSubject(turnDef) {
|
|
4547
|
-
if (isHumanTurnDefinition(turnDef)) {
|
|
4548
|
-
return turnDef.reviewSubject ?? null;
|
|
4549
|
-
}
|
|
4550
|
-
if (isExternalTurnDefinition(turnDef)) {
|
|
4551
|
-
return turnDef.reviewSubject ?? null;
|
|
4552
|
-
}
|
|
4553
|
-
return turnDef.reviewSubject ?? null;
|
|
4554
|
-
}
|
|
4555
4558
|
function getProcessTurnBinding(processDef, turnId) {
|
|
4556
4559
|
return processDef?.turns.get(turnId);
|
|
4557
4560
|
}
|
|
@@ -4563,18 +4566,9 @@ function resolveCurrentTurnForProcess(processDef, process2) {
|
|
|
4563
4566
|
if (!selectedTurn) {
|
|
4564
4567
|
return null;
|
|
4565
4568
|
}
|
|
4566
|
-
|
|
4567
|
-
if (!selectedTurnReviewSubject) {
|
|
4568
|
-
return { turnId: process2.selectedTurnId, turnDef: selectedTurn };
|
|
4569
|
-
}
|
|
4570
|
-
const { state } = resolveProcessContextData(processDef, process2);
|
|
4571
|
-
const currentReviewSubject = state.reviewSubject ?? null;
|
|
4572
|
-
if (!currentReviewSubject || currentReviewSubject.kind === selectedTurnReviewSubject.kind) {
|
|
4573
|
-
return { turnId: process2.selectedTurnId, turnDef: selectedTurn };
|
|
4574
|
-
}
|
|
4575
|
-
return null;
|
|
4569
|
+
return { turnId: process2.selectedTurnId, turnDef: selectedTurn };
|
|
4576
4570
|
}
|
|
4577
|
-
function listExternalTriggers(turnId, turnDef) {
|
|
4571
|
+
function listExternalTriggers(turnId, turnDef, ctx) {
|
|
4578
4572
|
if (isHumanTurnDefinition(turnDef)) {
|
|
4579
4573
|
const view = resolveHumanTurnView({ turnId, turn: turnDef });
|
|
4580
4574
|
return [
|
|
@@ -4584,7 +4578,10 @@ function listExternalTriggers(turnId, turnDef) {
|
|
|
4584
4578
|
label: trigger.label,
|
|
4585
4579
|
description: trigger.description
|
|
4586
4580
|
})),
|
|
4587
|
-
...view.externalActions.
|
|
4581
|
+
...view.externalActions.filter((action) => {
|
|
4582
|
+
const definition = turnDef.externalActions?.[action.externalActionId];
|
|
4583
|
+
return !definition?.when || definition.when(ctx);
|
|
4584
|
+
}).map((action) => ({
|
|
4588
4585
|
id: action.id,
|
|
4589
4586
|
externalActionId: action.externalActionId,
|
|
4590
4587
|
kind: action.sourceKind,
|
|
@@ -4602,6 +4599,16 @@ function listExternalTriggers(turnId, turnDef) {
|
|
|
4602
4599
|
description: transition.source.description ?? null
|
|
4603
4600
|
}));
|
|
4604
4601
|
}
|
|
4602
|
+
if (isAutomaticTurnDefinition(turnDef) && ctx.process.lifecycleStatus === "waiting") {
|
|
4603
|
+
return Object.entries(turnDef.externalActions ?? {}).filter(([, action]) => !action.when || action.when(ctx)).map(([externalActionId, action]) => ({
|
|
4604
|
+
id: getExternalActionArmingId({ turnId, externalActionId }),
|
|
4605
|
+
externalActionId,
|
|
4606
|
+
kind: action.source.kind,
|
|
4607
|
+
sourceKind: action.source.kind,
|
|
4608
|
+
label: action.label ?? action.source.label ?? null,
|
|
4609
|
+
description: action.description ?? action.source.description ?? null
|
|
4610
|
+
}));
|
|
4611
|
+
}
|
|
4605
4612
|
return [];
|
|
4606
4613
|
}
|
|
4607
4614
|
function resolveCurrentVisibleActionForProcess(processDef, process2, actionId) {
|
|
@@ -4626,17 +4633,23 @@ function isTurnScopedActionForProcess(processDef, actionId) {
|
|
|
4626
4633
|
}
|
|
4627
4634
|
return false;
|
|
4628
4635
|
}
|
|
4629
|
-
function buildSelectedTurnSummaryForProcess(processDef, process2) {
|
|
4636
|
+
function buildSelectedTurnSummaryForProcess(processDef, process2, projects = []) {
|
|
4630
4637
|
const currentTurn = resolveCurrentTurnForProcess(processDef, process2);
|
|
4631
4638
|
if (!currentTurn) {
|
|
4632
4639
|
return null;
|
|
4633
4640
|
}
|
|
4641
|
+
const { params, state } = resolveProcessContextData(processDef, process2);
|
|
4634
4642
|
return {
|
|
4635
4643
|
turnId: currentTurn.turnId,
|
|
4636
4644
|
kind: currentTurn.turnDef.kind,
|
|
4637
4645
|
description: currentTurn.turnDef.description,
|
|
4638
4646
|
commentary: isHumanTurnDefinition(currentTurn.turnDef) ? currentTurn.turnDef.commentary ?? null : null,
|
|
4639
|
-
externalTriggers: listExternalTriggers(currentTurn.turnId, currentTurn.turnDef
|
|
4647
|
+
externalTriggers: listExternalTriggers(currentTurn.turnId, currentTurn.turnDef, {
|
|
4648
|
+
process: process2,
|
|
4649
|
+
projects,
|
|
4650
|
+
params,
|
|
4651
|
+
state
|
|
4652
|
+
})
|
|
4640
4653
|
};
|
|
4641
4654
|
}
|
|
4642
4655
|
function resolvePreviewDefinitionForProcess(processDef, process2, action, actionId) {
|
|
@@ -4749,7 +4762,6 @@ function resolveTurnScopedActionForProcess(processDef, process2, actionId, sourc
|
|
|
4749
4762
|
kind: "ui_human_action",
|
|
4750
4763
|
turnId: currentTurn.turnId,
|
|
4751
4764
|
turnType: "human",
|
|
4752
|
-
reviewSubject: currentTurn.turnDef.reviewSubject ?? null,
|
|
4753
4765
|
semanticEntryRefKey: getTurnReviewSemanticRef(currentTurn.turnDef),
|
|
4754
4766
|
acceptanceState: turnAction.acceptanceState
|
|
4755
4767
|
};
|
|
@@ -4766,7 +4778,6 @@ function resolveTurnScopedActionForProcess(processDef, process2, actionId, sourc
|
|
|
4766
4778
|
kind: "external_human_trigger",
|
|
4767
4779
|
turnId: currentTurn.turnId,
|
|
4768
4780
|
turnType: "external",
|
|
4769
|
-
reviewSubject: currentTurn.turnDef.reviewSubject ?? null,
|
|
4770
4781
|
semanticEntryRefKey: getTurnReviewSemanticRef(currentTurn.turnDef),
|
|
4771
4782
|
acceptanceState: matchingVisibleAction.acceptanceState,
|
|
4772
4783
|
externalTrigger: {
|
|
@@ -4827,8 +4838,8 @@ function buildProcessActionRegistry(catalog) {
|
|
|
4827
4838
|
}
|
|
4828
4839
|
return visible;
|
|
4829
4840
|
},
|
|
4830
|
-
getSelectedTurnSummary(processId, process2) {
|
|
4831
|
-
return buildSelectedTurnSummaryForProcess(processDefs.get(processId), process2);
|
|
4841
|
+
getSelectedTurnSummary(processId, process2, projects) {
|
|
4842
|
+
return buildSelectedTurnSummaryForProcess(processDefs.get(processId), process2, projects);
|
|
4832
4843
|
},
|
|
4833
4844
|
getServerDefinition(processId) {
|
|
4834
4845
|
return serverDefs.get(processId);
|
|
@@ -4955,9 +4966,9 @@ function extractToolResultValue(message) {
|
|
|
4955
4966
|
if ("details" in message && message.details !== void 0) {
|
|
4956
4967
|
return message.details;
|
|
4957
4968
|
}
|
|
4958
|
-
const
|
|
4959
|
-
if (
|
|
4960
|
-
return
|
|
4969
|
+
const text3 = extractPiSessionMessageText(message.content).trim();
|
|
4970
|
+
if (text3 !== "") {
|
|
4971
|
+
return text3;
|
|
4961
4972
|
}
|
|
4962
4973
|
return message.content ?? null;
|
|
4963
4974
|
}
|
|
@@ -5380,7 +5391,6 @@ import {
|
|
|
5380
5391
|
CONTINUE_PROMPT_METADATA_KEY,
|
|
5381
5392
|
DEFAULT_CONTINUE_PROMPT,
|
|
5382
5393
|
isProcessTurnType,
|
|
5383
|
-
isWorkerOwnedTurnType,
|
|
5384
5394
|
normalizeContinuePrompt,
|
|
5385
5395
|
readFailedTurnRecoveryContext
|
|
5386
5396
|
} from "@leitwerk-dev/domain";
|
|
@@ -5717,7 +5727,11 @@ function getSelectedTurnSummaryForProcess(deps, process2) {
|
|
|
5717
5727
|
if (!deps.processActionRegistry) {
|
|
5718
5728
|
return null;
|
|
5719
5729
|
}
|
|
5720
|
-
return deps.processActionRegistry.getSelectedTurnSummary(
|
|
5730
|
+
return deps.processActionRegistry.getSelectedTurnSummary(
|
|
5731
|
+
process2.processId,
|
|
5732
|
+
process2,
|
|
5733
|
+
deps.projects.listByInstance(process2.id)
|
|
5734
|
+
);
|
|
5721
5735
|
}
|
|
5722
5736
|
function getSelectedTurnDescription(deps, process2) {
|
|
5723
5737
|
const selectedTurnSummary = getSelectedTurnSummaryForProcess(deps, process2);
|
|
@@ -6849,6 +6863,100 @@ var ProcessPrimaryPathAssembler = class {
|
|
|
6849
6863
|
}
|
|
6850
6864
|
};
|
|
6851
6865
|
|
|
6866
|
+
// src/turn-progress.ts
|
|
6867
|
+
import { createDurableWsFrame } from "@leitwerk-dev/protocol";
|
|
6868
|
+
var STEP_STATUSES = /* @__PURE__ */ new Set([
|
|
6869
|
+
"incomplete",
|
|
6870
|
+
"in_progress",
|
|
6871
|
+
"completed",
|
|
6872
|
+
"failed"
|
|
6873
|
+
]);
|
|
6874
|
+
var LINK_KINDS = /* @__PURE__ */ new Set(["pull_request", "merge_request", "commit", "pipeline", "other"]);
|
|
6875
|
+
function text2(value, max2) {
|
|
6876
|
+
return typeof value === "string" ? value.trim().slice(0, max2) : "";
|
|
6877
|
+
}
|
|
6878
|
+
function safeExternalUrl(value) {
|
|
6879
|
+
const candidate2 = text2(value, 2e3);
|
|
6880
|
+
try {
|
|
6881
|
+
const url = new URL(candidate2);
|
|
6882
|
+
return (url.protocol === "https:" || url.protocol === "http:") && !url.username && !url.password ? url.toString() : "";
|
|
6883
|
+
} catch {
|
|
6884
|
+
return "";
|
|
6885
|
+
}
|
|
6886
|
+
}
|
|
6887
|
+
function normalizeTurnProgressReport(value) {
|
|
6888
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
6889
|
+
const raw = value;
|
|
6890
|
+
const title = text2(raw.title, 160);
|
|
6891
|
+
if (!title || !Array.isArray(raw.steps) || raw.steps.length > 50) return null;
|
|
6892
|
+
const ids = /* @__PURE__ */ new Set();
|
|
6893
|
+
const steps = raw.steps.flatMap((value2) => {
|
|
6894
|
+
if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) return [];
|
|
6895
|
+
const step = value2;
|
|
6896
|
+
const id = text2(step.id, 80);
|
|
6897
|
+
const label = text2(step.label, 240);
|
|
6898
|
+
const status = step.status;
|
|
6899
|
+
const detail = text2(step.detail, 1e3);
|
|
6900
|
+
if (!id || ids.has(id) || !label || !STEP_STATUSES.has(status)) {
|
|
6901
|
+
return [];
|
|
6902
|
+
}
|
|
6903
|
+
ids.add(id);
|
|
6904
|
+
return [
|
|
6905
|
+
{
|
|
6906
|
+
id,
|
|
6907
|
+
label,
|
|
6908
|
+
status,
|
|
6909
|
+
...detail ? { detail } : {}
|
|
6910
|
+
}
|
|
6911
|
+
];
|
|
6912
|
+
});
|
|
6913
|
+
if (steps.length !== raw.steps.length || steps.length === 0) return null;
|
|
6914
|
+
const linkIds = /* @__PURE__ */ new Set();
|
|
6915
|
+
const rawLinks = raw.links === void 0 ? [] : raw.links;
|
|
6916
|
+
if (!Array.isArray(rawLinks) || rawLinks.length > 20) return null;
|
|
6917
|
+
const links = rawLinks.flatMap((value2) => {
|
|
6918
|
+
if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) return [];
|
|
6919
|
+
const link = value2;
|
|
6920
|
+
const id = text2(link.id, 80);
|
|
6921
|
+
const label = text2(link.label, 240);
|
|
6922
|
+
const url = safeExternalUrl(link.url);
|
|
6923
|
+
const kind = text2(link.kind, 40);
|
|
6924
|
+
if (!id || linkIds.has(id) || !label || !url) return [];
|
|
6925
|
+
if (kind && !LINK_KINDS.has(kind)) return [];
|
|
6926
|
+
linkIds.add(id);
|
|
6927
|
+
return [
|
|
6928
|
+
{
|
|
6929
|
+
id,
|
|
6930
|
+
label,
|
|
6931
|
+
url,
|
|
6932
|
+
...kind ? { kind } : {}
|
|
6933
|
+
}
|
|
6934
|
+
];
|
|
6935
|
+
});
|
|
6936
|
+
if (links.length !== rawLinks.length) return null;
|
|
6937
|
+
return { title, steps, ...links.length > 0 ? { links } : {} };
|
|
6938
|
+
}
|
|
6939
|
+
function recordTurnProgress(deps, input) {
|
|
6940
|
+
const process2 = deps.processes.getById(input.instanceId);
|
|
6941
|
+
const turnRecord = deps.turnRecords.getById(input.turnRecordId);
|
|
6942
|
+
const report = normalizeTurnProgressReport(input.report);
|
|
6943
|
+
if (!process2 || !turnRecord || turnRecord.instanceId !== input.instanceId || turnRecord.status !== "running" || process2.selectedTurnId !== turnRecord.turnId || !report)
|
|
6944
|
+
return false;
|
|
6945
|
+
deps.events.create({
|
|
6946
|
+
instanceId: input.instanceId,
|
|
6947
|
+
eventType: "turn.progress",
|
|
6948
|
+
data: { turnRecordId: input.turnRecordId, report }
|
|
6949
|
+
});
|
|
6950
|
+
deps.broadcaster.broadcast(
|
|
6951
|
+
createDurableWsFrame({
|
|
6952
|
+
type: "process.event",
|
|
6953
|
+
instanceId: input.instanceId,
|
|
6954
|
+
payload: { eventType: "turn_progress", level: "info", message: "Turn progress updated" }
|
|
6955
|
+
})
|
|
6956
|
+
);
|
|
6957
|
+
return true;
|
|
6958
|
+
}
|
|
6959
|
+
|
|
6852
6960
|
// src/process-ui-snapshot-presenter.ts
|
|
6853
6961
|
var COMPACT_DETAIL_EVENT_TYPES = [
|
|
6854
6962
|
"turn_outcome_recorded",
|
|
@@ -6870,9 +6978,10 @@ function sortEventsAscending(events) {
|
|
|
6870
6978
|
});
|
|
6871
6979
|
}
|
|
6872
6980
|
function compactDetailEvents(deps, instanceId) {
|
|
6873
|
-
return sortEventsAscending(
|
|
6874
|
-
deps.events.listByInstanceEventTypes(instanceId, COMPACT_DETAIL_EVENT_TYPES, 1e3)
|
|
6875
|
-
|
|
6981
|
+
return sortEventsAscending([
|
|
6982
|
+
...deps.events.listByInstanceEventTypes(instanceId, COMPACT_DETAIL_EVENT_TYPES, 1e3),
|
|
6983
|
+
...deps.events.listByInstanceEventTypes(instanceId, ["turn.progress"], 1e4)
|
|
6984
|
+
]);
|
|
6876
6985
|
}
|
|
6877
6986
|
function compactPrimaryPathSnapshot(snapshot) {
|
|
6878
6987
|
return {
|
|
@@ -7037,6 +7146,16 @@ function annotationOutput(annotation) {
|
|
|
7037
7146
|
${value}` : "";
|
|
7038
7147
|
}).filter(Boolean).join("\n\n");
|
|
7039
7148
|
}
|
|
7149
|
+
function buildTurnProgressIndex(events) {
|
|
7150
|
+
const index2 = /* @__PURE__ */ new Map();
|
|
7151
|
+
for (const event of events) {
|
|
7152
|
+
if (event.eventType !== "turn.progress") continue;
|
|
7153
|
+
const turnRecordId = stringValue(event.data.turnRecordId);
|
|
7154
|
+
const report = normalizeTurnProgressReport(event.data.report);
|
|
7155
|
+
if (turnRecordId && report) index2.set(turnRecordId, report);
|
|
7156
|
+
}
|
|
7157
|
+
return index2;
|
|
7158
|
+
}
|
|
7040
7159
|
function actionSourceFromAnnotation(annotation) {
|
|
7041
7160
|
const source = annotation.payload.actionSource;
|
|
7042
7161
|
return source === "ui" || source === "external" || source === "scheduled" ? source : null;
|
|
@@ -7107,11 +7226,13 @@ function createCompletedTurnRecord(args) {
|
|
|
7107
7226
|
status: "completed",
|
|
7108
7227
|
modelProfileId: args.turnRecord.modelProfileId ?? null,
|
|
7109
7228
|
actionSource: args.actionSource,
|
|
7229
|
+
progress: args.progress,
|
|
7110
7230
|
...durableTurnLineage(args.turnRecord)
|
|
7111
7231
|
};
|
|
7112
7232
|
}
|
|
7113
7233
|
function presentProcessTimelineTurns(input) {
|
|
7114
7234
|
const outcomeEventsByTurnRecordId = createTurnOutcomeEventMap(input.events);
|
|
7235
|
+
const progressByTurnRecordId = buildTurnProgressIndex(input.events);
|
|
7115
7236
|
const milestoneAnnotationsByTurnRecordId = createTurnAnnotationMap(
|
|
7116
7237
|
input.turnAnnotations,
|
|
7117
7238
|
"turn_milestone"
|
|
@@ -7155,6 +7276,7 @@ function presentProcessTimelineTurns(input) {
|
|
|
7155
7276
|
status: "in_progress",
|
|
7156
7277
|
modelProfileId: turnRecord.modelProfileId ?? null,
|
|
7157
7278
|
actionSource: actionSourceByTurnRecordId.get(turnRecord.id) ?? null,
|
|
7279
|
+
progress: progressByTurnRecordId.get(turnRecord.id) ?? null,
|
|
7158
7280
|
...durableTurnLineage(turnRecord)
|
|
7159
7281
|
});
|
|
7160
7282
|
continue;
|
|
@@ -7210,7 +7332,8 @@ function presentProcessTimelineTurns(input) {
|
|
|
7210
7332
|
...presentation,
|
|
7211
7333
|
turnRecord,
|
|
7212
7334
|
turnResultMarkdown,
|
|
7213
|
-
actionSource: actionSourceByTurnRecordId.get(turnRecord.id) ?? null
|
|
7335
|
+
actionSource: actionSourceByTurnRecordId.get(turnRecord.id) ?? null,
|
|
7336
|
+
progress: progressByTurnRecordId.get(turnRecord.id) ?? null
|
|
7214
7337
|
})
|
|
7215
7338
|
);
|
|
7216
7339
|
}
|
|
@@ -7243,7 +7366,8 @@ function presentProcessTimelineTurns(input) {
|
|
|
7243
7366
|
parentTurnRecordId: null,
|
|
7244
7367
|
startedAt: input.process.updatedAt,
|
|
7245
7368
|
endedAt: null,
|
|
7246
|
-
actionSource: null
|
|
7369
|
+
actionSource: null,
|
|
7370
|
+
progress: null
|
|
7247
7371
|
});
|
|
7248
7372
|
}
|
|
7249
7373
|
return turns;
|
|
@@ -7397,7 +7521,7 @@ function buildCurrentTurnRecovery(input) {
|
|
|
7397
7521
|
const failedTurnRecord = input.turnRecords.find(
|
|
7398
7522
|
(turnRecord) => turnRecord.id === failedTurnRecordId
|
|
7399
7523
|
);
|
|
7400
|
-
if (!failedTurnRecord || failedTurnRecord.status !== "failed" ||
|
|
7524
|
+
if (!failedTurnRecord || failedTurnRecord.status !== "failed" || failedTurnRecord.turnId !== input.process.selectedTurnId) {
|
|
7401
7525
|
return null;
|
|
7402
7526
|
}
|
|
7403
7527
|
const recoveryContext = readFailedTurnRecoveryContext(
|
|
@@ -7418,6 +7542,7 @@ function buildCurrentTurnRecovery(input) {
|
|
|
7418
7542
|
technicalDetail: presentation.technicalDetail,
|
|
7419
7543
|
defaultContinuePrompt: resolveTurnContinuationUserPrompt(input.piEntries, failedTurnRecord, continuationBounds) ?? normalizeContinuePrompt(input.process.metadata?.[CONTINUE_PROMPT_METADATA_KEY]) ?? recoveryContext?.suggestedContinuePrompt ?? DEFAULT_CONTINUE_PROMPT,
|
|
7420
7544
|
canContinue,
|
|
7545
|
+
supportsModelOverride: failedTurnRecord.turnType === "llm",
|
|
7421
7546
|
defaultModelProfileId: acceptedLlmStart?.model.profileId ?? failedTurnRecord.modelProfileId,
|
|
7422
7547
|
providerOptions: acceptedLlmStart ? { ...acceptedLlmStart.providerOptions } : {}
|
|
7423
7548
|
};
|
|
@@ -7662,7 +7787,7 @@ var ProcessUiSnapshotAssembler = class {
|
|
|
7662
7787
|
|
|
7663
7788
|
// src/ws/broadcast.ts
|
|
7664
7789
|
import {
|
|
7665
|
-
createDurableWsFrame,
|
|
7790
|
+
createDurableWsFrame as createDurableWsFrame2,
|
|
7666
7791
|
createEphemeralWsFrame as createEphemeralWsFrame2
|
|
7667
7792
|
} from "@leitwerk-dev/protocol";
|
|
7668
7793
|
function createBroadcaster() {
|
|
@@ -7680,7 +7805,7 @@ function createBroadcaster() {
|
|
|
7680
7805
|
}
|
|
7681
7806
|
}
|
|
7682
7807
|
function sendDurable(type, payload, instanceId) {
|
|
7683
|
-
const frame =
|
|
7808
|
+
const frame = createDurableWsFrame2({
|
|
7684
7809
|
type,
|
|
7685
7810
|
payload,
|
|
7686
7811
|
instanceId
|
|
@@ -8592,6 +8717,7 @@ export {
|
|
|
8592
8717
|
createProcessTurnAnnotationRepo,
|
|
8593
8718
|
createProcessTurnRecordRepo,
|
|
8594
8719
|
createProviderCredentialRepo,
|
|
8720
|
+
skillFrontmatter,
|
|
8595
8721
|
createSkillRepo,
|
|
8596
8722
|
createTurnStartRecordRepo,
|
|
8597
8723
|
createWorkerLeaseRepo,
|
|
@@ -8619,6 +8745,7 @@ export {
|
|
|
8619
8745
|
listVisibleActionsForProcess,
|
|
8620
8746
|
getSelectedTurnSummaryForProcess,
|
|
8621
8747
|
broadcastProcessAttentionToast,
|
|
8748
|
+
recordTurnProgress,
|
|
8622
8749
|
createProcessOperationCoordinator,
|
|
8623
8750
|
authenticateRequest,
|
|
8624
8751
|
requireApiActor,
|
|
@@ -8659,4 +8786,4 @@ export {
|
|
|
8659
8786
|
ProcessUiSnapshotAssembler,
|
|
8660
8787
|
createBroadcaster
|
|
8661
8788
|
};
|
|
8662
|
-
//# sourceMappingURL=chunk-
|
|
8789
|
+
//# sourceMappingURL=chunk-2ESDXLNE.js.map
|