nawabari 0.8.0 → 0.9.2

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 (52) hide show
  1. package/README.md +35 -0
  2. package/dist/cli-command-registry.d.ts +6 -0
  3. package/dist/cli-command-registry.js +26 -5
  4. package/dist/cli-command-registry.js.map +1 -1
  5. package/dist/cli.js +70 -8
  6. package/dist/cli.js.map +1 -1
  7. package/dist/contract.js +35 -0
  8. package/dist/contract.js.map +1 -1
  9. package/dist/domain/doctor.js +44 -0
  10. package/dist/domain/doctor.js.map +1 -1
  11. package/dist/domain/session-backend.d.ts +2 -1
  12. package/dist/domain/session-backend.js +119 -18
  13. package/dist/domain/session-backend.js.map +1 -1
  14. package/dist/domain/session.d.ts +100 -19
  15. package/dist/domain/session.js.map +1 -1
  16. package/dist/product-state-manifest.d.ts +152 -0
  17. package/dist/product-state-manifest.js +240 -0
  18. package/dist/product-state-manifest.js.map +1 -0
  19. package/dist/public-contract.d.ts +25 -0
  20. package/dist/public-contract.js +29 -0
  21. package/dist/public-contract.js.map +1 -0
  22. package/dist/public-state.d.ts +75 -0
  23. package/dist/public-state.js +60 -0
  24. package/dist/public-state.js.map +1 -0
  25. package/dist/session-lifecycle-actions.d.ts +4 -3
  26. package/dist/session-lifecycle-actions.js +14 -5
  27. package/dist/session-lifecycle-actions.js.map +1 -1
  28. package/dist/session-lifecycle-classification.d.ts +55 -2
  29. package/dist/session-lifecycle-classification.js +39 -306
  30. package/dist/session-lifecycle-classification.js.map +1 -1
  31. package/dist/session-registry.d.ts +83 -1
  32. package/dist/session-registry.js +440 -21
  33. package/dist/session-registry.js.map +1 -1
  34. package/dist/state/index.d.ts +5 -0
  35. package/dist/state/index.js +4 -0
  36. package/dist/state/index.js.map +1 -0
  37. package/dist/state/session/actors.d.ts +71 -0
  38. package/dist/state/session/actors.js +259 -0
  39. package/dist/state/session/actors.js.map +1 -0
  40. package/dist/state/session/guards.d.ts +25 -0
  41. package/dist/state/session/guards.js +108 -0
  42. package/dist/state/session/guards.js.map +1 -0
  43. package/dist/state/session/index.d.ts +6 -0
  44. package/dist/state/session/index.js +5 -0
  45. package/dist/state/session/index.js.map +1 -0
  46. package/dist/state/session/machine.d.ts +185 -0
  47. package/dist/state/session/machine.js +408 -0
  48. package/dist/state/session/machine.js.map +1 -0
  49. package/dist/state/session/types.d.ts +94 -0
  50. package/dist/state/session/types.js +14 -0
  51. package/dist/state/session/types.js.map +1 -0
  52. package/package.json +26 -6
@@ -8,7 +8,7 @@ import { type SessionLifecycleAction } from "./session-lifecycle-actions.js";
8
8
  export type { ResourceClaim, ResourceClaimRecoveryAction } from "./resource-claims.js";
9
9
  export { primarySessionLifecycleAction, primarySessionLifecycleNextAction, projectSessionLifecycleActions, projectSessionLifecycleNextActions, SESSION_LIFECYCLE_ACTION_SCHEMA_VERSION, } from "./session-lifecycle-actions.js";
10
10
  export type { SessionLifecycleAction, SessionLifecycleActionId, SessionLifecycleNextAction, SessionLifecycleNextActionId, } from "./session-lifecycle-actions.js";
11
- export { classifySessionLifecycle, lifecycleTransition, SESSION_LIFECYCLE_CLASSIFICATION_SCHEMA_VERSION, SESSION_LIFECYCLE_STATES, SESSION_LIFECYCLE_TRANSITION_TABLE, } from "./session-lifecycle-classification.js";
11
+ export { availableLifecycleOperations, classifySessionLifecycle, lifecycleTransition, SESSION_LIFECYCLE_CLASSIFICATION_SCHEMA_VERSION, SESSION_LIFECYCLE_STATES, SESSION_LIFECYCLE_TRANSITION_TABLE, } from "./session-lifecycle-classification.js";
12
12
  export type { SessionLifecycleBlocker, SessionLifecycleClassification, SessionLifecycleCloseReadiness, SessionLifecycleOperation, SessionLifecycleObservation, SessionLifecyclePhase, SessionLifecycleState, SessionLifecycleTransition, } from "./session-lifecycle-classification.js";
13
13
  export type { RepositoryDiffEvidence, RepositoryDiffDiagnostic, RepositoryDiffOptions, RepositoryEvidenceBounds, RepositoryEvidenceOptions, RepositoryEvidencePaths, RepositoryEvidenceSnapshot, } from "./repository-evidence.js";
14
14
  export { DIFF_EVIDENCE_SCHEMA_VERSION, EVIDENCE_MAX_DIFF_BYTES, EVIDENCE_MAX_DIFF_HUNKS, EVIDENCE_MAX_DIFF_PATHS, REPOSITORY_EVIDENCE_SCHEMA_VERSION, } from "./repository-evidence.js";
@@ -22,6 +22,7 @@ export declare const CLEANUP_DECISION_SCHEMA_VERSION: 1;
22
22
  export declare const RECONCILIATION_SCHEMA_VERSION: 1;
23
23
  export declare const SESSION_DIAGNOSTIC_SCHEMA_VERSION: 1;
24
24
  export declare const DISCARD_RESULT_SCHEMA_VERSION: 1;
25
+ export declare const DISCARD_PREVIEW_SCHEMA_VERSION: 1;
25
26
  /** Bounds a caller-declared commit-message pattern before it is compiled. */
26
27
  export declare const MAX_MESSAGE_PATTERN_LENGTH: 512;
27
28
  export type RegistrySchemaVersion = typeof REGISTRY_SCHEMA_VERSION;
@@ -95,6 +96,55 @@ export interface DiscardSessionResult {
95
96
  /** Present when this result completed a previously interrupted cleanup. */
96
97
  readonly reconciliation?: CleanupReconciliation;
97
98
  }
99
+ export interface DiscardPreviewEvidence {
100
+ readonly code: RegistryErrorCode;
101
+ readonly message: string;
102
+ readonly details: RegistryErrorDetails;
103
+ }
104
+ /** Bounded, read-only destruction evidence projected by `session discard --preview`. */
105
+ export interface DiscardPreview {
106
+ readonly schemaVersion: typeof DISCARD_PREVIEW_SCHEMA_VERSION;
107
+ readonly operation: "discard-preview";
108
+ readonly destructive: true;
109
+ readonly warning: string;
110
+ readonly session: SessionRecord;
111
+ readonly currentState: SessionState;
112
+ readonly persistedState: SessionState;
113
+ readonly physicalState: string;
114
+ readonly worktreePresent: boolean;
115
+ readonly branchPresent: boolean;
116
+ readonly worktreeHead: string | null;
117
+ readonly branchHead: string | null;
118
+ readonly head: string | null;
119
+ readonly expectedHead: string | null;
120
+ readonly recoverableCommits: {
121
+ readonly observable: boolean;
122
+ readonly present: boolean | null;
123
+ readonly evidence: readonly DiscardPreviewEvidence[];
124
+ };
125
+ readonly uncommittedWork: {
126
+ readonly observable: boolean;
127
+ readonly present: boolean | null;
128
+ readonly evidence: readonly DiscardPreviewEvidence[];
129
+ };
130
+ readonly claims: readonly ResourceClaim[];
131
+ readonly claimCount: number;
132
+ readonly claimsTruncated: boolean;
133
+ readonly destructiveScope: {
134
+ readonly worktree: boolean;
135
+ readonly branch: boolean;
136
+ readonly unintegratedCommits: boolean | null;
137
+ readonly uncommittedWork: boolean | null;
138
+ readonly claims: number;
139
+ };
140
+ readonly diagnostic: {
141
+ readonly closeReadiness: ReadinessState;
142
+ readonly cleanupReadiness: ReadinessState;
143
+ readonly resultState: DiagnosticCompleteness;
144
+ readonly blockers: readonly DiscardPreviewEvidence[];
145
+ readonly lifecycleState?: string;
146
+ };
147
+ }
98
148
  export type CleanupReconciliationOutcome = "completed" | "retryable" | "unresolved";
99
149
  /** Bounded, identity-bound evidence for a destructive lifecycle retry. */
100
150
  export interface CleanupReconciliation {
@@ -178,6 +228,10 @@ export interface GarbageCollectCandidate extends SessionRecord {
178
228
  readonly suspicionReason: GarbageCollectSuspicionReason;
179
229
  readonly destructiveEligibility: GarbageCollectEligibility;
180
230
  readonly destructiveEligibilityReason: GarbageCollectEligibilityReason;
231
+ /** Canonical read-only lifecycle projection for this GC observation. */
232
+ readonly lifecycle?: SessionLifecycleClassification;
233
+ /** Typed caller actions projected from the same lifecycle snapshot. */
234
+ readonly nextActions?: readonly SessionLifecycleAction[];
181
235
  }
182
236
  export interface GarbageCollectBlocked {
183
237
  readonly sessionId: string;
@@ -411,6 +465,9 @@ export interface CommitOptions {
411
465
  readonly message: string;
412
466
  /** Concrete repository-relative paths. Globs are never accepted here. */
413
467
  readonly resources?: readonly string[];
468
+ /** Explicitly resolve the authoritative session claim set to concrete resources. */
469
+ readonly allClaimed?: boolean;
470
+ readonly all_claimed?: boolean;
414
471
  /** Alias for callers that name the same explicit paths as paths. */
415
472
  readonly paths?: readonly string[];
416
473
  /**
@@ -464,6 +521,9 @@ export interface PushOptions {
464
521
  readonly session_id?: string | null;
465
522
  /** Explicit claim-covered resources; push never infers these from the registry. */
466
523
  readonly resources?: readonly string[];
524
+ /** Explicitly resolve the authoritative session claim set to concrete resources. */
525
+ readonly allClaimed?: boolean;
526
+ readonly all_claimed?: boolean;
467
527
  readonly remote?: string | null;
468
528
  readonly branch?: string | null;
469
529
  readonly remoteBranch?: string | null;
@@ -672,6 +732,12 @@ export declare class SessionRegistry {
672
732
  /** Push the currently owned branch to an explicit remote/branch target. */
673
733
  push(options: PushOptions): PushResult;
674
734
  pushSession(options: PushOptions): PushResult;
735
+ /**
736
+ * Resolve the opt-in all-claimed selector while the mutation lock is held.
737
+ * Claims remain the authority, but only concrete Git/repository evidence is
738
+ * ever handed to the existing concrete authorization path.
739
+ */
740
+ private resolveAllClaimedResourcesUnsafe;
675
741
  private requireMutationAuthorization;
676
742
  /** Capture bounded Git evidence for the current owned session's declaration. */
677
743
  checkpoint(options?: CheckpointOptions): CheckpointEvidence;
@@ -729,9 +795,25 @@ export declare class SessionRegistry {
729
795
  /** Explicitly discard exactly one selected session; never resolves the current owner implicitly. */
730
796
  discard(sessionIdOrOptions: string | DiscardSessionOptions): DiscardSessionResult;
731
797
  discardSession(sessionIdOrOptions: string | DiscardSessionOptions): DiscardSessionResult;
798
+ /**
799
+ * Produce a bounded, side-effect-free summary of the same session/Git/claim
800
+ * authorities that an explicit discard observes. The preview never invokes
801
+ * the cleanup actor or writes registry, worktree, branch, or claim state.
802
+ */
803
+ previewDiscard(sessionIdOrOptions: string | DiscardSessionOptions): DiscardPreview;
732
804
  /** Detect stale sessions, optionally applying only cleanup that passes close preflight. */
733
805
  garbageCollect(options?: GarbageCollectOptions): GarbageCollectResult;
734
806
  gc(options?: GarbageCollectOptions): GarbageCollectResult;
807
+ /**
808
+ * Run one destructive lifecycle request through the Session actor. The
809
+ * actor owns sequencing and admissibility; this class remains the adapter
810
+ * for authoritative Git/filesystem/registry observations and effects.
811
+ */
812
+ private coordinateCleanupUnsafe;
813
+ /** Build an actor input from one authoritative registry/physical diagnostic. */
814
+ private lifecycleActorInputUnsafe;
815
+ /** Preserve existing blocker/error contracts when the actor rejects a request. */
816
+ private lifecycleActorRejection;
735
817
  private resolveOwnerSession;
736
818
  private observeCleanupReconciliation;
737
819
  private cleanupFailure;