nawabari 0.7.1 → 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 (90) hide show
  1. package/README.md +264 -29
  2. package/dist/cli-command-registry.d.ts +50 -0
  3. package/dist/cli-command-registry.js +509 -0
  4. package/dist/cli-command-registry.js.map +1 -0
  5. package/dist/cli.d.ts +18 -0
  6. package/dist/cli.js +302 -583
  7. package/dist/cli.js.map +1 -1
  8. package/dist/contract.d.ts +6 -0
  9. package/dist/contract.js +296 -192
  10. package/dist/contract.js.map +1 -1
  11. package/dist/domain/cgroups-v2.d.ts +77 -0
  12. package/dist/domain/cgroups-v2.js +434 -0
  13. package/dist/domain/cgroups-v2.js.map +1 -0
  14. package/dist/domain/doctor.d.ts +4 -1
  15. package/dist/domain/doctor.js +64 -13
  16. package/dist/domain/doctor.js.map +1 -1
  17. package/dist/domain/errors.d.ts +1 -1
  18. package/dist/domain/errors.js.map +1 -1
  19. package/dist/domain/landlock.d.ts +55 -0
  20. package/dist/domain/landlock.js +279 -0
  21. package/dist/domain/landlock.js.map +1 -0
  22. package/dist/domain/runtime.d.ts +12 -0
  23. package/dist/domain/runtime.js +50 -0
  24. package/dist/domain/runtime.js.map +1 -0
  25. package/dist/domain/sandbox-launcher.d.ts +26 -0
  26. package/dist/domain/sandbox-launcher.js +312 -23
  27. package/dist/domain/sandbox-launcher.js.map +1 -1
  28. package/dist/domain/sandbox-seccomp.d.ts +46 -0
  29. package/dist/domain/sandbox-seccomp.js +302 -0
  30. package/dist/domain/sandbox-seccomp.js.map +1 -0
  31. package/dist/domain/sandbox.d.ts +45 -1
  32. package/dist/domain/sandbox.js +176 -25
  33. package/dist/domain/sandbox.js.map +1 -1
  34. package/dist/domain/session-backend.d.ts +4 -1
  35. package/dist/domain/session-backend.js +256 -3
  36. package/dist/domain/session-backend.js.map +1 -1
  37. package/dist/domain/session.d.ts +207 -3
  38. package/dist/domain/session.js.map +1 -1
  39. package/dist/errors.d.ts +1 -1
  40. package/dist/failure-code-vocabulary.d.ts +20 -0
  41. package/dist/failure-code-vocabulary.js +216 -0
  42. package/dist/failure-code-vocabulary.js.map +1 -0
  43. package/dist/git.js +92 -6
  44. package/dist/git.js.map +1 -1
  45. package/dist/operation-authorization.d.ts +1 -1
  46. package/dist/product-state-manifest.d.ts +152 -0
  47. package/dist/product-state-manifest.js +240 -0
  48. package/dist/product-state-manifest.js.map +1 -0
  49. package/dist/public-contract.d.ts +25 -0
  50. package/dist/public-contract.js +29 -0
  51. package/dist/public-contract.js.map +1 -0
  52. package/dist/public-state.d.ts +75 -0
  53. package/dist/public-state.js +60 -0
  54. package/dist/public-state.js.map +1 -0
  55. package/dist/registry/lock.d.ts +8 -0
  56. package/dist/registry/lock.js +38 -20
  57. package/dist/registry/lock.js.map +1 -1
  58. package/dist/repository-evidence.d.ts +16 -0
  59. package/dist/repository-evidence.js.map +1 -1
  60. package/dist/resource-claims.d.ts +2 -2
  61. package/dist/resource-claims.js +96 -27
  62. package/dist/resource-claims.js.map +1 -1
  63. package/dist/session-lifecycle-actions.d.ts +64 -0
  64. package/dist/session-lifecycle-actions.js +117 -0
  65. package/dist/session-lifecycle-actions.js.map +1 -0
  66. package/dist/session-lifecycle-classification.d.ts +120 -0
  67. package/dist/session-lifecycle-classification.js +88 -0
  68. package/dist/session-lifecycle-classification.js.map +1 -0
  69. package/dist/session-registry.d.ts +210 -2
  70. package/dist/session-registry.js +1330 -87
  71. package/dist/session-registry.js.map +1 -1
  72. package/dist/state/index.d.ts +5 -0
  73. package/dist/state/index.js +4 -0
  74. package/dist/state/index.js.map +1 -0
  75. package/dist/state/session/actors.d.ts +71 -0
  76. package/dist/state/session/actors.js +259 -0
  77. package/dist/state/session/actors.js.map +1 -0
  78. package/dist/state/session/guards.d.ts +25 -0
  79. package/dist/state/session/guards.js +108 -0
  80. package/dist/state/session/guards.js.map +1 -0
  81. package/dist/state/session/index.d.ts +6 -0
  82. package/dist/state/session/index.js +5 -0
  83. package/dist/state/session/index.js.map +1 -0
  84. package/dist/state/session/machine.d.ts +185 -0
  85. package/dist/state/session/machine.js +408 -0
  86. package/dist/state/session/machine.js.map +1 -0
  87. package/dist/state/session/types.d.ts +94 -0
  88. package/dist/state/session/types.js +14 -0
  89. package/dist/state/session/types.js.map +1 -0
  90. package/package.json +46 -26
@@ -0,0 +1,94 @@
1
+ import type { EventObject } from "xstate";
2
+ import type { SessionLifecycleBlocker, SessionLifecycleCloseReadiness, SessionLifecycleObservation, SessionLifecyclePhase, SessionLifecycleState } from "../../session-lifecycle-classification.js";
3
+ /** Internal schema generation for the session state-module boundary. */
4
+ export declare const SESSION_STATE_MODULE_SCHEMA_VERSION: 1;
5
+ /** Durable state stored by the existing session-registry authority. */
6
+ export type PersistedSessionState = "new" | "active" | "closing" | "closed" | "stale";
7
+ /** Derived operational state; it is not the persisted SessionRecord.state value. */
8
+ export type SessionOperationalState = SessionLifecycleState;
9
+ /** A narrow, read-only view of persisted state supplied by the registry adapter. */
10
+ export interface SessionPersistedStateInput {
11
+ readonly sessionId: string;
12
+ readonly state: PersistedSessionState;
13
+ readonly terminalOperation?: "discard";
14
+ readonly cleanupHead?: string;
15
+ readonly discardedHead?: string;
16
+ }
17
+ /**
18
+ * Evidence produced by an existing authority before a machine evaluates an
19
+ * event. The state module accepts these facts but does not observe or mutate
20
+ * Git, the filesystem, the registry, resources, or the sandbox itself.
21
+ */
22
+ export interface SessionEvidenceInput {
23
+ readonly claimSetGeneration?: number;
24
+ readonly integration?: SessionIntegrationEvidence;
25
+ readonly garbageCollection?: SessionGarbageCollectionEvidence;
26
+ }
27
+ export type SessionIntegrationEvidence = {
28
+ readonly status: "proven";
29
+ readonly revision: string;
30
+ } | {
31
+ readonly status: "not-proven";
32
+ } | {
33
+ readonly status: "ambiguous";
34
+ readonly reason?: string;
35
+ } | {
36
+ readonly status: "unavailable";
37
+ readonly reason?: string;
38
+ };
39
+ export interface SessionGarbageCollectionEvidence {
40
+ readonly authorized: boolean;
41
+ readonly reason?: string;
42
+ }
43
+ /**
44
+ * Lifecycle observation boundary retained as a structural input. This
45
+ * extends the existing classifier vocabulary without making the state module
46
+ * an authority for how observations are obtained.
47
+ */
48
+ export interface SessionObservationInput extends SessionLifecycleObservation {
49
+ readonly evidence?: SessionEvidenceInput;
50
+ }
51
+ export type SessionObservationBlocker = SessionLifecycleBlocker;
52
+ export type SessionObservationCloseReadiness = SessionLifecycleCloseReadiness;
53
+ export type SessionObservationPhase = SessionLifecyclePhase;
54
+ /** Input hydrated from authoritative adapters before a machine is evaluated. */
55
+ export interface SessionMachineInput {
56
+ /** Optional because lifecycle projection may receive observation only. */
57
+ readonly persisted?: SessionPersistedStateInput;
58
+ readonly observation: SessionObservationInput;
59
+ readonly evidence?: SessionEvidenceInput;
60
+ }
61
+ /**
62
+ * XState context boundary. Context contains an observed input snapshot; it
63
+ * does not own authoritative facts or mutation capabilities.
64
+ */
65
+ export interface SessionMachineContext {
66
+ readonly persisted?: SessionPersistedStateInput;
67
+ readonly observation: SessionObservationInput;
68
+ readonly evidence: SessionEvidenceInput;
69
+ }
70
+ type SessionEventWithPayload = EventObject;
71
+ /** Internal capability-oriented events; CLI command names are adapter concerns. */
72
+ export type SessionMachineEvent = (SessionEventWithPayload & {
73
+ readonly type: "SESSION.OBSERVE";
74
+ readonly observation: SessionObservationInput;
75
+ readonly evidence?: SessionEvidenceInput;
76
+ }) | (SessionEventWithPayload & {
77
+ readonly type: "SESSION.CLOSE.REQUESTED";
78
+ }) | (SessionEventWithPayload & {
79
+ readonly type: "SESSION.DISCARD.REQUESTED";
80
+ }) | (SessionEventWithPayload & {
81
+ readonly type: "SESSION.DOCTOR.REQUESTED";
82
+ }) | (SessionEventWithPayload & {
83
+ readonly type: "SESSION.RECONCILE.REQUESTED";
84
+ }) | (SessionEventWithPayload & {
85
+ readonly type: "SESSION.GC.REQUESTED";
86
+ }) | (SessionEventWithPayload & {
87
+ readonly type: "SESSION.CLEANUP.RETRY";
88
+ }) | (SessionEventWithPayload & {
89
+ readonly type: "SESSION.CLEANUP.FINALIZE";
90
+ }) | (SessionEventWithPayload & {
91
+ readonly type: "SESSION.MARK_STALE";
92
+ });
93
+ export declare const SESSION_MACHINE_EVENT_TYPES: readonly ["SESSION.OBSERVE", "SESSION.CLOSE.REQUESTED", "SESSION.DISCARD.REQUESTED", "SESSION.DOCTOR.REQUESTED", "SESSION.RECONCILE.REQUESTED", "SESSION.GC.REQUESTED", "SESSION.CLEANUP.RETRY", "SESSION.CLEANUP.FINALIZE", "SESSION.MARK_STALE"];
94
+ export {};
@@ -0,0 +1,14 @@
1
+ /** Internal schema generation for the session state-module boundary. */
2
+ export const SESSION_STATE_MODULE_SCHEMA_VERSION = 1;
3
+ export const SESSION_MACHINE_EVENT_TYPES = Object.freeze([
4
+ "SESSION.OBSERVE",
5
+ "SESSION.CLOSE.REQUESTED",
6
+ "SESSION.DISCARD.REQUESTED",
7
+ "SESSION.DOCTOR.REQUESTED",
8
+ "SESSION.RECONCILE.REQUESTED",
9
+ "SESSION.GC.REQUESTED",
10
+ "SESSION.CLEANUP.RETRY",
11
+ "SESSION.CLEANUP.FINALIZE",
12
+ "SESSION.MARK_STALE",
13
+ ]);
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/state/session/types.ts"],"names":[],"mappings":"AAUA,wEAAwE;AACxE,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAU,CAAC;AAwF9D,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,MAAM,CAAC;IACvD,iBAAiB;IACjB,yBAAyB;IACzB,2BAA2B;IAC3B,0BAA0B;IAC1B,6BAA6B;IAC7B,sBAAsB;IACtB,uBAAuB;IACvB,0BAA0B;IAC1B,oBAAoB;CACZ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nawabari",
3
- "version": "0.7.1",
3
+ "version": "0.9.2",
4
4
  "description": "A stable local Git session CLI exposed as git nawabari.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,36 +12,33 @@
12
12
  "README.md",
13
13
  "LICENSE"
14
14
  ],
15
- "scripts": {
16
- "build": "node scripts/build.mjs",
17
- "start": "node dist/index.js",
18
- "test": "node --test --import tsx src/*.test.ts src/**/*.test.ts scripts/**/*.test.mjs",
19
- "typecheck": "tsc --noEmit",
20
- "lint": "eslint 'src/**/*.ts' 'scripts/**/*.mjs' 'eslint.config.mjs'",
21
- "format": "prettier --write .",
22
- "format:check": "prettier --check .",
23
- "benchmark:pnpm-worktree-install": "node scripts/benchmark-pnpm-worktree-install.mjs",
24
- "smoke-test": "node scripts/smoke-test.mjs",
25
- "test:package": "pnpm run build && node scripts/run-package-suite.mjs",
26
- "governance:actions": "node scripts/validate-actions.mjs",
27
- "governance:workflows": "node scripts/validate-workflows.mjs",
28
- "verify": "pnpm run format:check && pnpm run lint && pnpm run typecheck && pnpm test && pnpm run governance:actions && pnpm run governance:workflows && pnpm run test:package",
29
- "prepack": "pnpm run build",
30
- "prepublishOnly": "pnpm run typecheck && pnpm test"
15
+ "exports": {
16
+ "./state": {
17
+ "types": "./dist/public-state.d.ts",
18
+ "default": "./dist/public-state.js"
19
+ },
20
+ "./contract": {
21
+ "types": "./dist/public-contract.d.ts",
22
+ "default": "./dist/public-contract.js"
23
+ },
24
+ "./manifest": {
25
+ "types": "./dist/product-state-manifest.d.ts",
26
+ "default": "./dist/product-state-manifest.js"
27
+ },
28
+ "./package.json": "./package.json"
31
29
  },
32
30
  "devDependencies": {
33
- "@types/node": "^26.1.2",
34
- "eslint": "10.8.1",
35
- "gh-inari": "0.7.0",
31
+ "@types/node": "^26.4.1",
32
+ "eslint": "10.10.0",
33
+ "gh-inari": "0.10.2",
36
34
  "prettier": "3.9.6",
37
- "tsx": "^4.19.4",
35
+ "tsx": "^4.23.13",
38
36
  "typescript": "^6.0.3",
39
- "typescript-eslint": "8.67.0"
37
+ "typescript-eslint": "8.69.0"
40
38
  },
41
39
  "engines": {
42
- "node": ">=22.13 <25"
40
+ "node": ">=24"
43
41
  },
44
- "packageManager": "pnpm@11.18.0",
45
42
  "publishConfig": {
46
43
  "access": "public",
47
44
  "registry": "https://registry.npmjs.org/"
@@ -55,5 +52,28 @@
55
52
  "bugs": {
56
53
  "url": "https://github.com/yohn-jp/nawabari/issues"
57
54
  },
58
- "keywords": []
59
- }
55
+ "keywords": [],
56
+ "dependencies": {
57
+ "xstate": "^5.32.6"
58
+ },
59
+ "scripts": {
60
+ "build": "node scripts/build.mjs",
61
+ "start": "node dist/index.js",
62
+ "test": "node --test --import tsx src/*.test.ts src/**/*.test.ts scripts/**/*.test.mjs",
63
+ "typecheck": "tsc --noEmit",
64
+ "lint": "eslint 'src/**/*.ts' 'scripts/**/*.mjs' 'eslint.config.mjs'",
65
+ "format": "prettier --write .",
66
+ "format:check": "prettier --check .",
67
+ "benchmark:pnpm-worktree-install": "node scripts/benchmark-pnpm-worktree-install.mjs",
68
+ "benchmark:protected-execution": "node scripts/benchmark-protected-execution.mjs",
69
+ "smoke-test": "node scripts/smoke-test.mjs",
70
+ "manifest:generate": "node --import tsx scripts/generate-state-diagram.mjs",
71
+ "manifest:check": "node --import tsx scripts/generate-state-diagram.mjs --check",
72
+ "test:package": "pnpm run build && node scripts/run-package-suite.mjs",
73
+ "test:package:protected": "pnpm run build && node scripts/run-package-suite.mjs --require-protected-execution",
74
+ "test:package:mottainai": "pnpm run build && node scripts/run-mottainai-uid-handoff-gate.mjs",
75
+ "governance:actions": "node scripts/validate-actions.mjs",
76
+ "governance:workflows": "node scripts/validate-workflows.mjs",
77
+ "verify": "pnpm run format:check && pnpm run lint && pnpm run typecheck && pnpm test && pnpm run governance:actions && pnpm run governance:workflows && pnpm run test:package"
78
+ }
79
+ }