@hasna/projects
Version:
High-level project management CLI, MCP server, SDK, and AI SDK agent loop for coding agents
78 lines • 5.83 kB
TypeScript
import type { ProjectResourceAuthority, ProjectResourceLink, ProjectResourceLinkInput, ProjectResourceLinkRow, ProjectResourceLinkSnapshot, ProjectResourceLinkCollectionV1, Workspace, WorkspaceIntegrations } from "../types/workspace.js";
export type { ProjectResourceLinkInput } from "../types/workspace.js";
export { PROJECT_RESOURCE_LINK_DEFAULT_MAX_ITEMS } from "../types/workspace.js";
export declare const COMPLETE_EXTERNAL_UUID_PATTERN = "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$";
/**
* The accepted `service_instance` form for every authority whose live
* capability is the authority-qualified urn emitted by
* `registrationResourceLink`.
*/
export declare const PROJECT_RESOURCE_SERVICE_INSTANCE_URN_FORM = "urn:hasna:<authority>:service:<authority_id>:tenant:<tenant_id>:corpus:<corpus_id>";
/** The canonical Files project locator prefix (contracts 1.3.4 files branch). */
export declare const PROJECT_RESOURCE_FILES_PROJECT_URN_PREFIX = "urn:hasna:files:project:";
export declare function projectResourceLinkConversationsChannelLocatorKind(value: string): "external_uuid" | "conversations_channel_id" | null;
export declare function canonicalProjectResourceLinkUri(value: string, label: string): string;
/**
* Write-path guard for `service_instance` (A3-00873: the retired origin was
* accepted by every writer because the value was validated only as a required
* non-empty string, so `resource-links-add --links-json` could persist a
* retired host or any arbitrary URL).
*
* An authority whose live capability is the authority-qualified urn must emit
* that urn form; every bare service URL — the retired origins and the older
* gateway URLs alike — is refused, and the refusal echoes the refused value so
* the caller sees exactly what was rejected. No retired-origin literal appears
* here on purpose: this package is public, and the repo's publish guard forbids
* the internal origin domain in a packed artifact.
*
* The read path stays permissive on purpose: stored legacy rows remain
* readable until the reviewed migration corrects them, and an inverse
* (rollback) write restores a preserved pre-change original.
*/
export declare function assertProjectResourceLinkServiceInstanceWritable(authority: ProjectResourceAuthority, serviceInstance: string): string;
/** Write-path guard over a whole requested link collection. */
export declare function assertProjectResourceLinksWritable(links: readonly ProjectResourceLinkInput[]): void;
export declare function normalizeProjectResourceLink(input: ProjectResourceLinkInput): ProjectResourceLinkInput;
export declare function projectResourceLinkIdentity(input: ProjectResourceLinkInput): Record<string, string>;
export declare function projectResourceLinkId(projectId: string, input: ProjectResourceLinkInput): string;
export declare function normalizeProjectResourceLinks(inputs: readonly ProjectResourceLinkInput[]): ProjectResourceLinkInput[];
export declare function rowToProjectResourceLink(row: ProjectResourceLinkRow): ProjectResourceLink;
export declare function projectResourceLinksDigest(links: readonly ProjectResourceLink[]): string;
export declare function projectResourceLinkIntegrationProjection(integrations: WorkspaceIntegrations, beforeLinks: readonly ProjectResourceLink[], afterLinks: readonly ProjectResourceLink[]): WorkspaceIntegrations;
export declare function normalizeProjectResourceLinkIntegrations(value: unknown): WorkspaceIntegrations | undefined;
export declare const PROJECT_RESOURCE_LINK_INTEGRATION_KEYS: ("todos_project_id" | "todos_task_list_id" | "mementos_project_id" | "orgs_org_id" | "orgs_project_id" | "conversations_channel")[];
export interface ProjectResourceLinkIntegrationProjectionComparison {
/**
* False when the candidate carries no integrations object to compare. The
* projection cannot be proven fresh from a missing snapshot, so callers must
* fail closed rather than report it healthy; `drifted` then names the keys
* the project row projects (the values that could not be verified).
*/
comparable: boolean;
/** Projection keys whose candidate value differs from the project row. */
drifted: string[];
}
/**
* The station-local project marker stores the row's `integrations` as a
* snapshot (`writeWorkspaceMarker`), while a resource-links reconciliation
* rewrites only the row (`mutateProjectResourceLinks`) — so the marker's typed
* projection can be outrun while its id/slug still match (A3-00741). This is
* the comparison the doctor uses; it is deliberately scoped to the projection
* keys this module owns, the scalars a resource link is authoritative for.
*/
export declare function compareProjectResourceLinkIntegrationProjection(projectIntegrations: WorkspaceIntegrations | undefined, candidate: unknown): ProjectResourceLinkIntegrationProjectionComparison;
export declare function assertProjectResourceLinkIntegrationMutation(beforeIntegrations: WorkspaceIntegrations, proposedIntegrations: WorkspaceIntegrations, links: readonly ProjectResourceLink[]): void;
export declare function projectResourceLinkSnapshot(project: Workspace, links: ProjectResourceLink[]): ProjectResourceLinkSnapshot;
export declare function projectResourceLinkCollection(projectId: string, currentRevision: string, links: ProjectResourceLink[], maxItems: number): ProjectResourceLinkCollectionV1;
export declare function assertProjectResourceLinkReadContractEquality(read: {
project_id: string;
current_revision: string;
links: ProjectResourceLink[];
link_count: number;
max_items: number;
collection_digest: string;
complete: boolean;
truncated: boolean;
contract: ProjectResourceLinkCollectionV1;
}): void;
//# sourceMappingURL=project-resource-links.d.ts.map