@gitgov/core 2.6.0 → 2.7.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.
@@ -1,4 +1,65 @@
1
- import { R as RecordStore } from './record_store-BXKWqon5.js';
1
+ /**
2
+ * IdEncoder for transforming IDs to storage-safe filenames.
3
+ * Useful for characters not allowed in filesystem (e.g., `:` on Windows)
4
+ * or URL-unsafe characters in remote backends.
5
+ */
6
+ interface IdEncoder {
7
+ /** Transform ID to storage-safe string */
8
+ encode: (id: string) => string;
9
+ /** Recover original ID from encoded string */
10
+ decode: (encoded: string) => string;
11
+ }
12
+ /**
13
+ * Default encoder: `:` → `_` (for IDs like "human:camilo")
14
+ * Reversible because IDs cannot contain `_` (see id_generator.ts)
15
+ */
16
+ declare const DEFAULT_ID_ENCODER: IdEncoder;
17
+ /**
18
+ * RecordStore<V, R, O> - Generic interface for record persistence
19
+ *
20
+ * Abstracts CRUD operations without assuming storage backend.
21
+ * Each implementation decides how to persist (fs, memory, db, remote).
22
+ *
23
+ * @typeParam V - Value type (the record being stored)
24
+ * @typeParam R - Return type for write operations (default: void for local, GitHubWriteResult for GitHub)
25
+ * @typeParam O - Options type for write operations (default: void for local, GitHubWriteOpts for GitHub)
26
+ */
27
+ interface RecordStore<V, R = void, O = void> {
28
+ /**
29
+ * Gets a record by ID
30
+ * @returns The record or null if it doesn't exist
31
+ */
32
+ get(id: string): Promise<V | null>;
33
+ /**
34
+ * Persists a record
35
+ * @param id - Unique identifier
36
+ * @param value - The record to persist
37
+ */
38
+ put(id: string, value: V, ...opts: O extends void ? [] : [opts?: O]): Promise<R>;
39
+ /**
40
+ * Persists multiple records in a single operation.
41
+ * Local backends iterate sequentially; GitHub backend uses atomic commits.
42
+ */
43
+ putMany(entries: Array<{
44
+ id: string;
45
+ value: V;
46
+ }>, ...opts: O extends void ? [] : [opts?: O]): Promise<R>;
47
+ /**
48
+ * Deletes a record
49
+ * @param id - Identifier of the record to delete
50
+ */
51
+ delete(id: string, ...opts: O extends void ? [] : [opts?: O]): Promise<R>;
52
+ /**
53
+ * Lists all record IDs
54
+ * @returns Array of IDs
55
+ */
56
+ list(): Promise<string[]>;
57
+ /**
58
+ * Checks if a record exists
59
+ * @param id - Identifier to check
60
+ */
61
+ exists(id: string): Promise<boolean>;
62
+ }
2
63
 
3
64
  /**
4
65
  * This file was automatically generated from actor_record_schema.json.
@@ -453,15 +514,7 @@ type EmbeddedMetadataRecord$1 = {
453
514
  /**
454
515
  * The type of the record contained in the payload.
455
516
  */
456
- type: 'actor' | 'agent' | 'task' | 'execution' | 'changelog' | 'feedback' | 'cycle' | 'custom';
457
- /**
458
- * Optional URL to a custom schema for the payload.
459
- */
460
- schemaUrl?: string;
461
- /**
462
- * Optional SHA-256 checksum of the custom schema.
463
- */
464
- schemaChecksum?: string;
517
+ type: 'actor' | 'agent' | 'task' | 'execution' | 'changelog' | 'feedback' | 'cycle';
465
518
  /**
466
519
  * SHA-256 checksum of the canonically serialized payload.
467
520
  */
@@ -546,21 +599,14 @@ type EmbeddedMetadataRecord<T extends GitGovRecordPayload> = {
546
599
  payload: T;
547
600
  };
548
601
 
549
- /**
550
- * A custom record type for testing purposes.
551
- */
552
- type CustomRecord = {
553
- type: 'custom';
554
- data: unknown;
555
- };
556
602
  /**
557
603
  * Defines the possible 'type' values for any record in the system.
558
604
  */
559
- type GitGovRecordType = "actor" | "agent" | "cycle" | "task" | "execution" | "changelog" | "feedback" | "custom";
605
+ type GitGovRecordType = "actor" | "agent" | "cycle" | "task" | "execution" | "changelog" | "feedback";
560
606
  /**
561
607
  * The canonical payload for any GitGovernance record.
562
608
  */
563
- type GitGovRecordPayload = ActorRecord | AgentRecord | CycleRecord | TaskRecord | ExecutionRecord | ChangelogRecord | FeedbackRecord | CustomRecord;
609
+ type GitGovRecordPayload = ActorRecord | AgentRecord | CycleRecord | TaskRecord | ExecutionRecord | ChangelogRecord | FeedbackRecord;
564
610
  /**
565
611
  * The canonical type for any record in GitGovernance, wrapping a payload with metadata.
566
612
  */
@@ -1163,8 +1209,7 @@ type ProjectionContext = {
1163
1209
  *
1164
1210
  * Abstracts where IndexData is persisted. Implementations:
1165
1211
  * - FsRecordProjection: writes to .gitgov/index.json (CLI)
1166
- * - MemoryRecordProjection: in-memory Map (tests)
1167
- * - PrismaRecordProjection: stores as JSON blob via Prisma-compatible client (SaaS)
1212
+ * - PrismaRecordProjection: decomposes into 6 queryable Prisma tables (SaaS)
1168
1213
  */
1169
1214
  interface IRecordProjection {
1170
1215
  persist(data: IndexData, context: ProjectionContext): Promise<void>;
@@ -1204,4 +1249,4 @@ interface IRecordProjector {
1204
1249
  invalidateCache(): Promise<void>;
1205
1250
  }
1206
1251
 
1207
- export { type FeedbackCreatedEvent as $, type ActorPayload as A, type ProductivityMetrics as B, type ChangelogPayload as C, RecordMetrics as D, type EmbeddedMetadataHeader as E, type FeedbackPayload as F, type GitGovRecord as G, type RecordMetricsDependencies as H, type IRecordProjector as I, type SystemStatus as J, type TaskHealthReport as K, type ActivityEvent as L, type ActorCreatedEvent as M, type ActorRevokedEvent as N, type AgentRegisteredEvent as O, type ProjectionContext as P, type BaseEvent as Q, type RecordStores as R, type Signature as S, type TaskPayload as T, type ChangelogCreatedEvent as U, type CycleCreatedEvent as V, type CycleStatusChangedEvent as W, type EventHandler as X, type EventMetadata as Y, type EventSubscription as Z, type ExecutionCreatedEvent as _, type IRecordProjection as a, type GitGovEvent as a0, type SystemDailyTickEvent as a1, type TaskCreatedEvent as a2, type TaskStatusChangedEvent as a3, type RecordProjectorDependencies as a4, type IndexGenerationReport as a5, type IntegrityReport as a6, type AllRecords as a7, type DerivedStates as a8, type EnrichedTaskRecord as a9, type DerivedStateSets as aa, type IntegrityError as ab, type IntegrityWarning as ac, type IndexData as b, type ActorRecord as c, type AgentPayload as d, type AgentRecord as e, type ChangelogRecord as f, type CustomRecord as g, type CyclePayload as h, type CycleRecord as i, type EmbeddedMetadataRecord as j, type ExecutionPayload as k, type ExecutionRecord as l, type FeedbackRecord as m, type GitGovActorRecord as n, type GitGovAgentRecord as o, type GitGovChangelogRecord as p, type GitGovCycleRecord as q, GitGovError as r, type GitGovExecutionRecord as s, type GitGovFeedbackRecord as t, type GitGovRecordPayload as u, type GitGovRecordType as v, type GitGovTaskRecord as w, type TaskRecord as x, type CollaborationMetrics as y, type IRecordMetrics as z };
1252
+ export { type EventSubscription as $, type ActorPayload as A, type IRecordMetrics as B, type ChangelogPayload as C, DEFAULT_ID_ENCODER as D, type EmbeddedMetadataHeader as E, type FeedbackPayload as F, type GitGovRecord as G, type ProductivityMetrics as H, type IdEncoder as I, RecordMetrics as J, type RecordMetricsDependencies as K, type SystemStatus as L, type TaskHealthReport as M, type ActivityEvent as N, type ActorCreatedEvent as O, type ProjectionContext as P, type ActorRevokedEvent as Q, type RecordStore as R, type Signature as S, type TaskPayload as T, type AgentRegisteredEvent as U, type BaseEvent as V, type ChangelogCreatedEvent as W, type CycleCreatedEvent as X, type CycleStatusChangedEvent as Y, type EventHandler as Z, type EventMetadata as _, type IRecordProjector as a, type ExecutionCreatedEvent as a0, type FeedbackCreatedEvent as a1, type GitGovEvent as a2, type SystemDailyTickEvent as a3, type TaskCreatedEvent as a4, type TaskStatusChangedEvent as a5, type RecordProjectorDependencies as a6, type IndexGenerationReport as a7, type IntegrityReport as a8, type AllRecords as a9, type DerivedStates as aa, type EnrichedTaskRecord as ab, type DerivedStateSets as ac, type IntegrityError as ad, type IntegrityWarning as ae, type IRecordProjection as b, type IndexData as c, type ActorRecord as d, type AgentPayload as e, type AgentRecord as f, type ChangelogRecord as g, type CyclePayload as h, type CycleRecord as i, type EmbeddedMetadataRecord as j, type ExecutionPayload as k, type ExecutionRecord as l, type FeedbackRecord as m, type GitGovActorRecord as n, type GitGovAgentRecord as o, type GitGovChangelogRecord as p, type GitGovCycleRecord as q, GitGovError as r, type GitGovExecutionRecord as s, type GitGovFeedbackRecord as t, type GitGovRecordPayload as u, type GitGovRecordType as v, type GitGovTaskRecord as w, type TaskRecord as x, type RecordStores as y, type CollaborationMetrics as z };
@@ -0,0 +1,50 @@
1
+ import { a as GitGovSession } from './index-LULVRsCZ.js';
2
+
3
+ /**
4
+ * SessionStore - Session persistence abstraction
5
+ *
6
+ * Interface for storing and retrieving local session state (.session.json).
7
+ * Session state is ephemeral, machine-local, and NOT versioned in Git.
8
+ *
9
+ * Implementations:
10
+ * - FsSessionStore: Filesystem-based (production)
11
+ * - MemorySessionStore: In-memory (tests, serverless)
12
+ */
13
+
14
+ /**
15
+ * Interface for session state persistence.
16
+ *
17
+ * Session state includes:
18
+ * - Actor state (activeTaskId, activeCycleId, syncStatus)
19
+ * - Sync preferences (pullScheduler, fileWatcher settings)
20
+ * - Cloud session tokens
21
+ * - Last session information
22
+ *
23
+ * Unlike ConfigStore, SessionStore handles ephemeral, machine-local state
24
+ * that is NOT shared between collaborators.
25
+ */
26
+ interface SessionStore {
27
+ /**
28
+ * Load session state from storage.
29
+ *
30
+ * @returns GitGovSession object or null if not found
31
+ */
32
+ loadSession(): Promise<GitGovSession | null>;
33
+ /**
34
+ * Save session state to storage.
35
+ *
36
+ * @param session - The session state to persist
37
+ */
38
+ saveSession(session: GitGovSession): Promise<void>;
39
+ /**
40
+ * Detect actor from private key files.
41
+ *
42
+ * Optional method for implementations that support actor auto-detection
43
+ * from .key files in the actors directory.
44
+ *
45
+ * @returns Actor ID (e.g., "human:camilo-v2") or null if not detectable
46
+ */
47
+ detectActorFromKeyFiles?(): Promise<string | null>;
48
+ }
49
+
50
+ export type { SessionStore as S };