@rine-kit/presentation 0.0.0-stage → 0.1.1

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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/dist/src/builders/pubg.d.ts +35 -0
  3. package/dist/src/builders/pubg.js +725 -0
  4. package/dist/src/contracts/owner.d.ts +20 -0
  5. package/dist/src/contracts/owner.js +1 -0
  6. package/dist/src/contracts/pubg.d.ts +200 -0
  7. package/dist/src/contracts/pubg.js +1 -0
  8. package/dist/src/contracts/session-review.d.ts +72 -0
  9. package/dist/src/contracts/session-review.js +1 -0
  10. package/dist/src/index.d.ts +19 -0
  11. package/dist/src/index.js +19 -0
  12. package/dist/src/pubg-registry.d.ts +21 -0
  13. package/dist/src/pubg-registry.js +123 -0
  14. package/dist/src/renderers/daily-review.d.ts +22 -0
  15. package/dist/src/renderers/daily-review.js +149 -0
  16. package/dist/src/renderers/owner.d.ts +6 -0
  17. package/dist/src/renderers/owner.js +35 -0
  18. package/dist/src/renderers/pubg.d.ts +22 -0
  19. package/dist/src/renderers/pubg.js +603 -0
  20. package/dist/src/renderers/session-review.d.ts +15 -0
  21. package/dist/src/renderers/session-review.js +187 -0
  22. package/dist/src/reply-check.d.ts +3 -0
  23. package/dist/src/reply-check.js +44 -0
  24. package/dist/src/reply-guides.d.ts +10 -0
  25. package/dist/src/reply-guides.js +64 -0
  26. package/dist/src/time/format.d.ts +16 -0
  27. package/dist/src/time/format.js +63 -0
  28. package/dist/src/validation/session-review.d.ts +3 -0
  29. package/dist/src/validation/session-review.js +136 -0
  30. package/dist/src/validation/validate.d.ts +18 -0
  31. package/dist/src/validation/validate.js +736 -0
  32. package/dist/src/worldline/adapter.d.ts +3 -0
  33. package/dist/src/worldline/adapter.js +47 -0
  34. package/dist/src/worldline/contracts.d.ts +44 -0
  35. package/dist/src/worldline/contracts.js +40 -0
  36. package/dist/src/worldline/policy.d.ts +2 -0
  37. package/dist/src/worldline/policy.js +31 -0
  38. package/dist/src/worldline/renderer.d.ts +3 -0
  39. package/dist/src/worldline/renderer.js +5 -0
  40. package/dist/src/worldline/vocabulary.d.ts +2 -0
  41. package/dist/src/worldline/vocabulary.js +1 -0
  42. package/package.json +33 -3
  43. package/README.md +0 -3
@@ -0,0 +1,3 @@
1
+ import type { OwnerNotificationPresentation } from '../contracts/owner.js';
2
+ import type { WorldlineNotificationIntent } from './contracts.js';
3
+ export declare function adaptWorldlineNotification(intent: WorldlineNotificationIntent): OwnerNotificationPresentation;
@@ -0,0 +1,47 @@
1
+ import { assertValid, validateOwnerNotificationPresentation } from '../validation/validate.js';
2
+ import { WORLDLINE_THEME_LABELS } from './contracts.js';
3
+ import { selectWorldlineTheme } from './policy.js';
4
+ function validateIntent(intent) {
5
+ if (intent.type !== 'worldline_notification_intent')
6
+ throw new Error('worldline intent type is invalid');
7
+ if (!intent.eventType.trim() ||
8
+ !intent.kind.trim() ||
9
+ !intent.eventKey.trim() ||
10
+ !intent.source.trim())
11
+ throw new Error('worldline intent identity is required');
12
+ if (!Number.isFinite(Date.parse(intent.occurredAt)))
13
+ throw new Error('worldline intent occurredAt must be an ISO timestamp');
14
+ if (intent.dataUpdatedAt !== undefined && !Number.isFinite(Date.parse(intent.dataUpdatedAt)))
15
+ throw new Error('worldline intent dataUpdatedAt must be an ISO timestamp');
16
+ const occurrenceCount = intent.correlation?.occurrenceCount ?? intent.occurrenceCount;
17
+ if (occurrenceCount !== undefined && (!Number.isInteger(occurrenceCount) || occurrenceCount < 1))
18
+ throw new Error('worldline intent occurrenceCount must be a positive integer');
19
+ if (intent.correlation?.windowMinutes !== undefined &&
20
+ (!Number.isInteger(intent.correlation.windowMinutes) || intent.correlation.windowMinutes < 1))
21
+ throw new Error('worldline intent windowMinutes must be a positive integer');
22
+ return intent;
23
+ }
24
+ export function adaptWorldlineNotification(intent) {
25
+ const valid = validateIntent(intent);
26
+ const theme = selectWorldlineTheme(valid);
27
+ const label = WORLDLINE_THEME_LABELS[theme];
28
+ const headline = valid.headline?.trim()
29
+ ? `Amadeus • ${label} · ${valid.headline.trim()}`
30
+ : `Amadeus • ${label}`;
31
+ return assertValid(validateOwnerNotificationPresentation({
32
+ type: 'owner_notification',
33
+ eventType: valid.eventType,
34
+ severity: valid.severity,
35
+ significance: valid.significance,
36
+ theme,
37
+ eventKey: valid.eventKey,
38
+ source: valid.source,
39
+ headline,
40
+ facts: valid.facts,
41
+ ...(valid.summary?.trim() ? { summary: valid.summary.trim() } : {}),
42
+ ...(valid.links?.length ? { links: valid.links } : {}),
43
+ ...(valid.dataUpdatedAt ? { dataUpdatedAt: valid.dataUpdatedAt } : {}),
44
+ occurredAt: valid.occurredAt,
45
+ ...(valid.worldLineClosing ? { worldLineClosing: true } : {}),
46
+ }));
47
+ }
@@ -0,0 +1,44 @@
1
+ export declare const WORLDLINE_THEMES: readonly ["worldline_observation", "worldline_divergence", "worldline_convergence", "dmail", "reading_steiner", "attractor_field", "sern_alert", "ibn_5100", "time_leap", "operation_skuld", "rounder_activity"];
2
+ export type WorldlineTheme = (typeof WORLDLINE_THEMES)[number];
3
+ export declare const WORLDLINE_THEME_LABELS: Record<WorldlineTheme, string>;
4
+ export declare const WORLDLINE_SIGNIFICANCES: readonly ["minor", "notable", "major", "critical"];
5
+ export type WorldlineSignificance = (typeof WORLDLINE_SIGNIFICANCES)[number];
6
+ export type PresentationScalar = string | number | boolean | null;
7
+ export interface PresentationFact {
8
+ label: string;
9
+ value: PresentationScalar;
10
+ evidenceRefs: string[];
11
+ }
12
+ export interface PresentationLink {
13
+ label: string;
14
+ url: string;
15
+ evidenceRefs?: string[];
16
+ }
17
+ export interface WorldlineNotificationIntent {
18
+ type: 'worldline_notification_intent';
19
+ eventType: string;
20
+ kind: string;
21
+ severity: 'info' | 'success' | 'warning' | 'error';
22
+ significance: WorldlineSignificance;
23
+ eventKey: string;
24
+ source: string;
25
+ headline?: string;
26
+ summary?: string;
27
+ facts: PresentationFact[];
28
+ links?: PresentationLink[];
29
+ dataUpdatedAt?: string;
30
+ occurredAt: string;
31
+ worldLineClosing?: boolean;
32
+ occurrenceCount?: number;
33
+ correlation?: {
34
+ fingerprint?: string;
35
+ occurrenceCount?: number;
36
+ windowMinutes?: number;
37
+ };
38
+ operation?: {
39
+ code?: string;
40
+ phase?: string;
41
+ };
42
+ }
43
+ export declare const WORLDLINE_PRODUCER_REGISTRY: readonly ["product-radar", "market", "pubg-sync", "release", "codex", "vps", "vps-traffic-fuse", "homelab", "nas", "media", "storage"];
44
+ export type WorldlineProducer = (typeof WORLDLINE_PRODUCER_REGISTRY)[number];
@@ -0,0 +1,40 @@
1
+ export const WORLDLINE_THEMES = [
2
+ 'worldline_observation',
3
+ 'worldline_divergence',
4
+ 'worldline_convergence',
5
+ 'dmail',
6
+ 'reading_steiner',
7
+ 'attractor_field',
8
+ 'sern_alert',
9
+ 'ibn_5100',
10
+ 'time_leap',
11
+ 'operation_skuld',
12
+ 'rounder_activity',
13
+ ];
14
+ export const WORLDLINE_THEME_LABELS = {
15
+ worldline_observation: '世界线观测',
16
+ worldline_divergence: '世界线偏移',
17
+ worldline_convergence: '世界线收束',
18
+ dmail: 'D-Mail',
19
+ reading_steiner: 'Reading Steiner',
20
+ attractor_field: '吸引子场',
21
+ rounder_activity: 'Rounder 活动',
22
+ sern_alert: 'SERN 警报',
23
+ ibn_5100: 'IBN 5100',
24
+ time_leap: '时间跳跃',
25
+ operation_skuld: 'Operation Skuld · 斯库尔德行动',
26
+ };
27
+ export const WORLDLINE_SIGNIFICANCES = ['minor', 'notable', 'major', 'critical'];
28
+ export const WORLDLINE_PRODUCER_REGISTRY = [
29
+ 'product-radar',
30
+ 'market',
31
+ 'pubg-sync',
32
+ 'release',
33
+ 'codex',
34
+ 'vps',
35
+ 'vps-traffic-fuse',
36
+ 'homelab',
37
+ 'nas',
38
+ 'media',
39
+ 'storage',
40
+ ];
@@ -0,0 +1,2 @@
1
+ import type { WorldlineNotificationIntent, WorldlineTheme } from './contracts.js';
2
+ export declare function selectWorldlineTheme(intent: WorldlineNotificationIntent): WorldlineTheme;
@@ -0,0 +1,31 @@
1
+ function has(kind, ...values) {
2
+ return values.includes(kind);
3
+ }
4
+ export function selectWorldlineTheme(intent) {
5
+ const kind = intent.kind.trim().toLowerCase();
6
+ if (has(kind, 'operation', 'migration', 'migration_readiness', 'readiness', 'skuld'))
7
+ return 'operation_skuld';
8
+ if (has(kind, 'rollback', 'restore', 'recovery_checkpoint'))
9
+ return 'time_leap';
10
+ if (has(kind, 'critical_dependency', 'dependency_failure'))
11
+ return 'ibn_5100';
12
+ if (has(kind, 'state_drift', 'config_drift', 'identity_drift'))
13
+ return 'reading_steiner';
14
+ const occurrenceCount = intent.correlation?.occurrenceCount ?? intent.occurrenceCount;
15
+ if (occurrenceCount !== undefined && occurrenceCount >= 3 && intent.severity !== 'success')
16
+ return 'attractor_field';
17
+ if (has(kind, 'confirmed_compromise', 'security_incident') &&
18
+ intent.severity === 'error' &&
19
+ intent.significance === 'critical')
20
+ return 'sern_alert';
21
+ if (has(kind, 'security_scan', 'security_probe', 'auth_anomaly', 'probe'))
22
+ return 'rounder_activity';
23
+ if (has(kind, 'scheduled_report', 'telemetry_sync', 'market_report', 'heartbeat', 'daily_report'))
24
+ return 'dmail';
25
+ if (has(kind, 'release', 'deployment', 'source_recovered', 'operation_completed') &&
26
+ intent.severity === 'success')
27
+ return 'worldline_convergence';
28
+ if (has(kind, 'price_changed', 'status_changed', 'network_degraded', 'source_degraded', 'dependency_degraded', 'delivery_failed'))
29
+ return 'worldline_divergence';
30
+ return 'worldline_observation';
31
+ }
@@ -0,0 +1,3 @@
1
+ import type { OwnerNotificationRenderOptions } from '../renderers/owner.js';
2
+ import type { WorldlineNotificationIntent } from './contracts.js';
3
+ export declare function renderWorldlineNotification(intent: WorldlineNotificationIntent, options?: OwnerNotificationRenderOptions): string;
@@ -0,0 +1,5 @@
1
+ import { renderOwnerNotification } from '../renderers/owner.js';
2
+ import { adaptWorldlineNotification } from './adapter.js';
3
+ export function renderWorldlineNotification(intent, options = {}) {
4
+ return renderOwnerNotification(adaptWorldlineNotification(intent), options);
5
+ }
@@ -0,0 +1,2 @@
1
+ export { WORLDLINE_SIGNIFICANCES, WORLDLINE_THEMES, WORLDLINE_THEME_LABELS } from './contracts.js';
2
+ export type { WorldlineSignificance, WorldlineTheme } from './contracts.js';
@@ -0,0 +1 @@
1
+ export { WORLDLINE_SIGNIFICANCES, WORLDLINE_THEMES, WORLDLINE_THEME_LABELS } from './contracts.js';
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@rine-kit/presentation",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "description": "PUBG reply presentation: contracts, builders and renderers (Markdown / messenger-neutral) used by the PUBG domain. Extracted from Lab.",
6
+ "license": "MIT",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/src/index.d.ts",
10
+ "import": "./dist/src/index.js",
11
+ "default": "./dist/src/index.js"
12
+ }
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "files": [
18
+ "dist/src"
19
+ ],
20
+ "dependencies": {},
21
+ "devDependencies": {
22
+ "@types/node": "^26.6.5",
23
+ "tsx": "^4.23.15",
24
+ "typescript": "^5.9.2"
25
+ },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+ssh://git@github.com/ChristmasFox/rine-kit.git",
29
+ "directory": "packages/presentation"
30
+ },
31
+ "scripts": {
32
+ "build": "tsc -p tsconfig.json",
33
+ "typecheck": "tsc -p tsconfig.json --noEmit",
34
+ "test": "tsx --test \"tests/**/*.test.ts\""
35
+ }
6
36
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.