import { loadProfile } from '@atomicstrata/llmwiki-core'; export { AnswerCitation, AnswerCitationReport, AppendRelationInput, ArtifactDiscoveryV1, ArtifactHealth, ArtifactMemberEntry, ArtifactMemberFileInput, ArtifactRef, ArtifactSelectorV1, ArtifactVerifyUnavailableError, AtomicWriteCollisionError, AtomicWriteCommittedCleanupError, AtomicWriteNoReplaceDurableOptions, AtomicWriteOptions, CandidateKind, CitationRef, CompileResult, ConfinedCappedRead, ConfinedFetchMethod, ConfinedFetchRequest, ConfinedFetchResult, ConfinedFetchSeams, ContextPack, ContextPackOptions, CreateWikiOptions, DEV_PROVIDER_BOUNDS, DevGrantRequestContextV1, DevInvocationHostV1, EntityId, EntityPageRef, EntityPageView, EntityProblemView, EntityRef, EvalReport, ExportJsonOptions, FetchLimits, HOST_DECLARED_CONTRACT_SET, HeldReasonCode, HostModelBrokerV1, HostModelQuoteObservationV1, HostModelQuoteRequestV1, IngestResult, IngestTextInput, InstallDevProviderRequestV1, InstalledDevProviderV1, IssueDevGrantRequestV1, IssuedDevGrantV1, JsonExportDocument, JsonExportProfileBlock, LifecycleTransitionError, LifecycleTransitionUnavailableError, LintSummary, LintTierV1, ListPagesOptions, ListPagesProfileBlock, ListPagesResult, ListSourcesOptions, ListSourcesResult, LiveStageProjectionProvider, LiveStageProjectionResult, LoadedProfile, LockUnavailableError, MutationKind, MutationOperation, MutationProvenance, MutationTarget, OkfExportReport, OkfImportReport, OkfImportSkip, OkfImportedPage, OperationBundleMutationV1, OperationBundleObservationV1, OperationPageObservationV1, PackRecipeV2, PackageMemberKind, PackageMemberRefV1, Page, PageDirectory, PageRecord, PageRef, PlannedMutation, PreparationCancelResult, PreparationEvidenceRef, PreparationFailResult, PreparationGrant, PreparationInitialInputLookupV1, PreparationLifecycleState, PreparationListResult, PreparationManifestLookupV1, PreparationManifestV1, PreparationMaterializer, PreparationPhaseSummary, PreparationPreviewResult, PreparationRecoveryResult, PreparationRunLookupV1, PreparationRunRow, PreparationRunState, PreparationStageResult, PreparedEffectRefV1, PrincipalAuthorityError, ProductActionSummary, ProductInvokeResult, ProductPackageManifestV1, ProductPreviewResult, ProfilePack, ProfileTemplatePackage, ProviderBackendChannelV1, ProviderHostBackendV1, ProviderLaunchDescriptorV1, ProviderUnavailableError, QueryResult, QueueFullError, RawPageRef, RecordIntentV1, RecordPreparationResultV1, RelationEndpointError, RelationId, RelationRef, RelationView, RelationWriteDeniedError, RelationsRequireProfileError, RunPreparationInput, RunPreparationResult, RunProjectionAnchor, ScaffoldDirectoriesResultV1, SdkCompileOptions, SdkOperationOptions, SdkPreparationOptions, SdkProductActionInput, SdkProductResumeInput, SdkStageEntityPageInput, SdkStagePreparationInput, SdkTransitionLifecycleInput, SdkWriteArtifactInput, Sha256Digest, SlugSafe, SourceRecord, StageGateProjection, StageGateState, StageOutputRef, StageProjection, StageVerificationFailureV1, StagedArtifactRef, StagedChange, StagedRelationRef, StagingRequiresProfileError, StartViewerOptions, TieredLintReportV1, TrustDecision, UnknownProviderError, VerifiedArtifactBodyV1, VerifiedExperimentStateV1, VerifiedFactPanelV1, VerifiedStageFactsV1, ViewerDeps, WikiOperationSurface, WikiProductSurface, WikiStatus, WorkflowProcessAuthorityError, WorkflowProcessAuthorityV1, WorkflowRefusalV1, WorkflowRun, WorkflowRunProblem, WorkflowRunProjectionEnvelope, WorkflowRunRef, WorkspaceOperationsPackV2, WriteStatus, acquireMutationLockBlocking, activeProfileDigest, artifactPaths, assertCurrentWorkflowProcessAuthority, assertProductDigest, assertRunWorkspace, atomicWrite, canonicalBytes, canonicalDigest, captureVerifiedMemberArtifact, classifyExecutionOwnerLiveness, collectViewerPages, confineUnderRoot, confinedFetch, confinedFetchRequest, defaultHostCompatibility, derivePinForPayload, devEffectiveGrantRequest, devGrantScope, devModelInvokeAuthority, devProviderInvocation, devSourceReadAuthority, ensureConfinedDirectory, formatArtifactRef, hostModelQuoteDigest, installDevProvider, isSlugSafe, isTrustedWriteGranted, issueDevProviderGrant, loadNonDefaultProfile, loadProfile, locatePreparationManifest, memberLeafPath, observeOperationBundle, parseArtifactRef, parseFrontmatter, parseOperationsPack, preparationManifestDigest, providerLaunchEnv, readArtifactMemberBytes, readConfinedCappedBuffer, readLiveTargetDigest, readPreparationEvidenceBytes, readPreparationInitialInput, readPreparationRunForManifest, readRun, readVerifiedArtifactBody, recomputeCompositionLock, recomputePackageDigest, recomputeRuntimeAuthorityDigest, releaseLock, resolveArtifactRef, resolveAuthorizedProviderPaths, resolveBareSlug, resolveConfinedPrivateDir, resolvePreparationRun, resolveProviderEntrypoint, runPreparation, scaffoldConfinedDirectories, scanPreparationInventory, slugify, startViewer, transitionLifecycle } from '@atomicstrata/llmwiki-core'; import { WikiCore, CreateWikiOptions } from '@atomicstrata/llmwiki-core/compiler-sdk'; import { ActionSummary, ActionDetail, WorkflowSummary, WorkflowDetail, AdvanceResult, StageOutput, SubmitResult, ActionRunResult, AdaptationPlan, RefuseWorkflowOptionsV1, HostVerifierRegistryV1, GateChallengeV1, ResolvedStage } from '@atomicstrata/llmwiki-local-workflows'; export { HostVerifierImplementationV1, HumanInputRefV1, HumanInputStageOutput, HumanInputValidationError, WorkflowRefusalError, assertRunOwnership, createVerifierRegistry, currentActorIdentity, predecessorChainRoot, verifierImplementationDigest } from '@atomicstrata/llmwiki-local-workflows'; import { WorkflowEvent, WorkflowRun, WorkflowActorKind, ProjectionResult, VerifierReceiptV1, WorkflowStageDef, LocalWorkflowHost } from '@atomicstrata/llmwiki-core/local-workflow-contracts'; import { RunStatus } from '@atomicstrata/llmwiki-core/compiler-cli'; /** * Workflow-only SDK contract, composed by the standard distribution. * Core consumers do not depend on these execution methods. */ interface WikiWorkflow { /** * @experimental * List the workflow ACTIONS declared in the active profile (id, label, * workflow, operation), sorted by id. A default-profile project (which declares * no actions) yields an empty array. Read-only; no LLM required. * * Foundation API — the shape may change in a future minor release. */ listActions(): Promise; /** * @experimental * Show one declared workflow action with its EFFECTIVE permission per surface * (`min(profile request, local grant, surface hard cap)`) — so an `mcp` request * for `trusted-write` surfaces as `staged-write`. Resolves the id by an * OWN-property check; an undeclared id throws `UnknownActionError`. Read-only; * no LLM required. * * Foundation API — the shape may change in a future minor release. */ showAction(actionId: string): Promise; /** * @experimental * List the workflows declared in the active profile, each with its stage ids * (in declared order). A default-profile project (which declares no workflows) * yields an empty array. Read-only; no LLM required. * * Foundation API — the shape may change in a future minor release. */ listWorkflows(): Promise; /** * @experimental * Show ONE declared workflow's full detail: each stage's * `reads`/`writes`/`gate`/`previousIds`, the workflow's `projectionFile`, and the * ids of declared actions that target it. Resolves the id by an OWN-property * check; an undeclared id throws `UnknownWorkflowError`. Read-only; no LLM required. * * Foundation API — the shape may change in a future minor release. */ showWorkflow(workflowId: string): Promise; /** * @experimental * List one run's recorded audit `events[]`, in append order (the genesis * `workflow-start`, each `stage-advanced`/`gate-approved`/`stage-output`/…, with * actor + stage/gate/decision/detail + state versions). Read-only and * fail-visible: an absent/unavailable/unknown run throws `RunUnavailableError` * rather than an empty list. No LLM required. * * Foundation API — the shape may change in a future minor release. */ listRunEvents(runId: string): Promise; /** * @experimental * Start a new run of a declared workflow, recording any caller `inputs` * (default `{}`). Mints + persists a `pending` run under the project lock; * performs NO stage execution, gate evaluation, or wiki write. Throws * `UnknownWorkflowError` when the id is not declared and `LockBusyError` when * the project is locked — nothing is written in either case. No LLM required. * * Foundation API — the shape may change in a future minor release. */ startWorkflow(workflowId: string, inputs?: Record): Promise; /** * @experimental * Report the status of one run (by id) or of all runs, classified against the * active profile (`current` / `historical` / `needs-adaptation` / * `blocked-by-config`). Read-only and fail-closed: a malformed or unknown run * is surfaced as a `problem`, never thrown. No LLM required. * * Foundation API — the shape may change in a future minor release. */ workflowStatus(runId?: string): Promise; /** * @experimental * Advance an active run by one stage. Clears the current stage and steps to the * next (`outcome:"advanced"`), finishes the run (`"completed"`), parks an * unsatisfied `human:`/`agent:` gate (`"awaiting-gate"`), or parks a * write-declaring / `trust:`-gated stage awaiting a `submitStageOutput` * (`"awaiting-output"`). A terminal run throws `RunNotActiveError`. Runs under * the project lock; no wiki write. No LLM required. * * Foundation API — the shape may change in a future minor release. */ advanceWorkflow(runId: string): Promise; /** * @experimental * Approve a `human:`/`agent:` gate on the run's current stage. Enforces the * security rule that an `agent` actor can never satisfy a `human:` gate * (`GateActorMismatchError`); rejects an unknown gate (`UnknownGateError`), a * `trust:` gate (`TrustGateNotHereError`), and a terminal run * (`RunNotActiveError`). Idempotent for an already-satisfied gate. Runs under * the project lock. No LLM required. * * Foundation API — the shape may change in a future minor release. */ approveGate(runId: string, gateId: string, opts: { actorKind: WorkflowActorKind; actorLabel?: string; }): Promise; /** * @experimental * Cancel an active run (move it to terminal `cancelled`). A terminal run throws * `RunNotActiveError`. Runs under the project lock. No LLM required. * * Foundation API — the shape may change in a future minor release. */ cancelWorkflow(runId: string): Promise; /** * @experimental * Fail an active run (move it to terminal `failed`), recording `detail` as the * reason on the `run-failed` event. Owner-enforced + lock-guarded; a terminal * run throws `RunNotActiveError` and an over-long `detail` throws * `WorkflowFieldTooLongError`. A run failed here is retryable via `resumeWorkflow`. * No LLM required. * * Foundation API — the shape may change in a future minor release. */ failWorkflow(runId: string, detail: string): Promise; /** * @experimental * Resume a `failed` run (retry → `running`), or return an already-active run * unchanged as a position report. A `completed`/`cancelled` run throws * `RunNotActiveError`. Runs under the project lock. No LLM required. * * Foundation API — the shape may change in a future minor release. */ resumeWorkflow(runId: string): Promise; /** * @experimental * Submit a typed output (`page`, `relation`, `lifecycle-transition`, * `artifact`, or declarative `human-input`) to a * run's current write-declaring stage, routing the write through the * scope-gated planner→executor seam under the project lock. A stage may write * ONLY the entity types it declares (`StageWriteScopeError` otherwise). An * `allow`/`allow-with-warning` lands the write live (`applied:true`) and * satisfies a `trust:` gate; a blocked page write stages for review * (`applied:false`); a `deny` / relation / lifecycle denial throws. Rejects a * no-output stage (`StageHasNoWritesError`) and a terminal/absent run * (`RunNotActiveError`/`RunUnavailableError`). No LLM required. * * Foundation API — the shape may change in a future minor release. */ submitStageOutput(runId: string, output: StageOutput): Promise; /** * @experimental * Run a declared workflow action under the COMPOSED authority on the fixed * `sdk` surface (`min(profile request, local grant, sdk hard cap)`) — the * surface is NOT caller-overridable, so a caller cannot claim a higher-cap * surface. Validates `inputs` (default `{}`) against the action's * `inputSchema`, enforces the operation's required capability, then dispatches * to the existing run-lifecycle op. Throws `UnknownActionError` (undeclared * id), `ActionInputError` (input-schema violation), or `ActionDeniedError` * (effective permission cannot satisfy the op) — nothing is written in any of * those cases. No LLM required. * * Foundation API — the shape may change in a future minor release. */ runAction(actionId: string, inputs?: Record): Promise; /** * @experimental * Preview the adaptation plan(s) for one run (by id) or every readable run when * the workflow definition has changed — READ-ONLY (no lock, no write). Each plan * reports the old→new digest, the per-stage old→new mapping, any unmappable * stage ids, and a `lossless` flag. A named-but-unreadable run / unresolvable id * / unavailable store throws (a named run never vanishes as `[]`). No LLM required. * * Foundation API — the shape may change in a future minor release. */ adaptDryRun(runId?: string): Promise; /** * @experimental * Re-anchor a run to the active workflow def under the project lock. A LOSSLESS * adapt remaps the current stage + stage log and re-anchors the digest, so the * run then classifies `current`. A LOSSY adapt (an unmappable stage the run * references) fails closed unless `confirm` — leaving the run byte-unchanged; * with `confirm`, a confirmed unmappable current stage CANCELS the run, the drop * recorded on a `workflow-adapted` event. Throws `AlreadyCurrentError` (no-op), * `UnknownWorkflowError` (workflow removed), `AdaptationRequiresConfirmError` * (lossy + unconfirmed), `RunUnavailableError`/`LockBusyError`. No LLM required. * * Foundation API — the shape may change in a future minor release. */ adaptWorkflowRun(runId: string, opts?: { confirm?: boolean; }): Promise; /** * @experimental * Write a run's DERIVED markdown projection to its workflow's declared * `projectionFile` under `wiki/`. The projection is computed FROM the run JSON * and is a one-way `wiki/` OUTPUT — editing it never affects run state. Returns * `written` with the project-relative path, `no-target` when the workflow * declares no `projectionFile`, or `unavailable` (fail-visible) when the run is * absent/unreadable or the path escapes `wiki/`. Takes NO run lock; no run * mutation. No LLM required. * * Foundation API — the shape may change in a future minor release. */ projectWorkflowRun(runId: string): Promise; } /** * Standard SDK contract combining knowledge and local workflows. * Core-only consumers use WikiCore without requiring the workflow engine. */ interface Wiki extends WikiCore, WikiWorkflow { } /** Create the standard knowledge-plus-local-workflows facade synchronously. */ declare function createWiki(options: CreateWikiOptions): Wiki; /** * Explicit compatibility path: the caller already holds the compiler lock. * No new token argument, lock acquisition, or claim of proven ownership is added. */ declare function startWorkflowLocked(root: string, workflowId: string, inputs: Record, mintId?: (workflowId: string) => string, processOptions?: { workspaceId?: string; required?: boolean; }): Promise; /** Preserve the product/workspace-bound start convenience API. */ declare function startProductWorkflow(root: string, workspaceId: string, workflowId: string, inputs: Record): Promise; /** * Standard compatibility entry points for refuse. * The engine receives services; this facade constructs the compiler host. */ /** Irreversibly refuse a run using its process-declared terminal disposition. */ declare function refuseWorkflow(root: string, runId: string, options: RefuseWorkflowOptionsV1): Promise; /** * Source compatibility exports for optional local workflow verification. * Implementations share identities with the host-constructed engine. */ /** Mint and persist one receipt under the producing stage id. */ declare function mintVerifierReceipt(root: string, runId: string, outputStageId: string, rawArtifactRef: string, verifierId: string, registry: HostVerifierRegistryV1): Promise; /** * Standard compatibility entry points for gate. * The engine receives services; this facade constructs the compiler host. */ /** Resolve and verify the exact gate challenge shown to an operator. */ declare function resolveGateChallenge(root: string, runId: string, gateId: string): Promise; /** * Standard-distribution compatibility entry points for approve-human-interactively. * Host construction stays here; optional engine operations receive a host. */ /** Approve only the exact subject confirmed through this process's terminal. */ declare function approveHumanGateInteractively(root: string, runId: string, gateId: string): Promise; /** * Standard compatibility entry points for advance. * The engine receives services; this facade constructs the compiler host. */ /** Preserve the standard compiler reader for callers of the legacy helper. */ declare function resolveCurrentStage(root: string, run: WorkflowRun, readProfile?: typeof loadProfile): Promise; /** * Source compatibility exports for host-bound workflow output contracts. * Execution helpers belong to the optional engine and require supplied services. */ type ProductObservations = Pick; /** Preserve the public verification helper and its standard compiler observations. */ declare function assertProductOperationOutputCurrent(root: string, run: WorkflowRun, stage: WorkflowStageDef, observations?: ProductObservations): Promise; /** Preserve the public verification helper and its standard compiler observations. */ declare function assertProductStageOutputCurrent(root: string, run: WorkflowRun, stage: WorkflowStageDef, observations?: ProductObservations): Promise; export { type Wiki, approveHumanGateInteractively, assertProductOperationOutputCurrent, assertProductStageOutputCurrent, createWiki, mintVerifierReceipt, refuseWorkflow, resolveCurrentStage, resolveGateChallenge, startProductWorkflow, startWorkflowLocked };