import type { GoalScope, VerifiedWorkflowSource } from '@dsh-enhanced/assistant-goals'; export type { VerifiedWorkflowSource } from '@dsh-enhanced/assistant-goals'; export type SkillScalar = string | number | boolean; export type SkillInputType = 'string' | 'number' | 'boolean'; export interface SkillBinding { name: string; stepId: string; path: string; } export interface SkillInput extends SkillBinding { type: SkillInputType; default: SkillScalar; } export interface SkillStep { id: string; toolName: string; arguments: unknown; dependsOn: readonly string[]; } export interface SkillFileObservations { protocol: 'assistant-skills/file-observations/v1'; beforeSteps: readonly string[]; } export interface SkillRunExpansion { protocol: 'assistant-skills/run-expansion/v1'; callId: string; runId: string; runDigest: string; definitionDigest: string; inputsDigest: string; steps: readonly { id: string; toolName: string; arguments: unknown; }[]; } /** * Discriminated precondition families a captured skill may require at dispatch. * The single v1 family admits a run only under the current owner's policy and a * Goal distinct from the one whose historical trace was captured. */ export type SkillPreconditionKind = 'current-owner-policy-and-fresh-goal'; /** * Discriminated compensation families governing a run after a step failure. * The single v1 family stops the remaining steps and reports for explicit * owner-directed repair; the executor never self-remediates. */ export type SkillCompensationKind = 'stop-and-report'; export interface SkillDefinition { protocol: 'assistant-skills/definition/v1'; name: string; description: string; source: VerifiedWorkflowSource; inputs: readonly SkillInput[]; steps: readonly SkillStep[]; fileObservations?: SkillFileObservations; runExpansions?: readonly SkillRunExpansion[]; preconditions: SkillPreconditionKind; compensation: SkillCompensationKind; } export type FailureCaptureCategory = 'objective-not-achieved' | 'repeated-not-achieved'; export interface FailureCaptureGoalIdentity { id: string; definition: { version: number; digest: string; objective: string; }; sessionId: string; nativeGoalId: string; } export interface HostFailureEvidenceObservation { goal: FailureCaptureGoalIdentity; runId: string; execution: { status: 'succeeded'; quiescent: true; }; outcome: 'not-achieved'; acceptance: { contractId: string; contractDigest: string; receiptDigest: string; verifiedAt: number; validUntil: number; }; traceDigest: string; } export interface HostFailureEvidenceSummary { protocol: 'assistant-skills/host-failure-evidence/v1'; scope: GoalScope; taskFamily: { id: string; definitionDigest: string; objective: string; }; failureCategory: FailureCaptureCategory; triggerCondition: { kind: 'not-achieved-count'; minimumOccurrences: number; windowStartedAt: number; windowEndedAt: number; }; failures: readonly HostFailureEvidenceObservation[]; repairGoal: FailureCaptureGoalIdentity; attestedAt: number; evidence: { producer: 'assistant-goals'; generation: string; digest: string; }; } export interface FailureCaptureProvenance { protocol: 'assistant-skills/failure-capture-provenance/v1'; trigger: HostFailureEvidenceSummary; repair: { goal: FailureCaptureGoalIdentity; runId: string; sourceDigest: string; acceptanceDigest: string; }; parent: { name: string; version: number; digest: string; }; candidate: { name: string; definitionDigest: string; }; /** Diagnostic structural delta only. It is not an admission or authorization decision. */ permissionDelta: { parent: readonly string[]; candidate: readonly string[]; added: readonly string[]; removed: readonly string[]; expandsAuthority: boolean; }; rollbackTarget: { name: string; version: number; digest: string; }; } export interface CreateDefinitionOptions { name: string; description: string; bindings?: readonly SkillBinding[]; } /** * Canonical integrity digest for a failure summary. This public SHA-256 does * not authenticate its producer; trust exists only while the value is obtained * directly from the current AssistantGoalsService capability. */ export declare function failureSummaryEvidenceDigest(value: Omit, generation: string): string; /** * Validate the structure and integrity linkage of Host failure evidence. This * never establishes provenance: callers must receive the value directly from * the current AssistantGoalsService capability, not from model or stored input. */ export declare function validateHostFailureEvidenceSummary(value: unknown): Readonly; /** Validate a self-contained candidate provenance envelope before persistence or comparison. */ export declare function validateFailureCaptureProvenance(value: unknown): Readonly; /** Derive the native reads which establish file-observation policy state for an instantiated definition. */ export declare function fileObservationSteps(definition: SkillDefinition): readonly { id: string; beforeStepId: string; filePath: string; allowAbsent: boolean; }[]; /** * Validate the dependency DAG of a captured step list. * * Edges are general (a step may declare multiple dependencies) but the stored * array is required to be in topological order: every dependency must reference * an earlier step. That single rule simultaneously enforces reference * validity, no self-loop, and acyclicity (the index differences around a cycle * cannot all be negative), and it preserves the positional invariants the * sequential executor and the index-aligned file observations rely on. */ export declare function validateStepGraph(steps: readonly Pick[]): void; /** Fail closed on the typed protocol-family declarations of any definition. */ export declare function assertDefinitionProtocolFamilies(definition: Pick): void; /** Validate the typed protocol fields and dependency graph of any definition. */ export declare function assertDefinitionProtocol(definition: Pick): void; /** Digests the executor already resolved; the pure gate stays free of Host scope types. */ export interface SkillPreconditionDecision { /** Policy-scope digest the executor resolved for the current action. */ ownerScopeDigest: string; /** Policy-scope digest the live Goal run context attests. */ currentScopeDigest: string; goalId: string; /** Goal whose historical trace was captured into the definition. */ sourceGoalId: string; } /** * Admit a run only when the declared precondition family is satisfied. * The v1 family requires the current owner's policy scope to match and a Goal * distinct from the captured source Goal. Unknown families never admit a run. */ export declare function evaluatePreconditions(preconditions: SkillPreconditionKind, decision: SkillPreconditionDecision): void; /** Directive the executor follows once a step has failed. */ export interface SkillCompensationDirective { kind: SkillCompensationKind; stopRemainingSteps: boolean; reportForOwnerRepair: boolean; } /** Resolve the declared compensation family; the v1 family stops and reports. */ export declare function compensationDirective(compensation: SkillCompensationKind): SkillCompensationDirective; /** Derive a bounded, parameterizable skill only from an independently verified tool trace. */ export declare function createDefinition(source: VerifiedWorkflowSource, options: CreateDefinitionOptions, allowedTools: readonly string[], expansions?: readonly SkillRunExpansion[]): Readonly; /** Materialize saved defaults and only declared scalar inputs into an immutable trace projection. */ export declare function instantiate(definition: SkillDefinition, values?: Readonly>): Readonly; //# sourceMappingURL=definition.d.ts.map