@kontourai/flow-agents 3.2.0 → 3.4.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/.github/workflows/add-to-project.yml +15 -0
- package/.github/workflows/ci.yml +173 -0
- package/CHANGELOG.md +54 -0
- package/CONTEXT.md +5 -1
- package/README.md +19 -8
- package/build/src/builder-flow-run-adapter.d.ts +80 -0
- package/build/src/builder-flow-run-adapter.js +241 -0
- package/build/src/builder-flow-runtime.d.ts +16 -0
- package/build/src/builder-flow-runtime.js +290 -0
- package/build/src/cli/assignment-provider.js +10 -1
- package/build/src/cli/builder-run.d.ts +1 -0
- package/build/src/cli/builder-run.js +27 -0
- package/build/src/cli/effective-backlog-settings.js +70 -2
- package/build/src/cli/init.d.ts +34 -0
- package/build/src/cli/init.js +341 -61
- package/build/src/cli/kit.js +55 -12
- package/build/src/cli/pull-work-provider.js +346 -5
- package/build/src/cli/skill-drift-check.d.ts +1 -0
- package/build/src/cli/skill-drift-check.js +165 -0
- package/build/src/cli/telemetry-doctor.d.ts +37 -0
- package/build/src/cli/telemetry-doctor.js +53 -6
- package/build/src/cli/validate-hook-influence.js +37 -7
- package/build/src/cli/workflow-artifact-cleanup-audit.js +418 -11
- package/build/src/cli/workflow-sidecar.d.ts +310 -1
- package/build/src/cli/workflow-sidecar.js +1914 -126
- package/build/src/cli.js +5 -0
- package/build/src/flow-kit/validate.d.ts +54 -34
- package/build/src/flow-kit/validate.js +237 -26
- package/build/src/index.d.ts +2 -0
- package/build/src/index.js +1 -0
- package/build/src/lib/console-connect-options.d.ts +97 -0
- package/build/src/lib/console-connect-options.js +199 -0
- package/build/src/lib/console-telemetry-validate.d.ts +49 -0
- package/build/src/lib/console-telemetry-validate.js +91 -0
- package/build/src/lib/flow-resolver.d.ts +54 -1
- package/build/src/lib/flow-resolver.js +112 -5
- package/build/src/lib/fs.d.ts +17 -0
- package/build/src/lib/fs.js +172 -0
- package/build/src/lib/local-artifact-root.d.ts +44 -1
- package/build/src/lib/local-artifact-root.js +131 -3
- package/build/src/runtime-adapters.d.ts +39 -3
- package/build/src/runtime-adapters.js +77 -31
- package/build/src/tools/build-universal-bundles.js +40 -2
- package/build/src/tools/codex-agent-routing.d.ts +2 -0
- package/build/src/tools/codex-agent-routing.js +49 -0
- package/build/src/tools/generate-context-map.js +1 -0
- package/build/src/tools/validate-source-tree.js +30 -3
- package/context/contracts/artifact-contract.md +16 -2
- package/context/scripts/hooks/lib/kit-catalog.js +235 -0
- package/context/scripts/hooks/lib/runnable-command.js +177 -0
- package/context/scripts/hooks/stop-goal-fit.js +278 -48
- package/context/scripts/hooks/workflow-steering.js +194 -22
- package/context/scripts/package.json +3 -0
- package/context/scripts/telemetry/install-console-config.sh +25 -4
- package/context/scripts/telemetry/lib/config.sh +102 -12
- package/context/scripts/telemetry/lib/pricing.sh +50 -0
- package/context/scripts/telemetry/lib/session.sh +3 -0
- package/context/scripts/telemetry/lib/transport.sh +87 -0
- package/context/scripts/telemetry/lib/usage.sh +205 -4
- package/context/scripts/telemetry/telemetry.conf +6 -0
- package/context/scripts/telemetry/telemetry.sh +48 -0
- package/context/settings/workspace-backlog-provider-settings.example.json +48 -0
- package/docs/agent-usage-feedback-loop.md +35 -0
- package/docs/architecture-engine-and-kits.md +110 -0
- package/docs/context-map.md +2 -0
- package/docs/coordination-guide.md +370 -0
- package/docs/decisions/agent-coordination.md +26 -9
- package/docs/decisions/embeddable-engine.md +152 -0
- package/docs/decisions/index.md +5 -3
- package/docs/decisions/trust-ledger-retention.md +88 -0
- package/docs/decisions/trust-reconcile.md +42 -9
- package/docs/decisions/workflow-enforcement.md +31 -9
- package/docs/fixture-ownership.md +6 -2
- package/docs/implementing-trust-reconciliation.md +129 -0
- package/docs/index.md +23 -9
- package/docs/integrations/flow-agents-console.md +275 -0
- package/docs/integrations/index.md +4 -0
- package/docs/kit-authoring-guide.md +52 -21
- package/docs/spec/builder-flow-runtime.md +80 -0
- package/docs/spec/runtime-hook-surface.md +45 -1
- package/docs/specs/economics-record-contract.md +270 -0
- package/docs/specs/harness-capability-matrix.md +74 -0
- package/docs/specs/learning-review-proposals-contract.md +340 -0
- package/docs/specs/routing-efficiency-review.md +59 -0
- package/docs/verifiable-trust.md +74 -25
- package/docs/workflow-artifact-lifecycle.md +38 -1
- package/docs/workflow-usage-guide.md +10 -0
- package/evals/acceptance/prove-capture-teeth.sh +132 -0
- package/evals/ci/antigaming-suite.sh +2 -0
- package/evals/ci/run-baseline.sh +78 -4
- package/evals/fixtures/economics/acceptance.json +12 -0
- package/evals/fixtures/economics/agents/tool-worker-1/events.jsonl +2 -0
- package/evals/fixtures/economics/agents/tool-worker-2/events.jsonl +2 -0
- package/evals/fixtures/economics/agents/tool-worker-3/events.jsonl +2 -0
- package/evals/fixtures/economics/agents/tool-worker-4/events.jsonl +1 -0
- package/evals/fixtures/economics/agents/tool-worker-5/events.jsonl +2 -0
- package/evals/fixtures/economics/critique.json +22 -0
- package/evals/fixtures/economics/expected-record.json +71 -0
- package/evals/fixtures/economics/session-usage-event.json +1 -0
- package/evals/fixtures/economics/state.json +11 -0
- package/evals/fixtures/economics/transcript.jsonl +3 -0
- package/evals/fixtures/hook-influence/cases.json +7 -7
- package/evals/fixtures/learning-review-proposals/balanced/economics.jsonl +6 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/economics.jsonl +5 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-1/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-2/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-3/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-4/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-5/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/economics.jsonl +6 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/expected-aggregates.json +30 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/expected-aggregates.md +66 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-1/gate-review.inquiries.json +26 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-1/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-2/gate-review.inquiries.json +26 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-2/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-3/gate-review.inquiries.json +26 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-3/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-4/gate-review.inquiries.json +26 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-4/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-5/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-6/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/repeat-window/economics.jsonl +6 -0
- package/evals/fixtures/learning-review-proposals/under-threshold/economics.jsonl +3 -0
- package/evals/fixtures/reconcile-preflight/disputed-critique-unsuperseded.json +48 -0
- package/evals/fixtures/reconcile-preflight/standalone-disputed-session-local.json +59 -0
- package/evals/fixtures/telemetry/usage-transcript-sample.jsonl +4 -0
- package/evals/fixtures/trust-reconcile-exploits/mcp-degrade.json +42 -0
- package/evals/integration/test_builder_entry_enforcement.sh +241 -0
- package/evals/integration/test_builder_step_producers.sh +18 -10
- package/evals/integration/test_bundle_install.sh +172 -0
- package/evals/integration/test_checkpoint_signing.sh +10 -2
- package/evals/integration/test_ci_actor_identity.sh +221 -0
- package/evals/integration/test_console_tenant_isolation.sh +167 -0
- package/evals/integration/test_critique_supersession_roundtrip.sh +4 -1
- package/evals/integration/test_dual_emit_flow_step.sh +10 -4
- package/evals/integration/test_economics_record.sh +674 -0
- package/evals/integration/test_effective_backlog_settings.sh +1 -1
- package/evals/integration/test_evidence_capture_hook.sh +17 -2
- package/evals/integration/test_exemption_usage_review.sh +198 -0
- package/evals/integration/test_fixture_retirement_audit.sh +2 -2
- package/evals/integration/test_flow_kit_install_git.sh +83 -0
- package/evals/integration/test_flowdef_session_activation.sh +0 -1
- package/evals/integration/test_flowdef_session_history_preservation.sh +13 -3
- package/evals/integration/test_gate_lockdown.sh +7 -0
- package/evals/integration/test_gate_review_inquiry_records.sh +9 -1
- package/evals/integration/test_goal_fit_hook.sh +2031 -0
- package/evals/integration/test_hook_category_behaviors.sh +8 -1
- package/evals/integration/test_hook_influence_cases.sh +25 -1
- package/evals/integration/test_install_merge.sh +227 -2
- package/evals/integration/test_kit_conformance_levels.sh +6 -6
- package/evals/integration/test_learning_review_proposals.sh +329 -0
- package/evals/integration/test_liveness_conflict_injection.sh +26 -22
- package/evals/integration/test_liveness_console_relay.sh +166 -0
- package/evals/integration/test_liveness_heartbeat.sh +17 -17
- package/evals/integration/test_liveness_worktree_root.sh +575 -0
- package/evals/integration/test_phase_map_and_gate_claim.sh +6 -1
- package/evals/integration/test_publish_delivery.sh +389 -2
- package/evals/integration/test_pull_work_board.sh +200 -0
- package/evals/integration/test_pull_work_provider.sh +1 -1
- package/evals/integration/test_reconcile_preflight.sh +304 -0
- package/evals/integration/test_record_check.sh +378 -0
- package/evals/integration/test_routing_efficiency.sh +71 -0
- package/evals/integration/test_runtime_adapter_activation.sh +28 -0
- package/evals/integration/test_session_resume_roundtrip.sh +16 -19
- package/evals/integration/test_skill_drift_check.sh +870 -0
- package/evals/integration/test_takeover_protocol.sh +340 -0
- package/evals/integration/test_telemetry.sh +445 -0
- package/evals/integration/test_telemetry_doctor.sh +66 -0
- package/evals/integration/test_telemetry_usage_pipeline.sh +228 -0
- package/evals/integration/test_trust_reconcile_negatives.sh +121 -13
- package/evals/integration/test_trust_reconcile_trailer_diagnostic.sh +247 -0
- package/evals/integration/test_usage_cost.sh +61 -0
- package/evals/integration/test_verify_hold.sh +910 -0
- package/evals/integration/test_veritas_governance_kit.sh +257 -0
- package/evals/integration/test_workflow_artifact_cleanup_audit.sh +575 -3
- package/evals/integration/test_workflow_sidecar_writer.sh +1395 -0
- package/evals/integration/test_workflow_steering_hook.sh +157 -16
- package/evals/integration/test_workspace_settings.sh +176 -0
- package/evals/lib/env.sh +26 -0
- package/evals/lib/node.sh +8 -0
- package/evals/run.sh +37 -0
- package/evals/static/test_ci_integration_coverage.sh +115 -0
- package/evals/static/test_declared_scope_forms_documented.sh +114 -0
- package/evals/static/test_universal_bundles.sh +34 -0
- package/evals/static/test_validate_source_kit_asset_scope.sh +259 -0
- package/evals/static/test_workflow_skills.sh +1 -1
- package/kits/builder/flows/build.flow.json +9 -18
- package/kits/builder/flows/publish-learn.flow.json +5 -1
- package/kits/builder/kit.json +120 -0
- package/kits/builder/skills/continue-work/SKILL.md +2 -0
- package/kits/builder/skills/deliver/SKILL.md +115 -0
- package/kits/builder/skills/evidence-gate/SKILL.md +12 -0
- package/kits/builder/skills/execute-plan/SKILL.md +9 -0
- package/kits/builder/skills/learning-review/SKILL.md +51 -0
- package/kits/builder/skills/plan-work/SKILL.md +17 -20
- package/kits/builder/skills/pull-work/SKILL.md +33 -2
- package/kits/builder/skills/release-readiness/SKILL.md +12 -0
- package/kits/knowledge/kit.json +9 -0
- package/kits/veritas-governance/docs/README.md +113 -7
- package/kits/veritas-governance/fixtures/exemption/approved.trust-bundle.json +74 -0
- package/kits/veritas-governance/fixtures/exemption/not-approved.trust-bundle.json +74 -0
- package/kits/veritas-governance/fixtures/exemption-review/mixed-fresh-stale.DECLARED.json +14 -0
- package/kits/veritas-governance/flows/exemption-issuance.flow.json +35 -0
- package/kits/veritas-governance/kit.json +19 -0
- package/kits/veritas-governance/skills/exemption-usage-review/SKILL.md +128 -0
- package/kits/veritas-governance/skills/exemption-usage-review/review-exemptions.mjs +231 -0
- package/package.json +2 -2
- package/packaging/manifest.json +29 -0
- package/schemas/backlog-provider-settings.schema.json +13 -0
- package/schemas/workflow-state.schema.json +44 -0
- package/scripts/README.md +4 -0
- package/scripts/check-content-boundary.cjs +8 -1
- package/scripts/ci/trust-reconcile.js +214 -253
- package/scripts/hooks/codex-hook-adapter.js +77 -2
- package/scripts/hooks/evidence-capture.js +38 -5
- package/scripts/hooks/lib/actor-identity.js +82 -0
- package/scripts/hooks/lib/codex-exit-code.js +316 -0
- package/scripts/hooks/lib/kit-catalog.js +235 -0
- package/scripts/hooks/lib/liveness-write.js +28 -1
- package/scripts/hooks/lib/local-artifact-paths.js +97 -1
- package/scripts/hooks/lib/runnable-command.js +177 -0
- package/scripts/hooks/lib/skill-drift.js +350 -0
- package/scripts/hooks/stop-goal-fit.js +278 -48
- package/scripts/hooks/workflow-steering.js +194 -22
- package/scripts/install-codex-home.sh +97 -47
- package/scripts/install-merge.js +72 -14
- package/scripts/install-owned-files.js +178 -0
- package/scripts/lib/reconcile-shape.js +381 -0
- package/scripts/liveness/relay.sh +84 -0
- package/scripts/telemetry/economics-record.schema.json +145 -0
- package/scripts/telemetry/economics-record.sh +331 -0
- package/scripts/telemetry/install-console-config.sh +25 -4
- package/scripts/telemetry/learning-review-decide.sh +124 -0
- package/scripts/telemetry/learning-review-proposals.schema.json +161 -0
- package/scripts/telemetry/learning-review-proposals.sh +484 -0
- package/scripts/telemetry/lib/config.sh +102 -12
- package/scripts/telemetry/lib/pricing.sh +14 -6
- package/scripts/telemetry/lib/session.sh +3 -0
- package/scripts/telemetry/lib/transport.sh +133 -15
- package/scripts/telemetry/lib/usage.sh +121 -28
- package/scripts/telemetry/routing-efficiency.sh +0 -0
- package/scripts/telemetry/telemetry.conf +6 -0
- package/scripts/telemetry/telemetry.sh +48 -0
- package/src/builder-flow-run-adapter.ts +357 -0
- package/src/builder-flow-runtime.ts +348 -0
- package/src/cli/assignment-provider.ts +12 -1
- package/src/cli/builder-flow-run-adapter.test.mjs +495 -0
- package/src/cli/builder-flow-runtime.test.mjs +213 -0
- package/src/cli/builder-run.ts +28 -0
- package/src/cli/codex-agent-routing.test.mjs +44 -0
- package/src/cli/codex-exit-code.test.mjs +207 -0
- package/src/cli/console-connect-options.test.mjs +329 -0
- package/src/cli/console-telemetry-validate.test.mjs +157 -0
- package/src/cli/effective-backlog-settings.ts +68 -2
- package/src/cli/flow-resolver-composition.test.mjs +72 -0
- package/src/cli/init.test.mjs +161 -0
- package/src/cli/init.ts +407 -62
- package/src/cli/kit-metadata-security.test.mjs +443 -0
- package/src/cli/kit.ts +50 -12
- package/src/cli/pull-work-provider.ts +377 -3
- package/src/cli/sidecar-pure-helpers.test.mjs +64 -0
- package/src/cli/skill-drift-check.ts +196 -0
- package/src/cli/telemetry-doctor.test.mjs +53 -0
- package/src/cli/telemetry-doctor.ts +50 -7
- package/src/cli/validate-hook-influence.ts +37 -6
- package/src/cli/workflow-artifact-cleanup-audit.ts +483 -10
- package/src/cli/workflow-sidecar.ts +1980 -119
- package/src/cli.ts +5 -0
- package/src/flow-kit/validate.ts +277 -38
- package/src/index.ts +19 -0
- package/src/lib/console-connect-options.ts +261 -0
- package/src/lib/console-telemetry-validate.ts +88 -0
- package/src/lib/flow-resolver.ts +117 -4
- package/src/lib/fs.ts +160 -0
- package/src/lib/local-artifact-root.ts +129 -3
- package/src/runtime-adapters.ts +113 -33
- package/src/tools/build-universal-bundles.ts +36 -2
- package/src/tools/codex-agent-routing.ts +48 -0
- package/src/tools/generate-context-map.ts +1 -0
- package/src/tools/validate-source-tree.ts +29 -3
package/build/src/cli.js
CHANGED
|
@@ -3,6 +3,7 @@ import { basename } from "node:path";
|
|
|
3
3
|
import { main as effectiveBacklogSettings } from "./cli/effective-backlog-settings.js";
|
|
4
4
|
import { main as effectiveAssignmentProviderSettings } from "./cli/effective-assignment-provider-settings.js";
|
|
5
5
|
import { main as assignmentProvider } from "./cli/assignment-provider.js";
|
|
6
|
+
import { main as builderRun } from "./cli/builder-run.js";
|
|
6
7
|
import { main as consoleLearningProjection } from "./cli/console-learning-projection.js";
|
|
7
8
|
import { main as kit } from "./cli/kit.js";
|
|
8
9
|
import { main as fixtureRetirementAudit } from "./cli/fixture-retirement-audit.js";
|
|
@@ -20,10 +21,12 @@ import { main as validateSource } from "./tools/validate-source-tree.js";
|
|
|
20
21
|
import { main as validatePackage } from "./tools/validate-package.js";
|
|
21
22
|
import { main as validateHookInfluence } from "./cli/validate-hook-influence.js";
|
|
22
23
|
import { main as runtimeAdapter } from "./cli/runtime-adapter.js";
|
|
24
|
+
import { main as skillDriftCheck } from "./cli/skill-drift-check.js";
|
|
23
25
|
import { main as utteranceCheck } from "./cli/utterance-check.js";
|
|
24
26
|
import { main as verify } from "./cli/verify.js";
|
|
25
27
|
const availableCommands = new Map([
|
|
26
28
|
["build-bundles", () => buildBundles()],
|
|
29
|
+
["builder-run", builderRun],
|
|
27
30
|
["console-learning-projection", consoleLearningProjection],
|
|
28
31
|
["context-map", contextMap],
|
|
29
32
|
["assignment-provider", assignmentProvider],
|
|
@@ -36,6 +39,7 @@ const availableCommands = new Map([
|
|
|
36
39
|
["publish-change", publishChange],
|
|
37
40
|
["pull-work-provider", pullWorkProvider],
|
|
38
41
|
["runtime-adapter", runtimeAdapter],
|
|
42
|
+
["skill-drift-check", skillDriftCheck],
|
|
39
43
|
["utterance-check", utteranceCheck],
|
|
40
44
|
["telemetry-doctor", telemetryDoctor],
|
|
41
45
|
["usage-feedback", usageFeedback],
|
|
@@ -59,6 +63,7 @@ const aliases = new Map([
|
|
|
59
63
|
["flow-agents-publish-change", "publish-change"],
|
|
60
64
|
["flow-agents-pull-work-provider", "pull-work-provider"],
|
|
61
65
|
["flow-agents-runtime-adapter", "runtime-adapter"],
|
|
66
|
+
["flow-agents-skill-drift-check", "skill-drift-check"],
|
|
62
67
|
["flow-agents-telemetry-doctor", "telemetry-doctor"],
|
|
63
68
|
["flow-agents-usage-feedback", "usage-feedback"],
|
|
64
69
|
["flow-agents-veritas-governance", "veritas-governance"],
|
|
@@ -2,6 +2,33 @@ export interface KitDependencyEntry {
|
|
|
2
2
|
kit_id: string;
|
|
3
3
|
reason?: string;
|
|
4
4
|
}
|
|
5
|
+
export interface KitWorkflowTriggerEntry {
|
|
6
|
+
id: string;
|
|
7
|
+
when: string;
|
|
8
|
+
target_flow_id?: string;
|
|
9
|
+
default_skill?: string;
|
|
10
|
+
conditional_skills?: {
|
|
11
|
+
when: string;
|
|
12
|
+
skill: string;
|
|
13
|
+
}[];
|
|
14
|
+
required_sequence?: string[];
|
|
15
|
+
post_verify_targets?: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface KitHookInfluenceExpectationEntry {
|
|
18
|
+
id: string;
|
|
19
|
+
description: string;
|
|
20
|
+
tier: string;
|
|
21
|
+
hook?: string;
|
|
22
|
+
event?: string;
|
|
23
|
+
must_include_guidance: string[];
|
|
24
|
+
must_include_actions: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface KitFlowStepActionEntry {
|
|
27
|
+
flow_id: string;
|
|
28
|
+
step_id: string;
|
|
29
|
+
skills: string[];
|
|
30
|
+
operations: string[];
|
|
31
|
+
}
|
|
5
32
|
/**
|
|
6
33
|
* Parse and shape-validate a kit manifest's `dependencies` field (Flow Agents
|
|
7
34
|
* extension-layer metadata; see docs/adr/0019-kit-dependency-ownership.md).
|
|
@@ -21,6 +48,18 @@ export declare function parseKitDependencies(manifest: Record<string, unknown>,
|
|
|
21
48
|
entries: KitDependencyEntry[];
|
|
22
49
|
errors: string[];
|
|
23
50
|
};
|
|
51
|
+
export declare function parseKitWorkflowTriggers(manifest: Record<string, unknown>, manifestPath: string): {
|
|
52
|
+
entries: KitWorkflowTriggerEntry[];
|
|
53
|
+
errors: string[];
|
|
54
|
+
};
|
|
55
|
+
export declare function parseKitHookInfluenceExpectations(manifest: Record<string, unknown>, manifestPath: string): {
|
|
56
|
+
entries: KitHookInfluenceExpectationEntry[];
|
|
57
|
+
errors: string[];
|
|
58
|
+
};
|
|
59
|
+
export declare function parseKitFlowStepActions(manifest: Record<string, unknown>, manifestPath: string): {
|
|
60
|
+
entries: KitFlowStepActionEntry[];
|
|
61
|
+
errors: string[];
|
|
62
|
+
};
|
|
24
63
|
export type KitTargetConsumer = "flow" | "flow-agents" | string;
|
|
25
64
|
export interface KitConformanceLevel {
|
|
26
65
|
/** K0: valid core Flow Kit container with at least one flow (gates evaluable agentlessly). */
|
|
@@ -32,39 +71,20 @@ export interface KitConformanceLevel {
|
|
|
32
71
|
}
|
|
33
72
|
/**
|
|
34
73
|
* Kit trust level — WHO vouches for a kit, orthogonal to the K-level capability axis.
|
|
35
|
-
*
|
|
36
|
-
* - "first-party": the kit is authored and published by Kontour (kontourai); its id is in the
|
|
37
|
-
* FIRST_PARTY_KIT_IDS allowlist maintained in this repository. These kits are built, tested,
|
|
38
|
-
* and distributed with the flow-agents package.
|
|
39
|
-
* - "verified": reserved for a future third-party verification process (e.g. self-certification
|
|
40
|
-
* via the conformance kit + cryptographic attestation / Veritas claims). Not yet implemented.
|
|
41
|
-
* - "unverified": default for all kits not in the first-party allowlist. This says nothing about
|
|
42
|
-
* the kit's quality — it only means Kontour has not vouched for it.
|
|
43
|
-
*
|
|
44
|
-
* The v2 path for "verified": cryptographic signing / attestation against the conformance kit
|
|
45
|
-
* and Veritas claims substrate is the natural next step and is intentionally deferred.
|
|
46
|
-
*/
|
|
47
|
-
export type KitTrustLevel = "first-party" | "verified" | "unverified";
|
|
48
|
-
/**
|
|
49
|
-
* Allowlist of kit IDs that Kontour authors, tests, and ships with the flow-agents package.
|
|
50
|
-
*
|
|
51
|
-
* Criteria for inclusion:
|
|
52
|
-
* 1. The kit directory lives under kits/ in the kontourai/flow-agents repository.
|
|
53
|
-
* 2. The kit is published by @kontourai (npm package @kontourai/flow-agents).
|
|
54
|
-
* 3. Kontour owns and maintains the kit's content and release lifecycle.
|
|
55
|
-
*
|
|
56
|
-
* To add a new first-party kit: add its id here AND ensure it lives under kits/ in this repo.
|
|
57
|
-
* Third-party forks or community kits published elsewhere are NOT first-party, even if they
|
|
58
|
-
* share a similar id — first-party is tied to provenance in this specific repository.
|
|
74
|
+
* Runtime steering and capability decisions do not branch on official/built-in provenance.
|
|
59
75
|
*/
|
|
60
|
-
export
|
|
76
|
+
export type KitTrustLevel = "verified" | "unverified";
|
|
77
|
+
export type KitSourceKind = "builtin" | "local" | "unknown";
|
|
78
|
+
export interface KitTrustOptions {
|
|
79
|
+
source_kind?: KitSourceKind;
|
|
80
|
+
kitDir?: string;
|
|
81
|
+
sourceRoot?: string;
|
|
82
|
+
}
|
|
61
83
|
/**
|
|
62
84
|
* Derive the trust level for a kit id.
|
|
63
|
-
*
|
|
64
|
-
* v1 determination: allowlist check against FIRST_PARTY_KIT_IDS.
|
|
65
|
-
* "verified" is reserved for future third-party verification (not yet granted to any kit).
|
|
85
|
+
* "verified" is reserved for future third-party verification.
|
|
66
86
|
*/
|
|
67
|
-
export declare function deriveKitTrust(kitId: string): KitTrustLevel;
|
|
87
|
+
export declare function deriveKitTrust(kitId: string, manifest?: Record<string, unknown>, options?: KitTrustOptions): KitTrustLevel;
|
|
68
88
|
export interface KitTargetsResult {
|
|
69
89
|
kit_id: string;
|
|
70
90
|
kit_name: string;
|
|
@@ -75,7 +95,7 @@ export interface KitTargetsResult {
|
|
|
75
95
|
third_party_extensions: string[];
|
|
76
96
|
/**
|
|
77
97
|
* Trust level: who vouches for this kit. Orthogonal to the K-level capability axis.
|
|
78
|
-
* "
|
|
98
|
+
* "verified" = reserved (future); "unverified" = default.
|
|
79
99
|
*/
|
|
80
100
|
trust: KitTrustLevel;
|
|
81
101
|
}
|
|
@@ -91,14 +111,14 @@ export interface KitTargetsResult {
|
|
|
91
111
|
* - targets.flow-agents: present when K1 (agent extension assets activate in >=1 harness).
|
|
92
112
|
* - third-party: any top-level keys that are not core fields and not Flow Agents extension classes.
|
|
93
113
|
*
|
|
94
|
-
* Trust derivation
|
|
95
|
-
* - "
|
|
96
|
-
*
|
|
114
|
+
* Trust derivation:
|
|
115
|
+
* - "unverified": all current kits (default; "verified" is reserved for a future process).
|
|
116
|
+
* kit.json `first_party` is catalog metadata and is not trusted for runtime privilege.
|
|
97
117
|
*
|
|
98
118
|
* @param manifest The kit.json manifest object.
|
|
99
119
|
* @param kitDir Kit directory for flow file-existence checks. Defaults to "" (structural-only).
|
|
100
120
|
* Pass the real kit directory from `inspect` to get authoritative K0 validation.
|
|
101
121
|
*/
|
|
102
|
-
export declare function deriveKitTargets(manifest: Record<string, unknown>, kitDir?: string): Promise<KitTargetsResult>;
|
|
122
|
+
export declare function deriveKitTargets(manifest: Record<string, unknown>, kitDir?: string, sourceRoot?: string): Promise<KitTargetsResult>;
|
|
103
123
|
export declare function validateKitRepository(kitDir: string): Promise<string[]>;
|
|
104
124
|
export declare function assertKitRepository(kitDir: string): Promise<Record<string, unknown>>;
|
|
@@ -10,8 +10,11 @@ const AGENT_EXTENSION_CLASSES = new Set(["skills", "docs", "adapters", "evals",
|
|
|
10
10
|
// Flow Agents-recognized metadata fields that are neither core container fields nor
|
|
11
11
|
// agent-extension asset classes. Recognized here so they are never misreported as
|
|
12
12
|
// unknown third-party extension namespaces. `dependencies` declares cross-kit skill
|
|
13
|
-
// dependencies (extension-layer ownership; see docs/adr/0019-kit-dependency-ownership.md)
|
|
14
|
-
|
|
13
|
+
// dependencies (extension-layer ownership; see docs/adr/0019-kit-dependency-ownership.md),
|
|
14
|
+
// workflow_triggers / hook_influence_expectations declare kit-owned runtime influence,
|
|
15
|
+
// and first_party is legacy catalog/marketplace metadata. It does not grant runtime
|
|
16
|
+
// capability or steering privilege.
|
|
17
|
+
const KNOWN_METADATA_FIELDS = new Set(["dependencies", "workflow_triggers", "hook_influence_expectations", "flow_step_actions", "first_party"]);
|
|
15
18
|
/**
|
|
16
19
|
* Parse and shape-validate a kit manifest's `dependencies` field (Flow Agents
|
|
17
20
|
* extension-layer metadata; see docs/adr/0019-kit-dependency-ownership.md).
|
|
@@ -67,28 +70,224 @@ export function parseKitDependencies(manifest, manifestPath) {
|
|
|
67
70
|
});
|
|
68
71
|
return { entries, errors };
|
|
69
72
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
function nonEmptyStringList(value) {
|
|
74
|
+
return Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === "string" && item.trim().length > 0);
|
|
75
|
+
}
|
|
76
|
+
const WORKFLOW_TRIGGER_IDENTIFIER_RE = /^[a-z0-9]+(?:[.-][a-z0-9]+)*$/;
|
|
77
|
+
function workflowTriggerIdentifier(value) {
|
|
78
|
+
return typeof value === "string" && WORKFLOW_TRIGGER_IDENTIFIER_RE.test(value);
|
|
79
|
+
}
|
|
80
|
+
function optionalWorkflowTriggerIdentifier(value) {
|
|
81
|
+
return value === undefined || workflowTriggerIdentifier(value);
|
|
82
|
+
}
|
|
83
|
+
function optionalWorkflowTriggerIdentifierList(value) {
|
|
84
|
+
return value === undefined || (Array.isArray(value) && value.length > 0 && value.every(workflowTriggerIdentifier));
|
|
85
|
+
}
|
|
86
|
+
function optionalConditionalSkills(value) {
|
|
87
|
+
return value === undefined ||
|
|
88
|
+
(Array.isArray(value) && value.every((item) => typeof item === "object" && item !== null &&
|
|
89
|
+
workflowTriggerIdentifier(item.when) &&
|
|
90
|
+
workflowTriggerIdentifier(item.skill)));
|
|
91
|
+
}
|
|
92
|
+
export function parseKitWorkflowTriggers(manifest, manifestPath) {
|
|
93
|
+
const entries = [];
|
|
94
|
+
const errors = [];
|
|
95
|
+
const raw = manifest.workflow_triggers;
|
|
96
|
+
if (raw === undefined)
|
|
97
|
+
return { entries, errors };
|
|
98
|
+
if (!Array.isArray(raw)) {
|
|
99
|
+
errors.push(`${manifestPath}: .workflow_triggers must be a list`);
|
|
100
|
+
return { entries, errors };
|
|
101
|
+
}
|
|
102
|
+
const seen = new Set();
|
|
103
|
+
raw.forEach((entry, index) => {
|
|
104
|
+
if (typeof entry !== "object" || entry === null) {
|
|
105
|
+
errors.push(`${manifestPath}: workflow_triggers[${index}] must be an object`);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const record = entry;
|
|
109
|
+
const id = record.id;
|
|
110
|
+
const when = record.when;
|
|
111
|
+
if (!workflowTriggerIdentifier(id)) {
|
|
112
|
+
errors.push(`${manifestPath}: workflow_triggers[${index}].id must match ^[a-z0-9]+(?:[.-][a-z0-9]+)*$`);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (seen.has(id))
|
|
116
|
+
errors.push(`${manifestPath}: workflow_triggers[${index}].id duplicates '${id}'`);
|
|
117
|
+
seen.add(id);
|
|
118
|
+
if (!workflowTriggerIdentifier(when)) {
|
|
119
|
+
errors.push(`${manifestPath}: workflow_triggers[${index}].when must match ^[a-z0-9]+(?:[.-][a-z0-9]+)*$`);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (record.hint !== undefined) {
|
|
123
|
+
errors.push(`${manifestPath}: workflow_triggers[${index}].hint is retired; use structured steering fields`);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (record.display_name !== undefined) {
|
|
127
|
+
errors.push(`${manifestPath}: workflow_triggers[${index}].display_name is not supported in workflow_triggers; use catalog/listing metadata for human-readable names`);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (!optionalWorkflowTriggerIdentifier(record.target_flow_id)) {
|
|
131
|
+
errors.push(`${manifestPath}: workflow_triggers[${index}].target_flow_id must match ^[a-z0-9]+(?:[.-][a-z0-9]+)*$ when present`);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (!optionalWorkflowTriggerIdentifier(record.default_skill)) {
|
|
135
|
+
errors.push(`${manifestPath}: workflow_triggers[${index}].default_skill must match ^[a-z0-9]+(?:[.-][a-z0-9]+)*$ when present`);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (!optionalConditionalSkills(record.conditional_skills)) {
|
|
139
|
+
errors.push(`${manifestPath}: workflow_triggers[${index}].conditional_skills must be a list of { when, skill } identifiers matching ^[a-z0-9]+(?:[.-][a-z0-9]+)*$ when present`);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (!optionalWorkflowTriggerIdentifierList(record.required_sequence)) {
|
|
143
|
+
errors.push(`${manifestPath}: workflow_triggers[${index}].required_sequence must be a non-empty identifier list matching ^[a-z0-9]+(?:[.-][a-z0-9]+)*$ when present`);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (!optionalWorkflowTriggerIdentifierList(record.post_verify_targets)) {
|
|
147
|
+
errors.push(`${manifestPath}: workflow_triggers[${index}].post_verify_targets must be a non-empty identifier list matching ^[a-z0-9]+(?:[.-][a-z0-9]+)*$ when present`);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
entries.push({
|
|
151
|
+
id,
|
|
152
|
+
when,
|
|
153
|
+
...(typeof record.target_flow_id === "string" ? { target_flow_id: record.target_flow_id } : {}),
|
|
154
|
+
...(typeof record.default_skill === "string" ? { default_skill: record.default_skill } : {}),
|
|
155
|
+
...(Array.isArray(record.conditional_skills) ? { conditional_skills: record.conditional_skills } : {}),
|
|
156
|
+
...(Array.isArray(record.required_sequence) ? { required_sequence: record.required_sequence } : {}),
|
|
157
|
+
...(Array.isArray(record.post_verify_targets) ? { post_verify_targets: record.post_verify_targets } : {}),
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
return { entries, errors };
|
|
161
|
+
}
|
|
162
|
+
export function parseKitHookInfluenceExpectations(manifest, manifestPath) {
|
|
163
|
+
const entries = [];
|
|
164
|
+
const errors = [];
|
|
165
|
+
const raw = manifest.hook_influence_expectations;
|
|
166
|
+
if (raw === undefined)
|
|
167
|
+
return { entries, errors };
|
|
168
|
+
if (!Array.isArray(raw)) {
|
|
169
|
+
errors.push(`${manifestPath}: .hook_influence_expectations must be a list`);
|
|
170
|
+
return { entries, errors };
|
|
171
|
+
}
|
|
172
|
+
const seen = new Set();
|
|
173
|
+
raw.forEach((entry, index) => {
|
|
174
|
+
if (typeof entry !== "object" || entry === null) {
|
|
175
|
+
errors.push(`${manifestPath}: hook_influence_expectations[${index}] must be an object`);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const record = entry;
|
|
179
|
+
const id = record.id;
|
|
180
|
+
const description = record.description;
|
|
181
|
+
const tier = record.tier;
|
|
182
|
+
if (typeof id !== "string" || !id.trim()) {
|
|
183
|
+
errors.push(`${manifestPath}: hook_influence_expectations[${index}].id must be a non-empty string`);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (seen.has(id))
|
|
187
|
+
errors.push(`${manifestPath}: hook_influence_expectations[${index}].id duplicates '${id}'`);
|
|
188
|
+
seen.add(id);
|
|
189
|
+
if (typeof description !== "string" || !description.trim()) {
|
|
190
|
+
errors.push(`${manifestPath}: hook_influence_expectations[${index}].description must be a non-empty string`);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (typeof tier !== "string" || !tier.trim()) {
|
|
194
|
+
errors.push(`${manifestPath}: hook_influence_expectations[${index}].tier must be a non-empty string`);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (record.hook !== undefined && (typeof record.hook !== "string" || !record.hook.trim())) {
|
|
198
|
+
errors.push(`${manifestPath}: hook_influence_expectations[${index}].hook must be a non-empty string when present`);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (record.event !== undefined && (typeof record.event !== "string" || !record.event.trim())) {
|
|
202
|
+
errors.push(`${manifestPath}: hook_influence_expectations[${index}].event must be a non-empty string when present`);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (!nonEmptyStringList(record.must_include_guidance)) {
|
|
206
|
+
errors.push(`${manifestPath}: hook_influence_expectations[${index}].must_include_guidance must be a non-empty string list`);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (!nonEmptyStringList(record.must_include_actions)) {
|
|
210
|
+
errors.push(`${manifestPath}: hook_influence_expectations[${index}].must_include_actions must be a non-empty string list`);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
entries.push({
|
|
214
|
+
id,
|
|
215
|
+
description,
|
|
216
|
+
tier,
|
|
217
|
+
...(typeof record.hook === "string" ? { hook: record.hook } : {}),
|
|
218
|
+
...(typeof record.event === "string" ? { event: record.event } : {}),
|
|
219
|
+
must_include_guidance: record.must_include_guidance,
|
|
220
|
+
must_include_actions: record.must_include_actions,
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
return { entries, errors };
|
|
224
|
+
}
|
|
225
|
+
export function parseKitFlowStepActions(manifest, manifestPath) {
|
|
226
|
+
const entries = [];
|
|
227
|
+
const errors = [];
|
|
228
|
+
const raw = manifest.flow_step_actions;
|
|
229
|
+
if (raw === undefined)
|
|
230
|
+
return { entries, errors };
|
|
231
|
+
if (!Array.isArray(raw)) {
|
|
232
|
+
errors.push(`${manifestPath}: .flow_step_actions must be a list`);
|
|
233
|
+
return { entries, errors };
|
|
234
|
+
}
|
|
235
|
+
const seen = new Set();
|
|
236
|
+
raw.forEach((entry, index) => {
|
|
237
|
+
if (typeof entry !== "object" || entry === null) {
|
|
238
|
+
errors.push(`${manifestPath}: flow_step_actions[${index}] must be an object`);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const record = entry;
|
|
242
|
+
if (!workflowTriggerIdentifier(record.flow_id)) {
|
|
243
|
+
errors.push(`${manifestPath}: flow_step_actions[${index}].flow_id must be a Flow identifier`);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (!workflowTriggerIdentifier(record.step_id)) {
|
|
247
|
+
errors.push(`${manifestPath}: flow_step_actions[${index}].step_id must be a step identifier`);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const skills = record.skills;
|
|
251
|
+
const operations = record.operations ?? [];
|
|
252
|
+
if (!Array.isArray(skills) || !skills.every(workflowTriggerIdentifier)) {
|
|
253
|
+
errors.push(`${manifestPath}: flow_step_actions[${index}].skills must be an identifier list`);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (new Set(skills).size !== skills.length) {
|
|
257
|
+
errors.push(`${manifestPath}: flow_step_actions[${index}].skills must not contain duplicates`);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (!Array.isArray(operations) || !operations.every(workflowTriggerIdentifier)) {
|
|
261
|
+
errors.push(`${manifestPath}: flow_step_actions[${index}].operations must be an identifier list when present`);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (new Set(operations).size !== operations.length) {
|
|
265
|
+
errors.push(`${manifestPath}: flow_step_actions[${index}].operations must not contain duplicates`);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const key = `${record.flow_id}/${record.step_id}`;
|
|
269
|
+
if (seen.has(key)) {
|
|
270
|
+
errors.push(`${manifestPath}: flow_step_actions[${index}] duplicates '${key}'`);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
seen.add(key);
|
|
274
|
+
entries.push({
|
|
275
|
+
flow_id: record.flow_id,
|
|
276
|
+
step_id: record.step_id,
|
|
277
|
+
skills: skills,
|
|
278
|
+
operations: operations,
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
return { entries, errors };
|
|
282
|
+
}
|
|
83
283
|
/**
|
|
84
284
|
* Derive the trust level for a kit id.
|
|
85
|
-
*
|
|
86
|
-
* v1 determination: allowlist check against FIRST_PARTY_KIT_IDS.
|
|
87
|
-
* "verified" is reserved for future third-party verification (not yet granted to any kit).
|
|
285
|
+
* "verified" is reserved for future third-party verification.
|
|
88
286
|
*/
|
|
89
|
-
export function deriveKitTrust(kitId) {
|
|
90
|
-
|
|
91
|
-
|
|
287
|
+
export function deriveKitTrust(kitId, manifest, options = {}) {
|
|
288
|
+
void kitId;
|
|
289
|
+
void manifest;
|
|
290
|
+
void options;
|
|
92
291
|
return "unverified";
|
|
93
292
|
}
|
|
94
293
|
let _validateKitContainerCache = null;
|
|
@@ -144,15 +343,15 @@ async function delegateCoreContainerValidation(kitDir, manifest) {
|
|
|
144
343
|
* - targets.flow-agents: present when K1 (agent extension assets activate in >=1 harness).
|
|
145
344
|
* - third-party: any top-level keys that are not core fields and not Flow Agents extension classes.
|
|
146
345
|
*
|
|
147
|
-
* Trust derivation
|
|
148
|
-
* - "
|
|
149
|
-
*
|
|
346
|
+
* Trust derivation:
|
|
347
|
+
* - "unverified": all current kits (default; "verified" is reserved for a future process).
|
|
348
|
+
* kit.json `first_party` is catalog metadata and is not trusted for runtime privilege.
|
|
150
349
|
*
|
|
151
350
|
* @param manifest The kit.json manifest object.
|
|
152
351
|
* @param kitDir Kit directory for flow file-existence checks. Defaults to "" (structural-only).
|
|
153
352
|
* Pass the real kit directory from `inspect` to get authoritative K0 validation.
|
|
154
353
|
*/
|
|
155
|
-
export async function deriveKitTargets(manifest, kitDir = "") {
|
|
354
|
+
export async function deriveKitTargets(manifest, kitDir = "", sourceRoot = process.cwd()) {
|
|
156
355
|
const kitId = typeof manifest.id === "string" ? manifest.id : "<unknown>";
|
|
157
356
|
const kitName = typeof manifest.name === "string" ? manifest.name : "<unknown>";
|
|
158
357
|
// Delegate core container validation to @kontourai/flow.
|
|
@@ -176,7 +375,7 @@ export async function deriveKitTargets(manifest, kitDir = "") {
|
|
|
176
375
|
for (const ns of thirdPartyExtensions)
|
|
177
376
|
targets.push(ns);
|
|
178
377
|
// Derive trust level orthogonally to the K-level capability axis.
|
|
179
|
-
const trust = deriveKitTrust(kitId);
|
|
378
|
+
const trust = deriveKitTrust(kitId, manifest, { kitDir, sourceRoot });
|
|
180
379
|
return {
|
|
181
380
|
kit_id: kitId,
|
|
182
381
|
kit_name: kitName,
|
|
@@ -253,6 +452,18 @@ export async function validateKitRepository(kitDir) {
|
|
|
253
452
|
const depResult = parseKitDependencies(manifest, manifestPath);
|
|
254
453
|
for (const err of depResult.errors)
|
|
255
454
|
errors.push(err);
|
|
455
|
+
const workflowTriggerResult = parseKitWorkflowTriggers(manifest, manifestPath);
|
|
456
|
+
for (const err of workflowTriggerResult.errors)
|
|
457
|
+
errors.push(err);
|
|
458
|
+
const hookExpectationResult = parseKitHookInfluenceExpectations(manifest, manifestPath);
|
|
459
|
+
for (const err of hookExpectationResult.errors)
|
|
460
|
+
errors.push(err);
|
|
461
|
+
const flowStepActionResult = parseKitFlowStepActions(manifest, manifestPath);
|
|
462
|
+
for (const err of flowStepActionResult.errors)
|
|
463
|
+
errors.push(err);
|
|
464
|
+
if (manifest.first_party !== undefined && typeof manifest.first_party !== "boolean") {
|
|
465
|
+
errors.push(`${manifestPath}: .first_party must be a boolean when present`);
|
|
466
|
+
}
|
|
256
467
|
return errors;
|
|
257
468
|
}
|
|
258
469
|
export async function assertKitRepository(kitDir) {
|
package/build/src/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { BUILDER_BUILD_FLOW_ID, BUILDER_BUILD_FLOW_RELATIVE_PATH, BuilderBuildRunInputError, BuilderBuildRunIdentityError, evaluateBuilderBuildRun, loadBuilderBuildRun, resolveBuilderBuildFlowDefinitionPath, startBuilderBuildRun, } from "./builder-flow-run-adapter.js";
|
|
2
|
+
export type { BuilderBuildRunResult, BuilderBuildRunIdentityMismatch, BuilderBuildTrustBundleEvidenceInput, EvaluateBuilderBuildRunInput, LoadBuilderBuildRunInput, StartBuilderBuildRunInput, } from "./builder-flow-run-adapter.js";
|
|
1
3
|
export { defaultArtifactRootForRead, defaultCodexHome, defaultTelemetryDirForRead, defaultTelemetryDirsForRead, durableFlowAgentsRoot, durableInstallRecordPath, DURABLE_FLOW_AGENTS_DIR, FLOW_AGENTS_RUNTIME_DIR, FLOW_AGENTS_RUNTIME_SUBDIR, firstExistingPath, flowAgentsArtifactRoot, KONTOURAI_DIR, legacyTelemetryDataDir, LEGACY_TELEMETRY_DIR, telemetryDataDir, } from "./lib/local-artifact-root.js";
|
|
2
4
|
export { validateTrustBundle, normalizeCheck, normalizeFinding, normalizeLearning, normalizeEvidenceRefs, validateEvidenceRef, validateLearningCorrection, loadJson, writeJson, appendJsonl, sidecarBase, writeState, statuses, phases, checkKinds, checkStatuses, verdicts, } from "./cli/workflow-sidecar.js";
|
|
3
5
|
/** Read a sidecar JSON file from a workflow artifact directory; returns `{}` if absent. */
|
package/build/src/index.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import * as path from "node:path";
|
|
17
17
|
import { loadJson as _loadJson, writeJson as _writeJson } from "./cli/workflow-sidecar.js";
|
|
18
|
+
export { BUILDER_BUILD_FLOW_ID, BUILDER_BUILD_FLOW_RELATIVE_PATH, BuilderBuildRunInputError, BuilderBuildRunIdentityError, evaluateBuilderBuildRun, loadBuilderBuildRun, resolveBuilderBuildFlowDefinitionPath, startBuilderBuildRun, } from "./builder-flow-run-adapter.js";
|
|
18
19
|
export { defaultArtifactRootForRead, defaultCodexHome, defaultTelemetryDirForRead, defaultTelemetryDirsForRead, durableFlowAgentsRoot, durableInstallRecordPath, DURABLE_FLOW_AGENTS_DIR, FLOW_AGENTS_RUNTIME_DIR, FLOW_AGENTS_RUNTIME_SUBDIR, firstExistingPath, flowAgentsArtifactRoot, KONTOURAI_DIR, legacyTelemetryDataDir, LEGACY_TELEMETRY_DIR, telemetryDataDir, } from "./lib/local-artifact-root.js";
|
|
19
20
|
export {
|
|
20
21
|
// Trust-bundle (Hachure) validation — the same validator the writer uses.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export type TelemetrySink = "local-files" | "local-kontour-console" | "kontour-hosted-console" | "user-hosted-console" | "kontour-cloud" | "hosted-kontour-console";
|
|
2
|
+
export type ConsoleConnectChoice = "hosted" | "local" | "self-hosted" | "skip";
|
|
3
|
+
/**
|
|
4
|
+
* Case-insensitive match on the four accepted choice spellings. Blank or
|
|
5
|
+
* unrecognized input falls back to `fallback` (the caller decides the
|
|
6
|
+
* default, typically "hosted").
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeConsoleConnectChoice(answer: string, fallback: ConsoleConnectChoice): ConsoleConnectChoice;
|
|
9
|
+
/** Pure lookup table: choice -> the exact `telemetrySinks` array to install with. */
|
|
10
|
+
export declare function mapConsoleConnectChoiceToSinks(choice: ConsoleConnectChoice): TelemetrySink[];
|
|
11
|
+
/** Only "self-hosted" requires an inline URL prompt. */
|
|
12
|
+
export declare function needsConsoleUrlPrompt(choice: ConsoleConnectChoice): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Mirrors `needsConsoleCredentials`'s existing semantics one-for-one
|
|
15
|
+
* (choice-based instead of sinks-based): every choice except "skip" wants
|
|
16
|
+
* token/tenant prompts.
|
|
17
|
+
*/
|
|
18
|
+
export declare function needsConsoleCredentialPrompts(choice: ConsoleConnectChoice): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The one hard-fail guard this PR adds: self-hosted Console with a blank URL
|
|
21
|
+
* is a downstream `die` in `install-console-config.sh` (the `user-hosted-console`
|
|
22
|
+
* branch requires `--console-url`/`--console-endpoint`). Falls back to
|
|
23
|
+
* `local-files` with a one-line warning instead of letting that crash happen.
|
|
24
|
+
*
|
|
25
|
+
* Only handles the blank case — a non-blank-but-malformed URL (e.g. a typo)
|
|
26
|
+
* is NOT this guard's job; callers separately run `isValidConsoleUrl` for
|
|
27
|
+
* that format-only warn-and-continue case.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveSelfHostedUrlOrFallback(url: string): {
|
|
30
|
+
sinks: TelemetrySink[];
|
|
31
|
+
url: string;
|
|
32
|
+
fallbackWarning?: string;
|
|
33
|
+
};
|
|
34
|
+
export type ConsoleConnectIo = {
|
|
35
|
+
ask: (prompt: string) => Promise<string>;
|
|
36
|
+
askHidden: (prompt: string) => Promise<string>;
|
|
37
|
+
};
|
|
38
|
+
export type ConsoleConnectDefaults = {
|
|
39
|
+
hostedUrl: string;
|
|
40
|
+
localUrl: string;
|
|
41
|
+
};
|
|
42
|
+
export type ConsoleConnectResult = {
|
|
43
|
+
telemetrySinks: TelemetrySink[];
|
|
44
|
+
consoleUrl?: string;
|
|
45
|
+
consoleTokenValue?: string;
|
|
46
|
+
consoleTenant?: string;
|
|
47
|
+
warnings: string[];
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Full interactive orchestration used by `interactiveOptions()`: prompts the
|
|
51
|
+
* four-way "Connect to Kontour Console?" choice (default Hosted, showing the
|
|
52
|
+
* real `console-presets.sh`-resolved hosted URL), applies the self-hosted
|
|
53
|
+
* blank-URL guard, prompts hidden token + tenant when a console connection is
|
|
54
|
+
* wanted, runs PR1's pure validators (validate-and-warn, not
|
|
55
|
+
* validate-and-block), and returns any format warnings in `warnings` for the
|
|
56
|
+
* caller to print -- rather than printing directly, so this stays testable
|
|
57
|
+
* via return-value assertions, not console-spy assertions.
|
|
58
|
+
*/
|
|
59
|
+
export declare function runConsoleConnectWizard(io: ConsoleConnectIo, defaults: ConsoleConnectDefaults): Promise<ConsoleConnectResult>;
|
|
60
|
+
export type ConsoleStatus = "connected-verified" | "connected-unverified" | "local-only";
|
|
61
|
+
type DoctorConsoleShape = {
|
|
62
|
+
sink: "local-only" | "console";
|
|
63
|
+
reachability: {
|
|
64
|
+
checked: boolean;
|
|
65
|
+
ok: boolean | null;
|
|
66
|
+
error?: string;
|
|
67
|
+
statusCode?: number;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export declare function describeConsoleStatus(doctor: {
|
|
71
|
+
console: DoctorConsoleShape;
|
|
72
|
+
}): {
|
|
73
|
+
status: ConsoleStatus;
|
|
74
|
+
detail?: string;
|
|
75
|
+
};
|
|
76
|
+
export type PostInstallSummaryInput = {
|
|
77
|
+
runtime: string;
|
|
78
|
+
runtimeAutoDetected: boolean;
|
|
79
|
+
dest: string;
|
|
80
|
+
telemetrySinks: string[];
|
|
81
|
+
consoleStatus: {
|
|
82
|
+
status: ConsoleStatus;
|
|
83
|
+
detail?: string;
|
|
84
|
+
};
|
|
85
|
+
tokenConfigured: boolean;
|
|
86
|
+
tenantConfigured: boolean;
|
|
87
|
+
nextSteps: string[];
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Pure string[]-builder for the post-install summary block: one array entry
|
|
91
|
+
* per line, so callers `console.log` each entry and tests assert on array
|
|
92
|
+
* contents rather than scraping stdout. Never receives or emits the raw
|
|
93
|
+
* console token value -- only the `tokenConfigured`/`tenantConfigured`
|
|
94
|
+
* booleans are shown.
|
|
95
|
+
*/
|
|
96
|
+
export declare function buildPostInstallSummaryLines(input: PostInstallSummaryInput): string[];
|
|
97
|
+
export {};
|