feat(contracts): @insignia/iios-contracts — scope, enums, platform ports, CloudEvents, errors

Verbatim IiosPlatformPorts from the bottom-up atlas; orgId/appId required scope
(KG-02); PolicyDeniedError for fail-closed. Vitest as workspace test runner.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-30 20:59:34 +05:30
parent c00d038df2
commit fbea291609
12 changed files with 1248 additions and 3 deletions
+58
View File
@@ -0,0 +1,58 @@
/**
* Kernel enums, lifted verbatim from the Bottom-Up Evolution Atlas §10 DDL.
* Exposed as const arrays + derived union types so they are usable both as
* compile-time types and for runtime validation.
*/
export const ACTOR_KINDS = ['HUMAN', 'AI', 'SERVICE', 'BOT', 'UNKNOWN'] as const;
export type ActorKind = (typeof ACTOR_KINDS)[number];
export const HANDLE_KINDS = [
'PORTAL_USER',
'EMAIL',
'PHONE',
'WHATSAPP',
'SLACK',
'MATTERMOST',
'TELEGRAM',
'EXTERNAL_VISITOR',
] as const;
export type HandleKind = (typeof HANDLE_KINDS)[number];
export const INTERACTION_KINDS = [
'MESSAGE',
'EMAIL',
'SYSTEM_NOTICE',
'INBOX_WORK',
'SUPPORT_CASE',
'MEETING_REQUEST',
'DIGEST',
'SUMMARY',
'NOTIFICATION',
] as const;
export type InteractionKind = (typeof INTERACTION_KINDS)[number];
export const MESSAGE_PART_KINDS = [
'TEXT',
'HTML',
'MARKDOWN',
'MEDIA_REF',
'FILE_REF',
'VOICE_REF',
'LOCATION',
'STRUCTURED_JSON',
] as const;
export type MessagePartKind = (typeof MESSAGE_PART_KINDS)[number];
export const DELIVERY_STATES = [
'RECEIVED',
'NORMALIZED',
'POLICY_HELD',
'STORED',
'DELIVERED',
'READ',
'FAILED',
'DELETED_LOCAL',
'REDACTED',
] as const;
export type DeliveryState = (typeof DELIVERY_STATES)[number];