@obversa/runtime 0.1.0

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 (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +192 -0
  3. package/dist/api.d.ts +72 -0
  4. package/dist/api.js +9775 -0
  5. package/dist/api.js.map +1 -0
  6. package/dist/artifacts/conformance.d.ts +1 -0
  7. package/dist/artifacts/file-store.d.ts +8 -0
  8. package/dist/artifacts/store.d.ts +1 -0
  9. package/dist/callback/approval.d.ts +8 -0
  10. package/dist/callback/client.d.ts +38 -0
  11. package/dist/callback/gate.d.ts +1 -0
  12. package/dist/callback/stored-client.d.ts +5 -0
  13. package/dist/chunk-3L6YNPN6.js +3 -0
  14. package/dist/chunk-3L6YNPN6.js.map +1 -0
  15. package/dist/chunk-5GLEABOU.js +3 -0
  16. package/dist/chunk-5GLEABOU.js.map +1 -0
  17. package/dist/chunk-DEW5R23M.js +338 -0
  18. package/dist/chunk-DEW5R23M.js.map +1 -0
  19. package/dist/chunk-DV5P4QLI.js +3056 -0
  20. package/dist/chunk-DV5P4QLI.js.map +1 -0
  21. package/dist/chunk-NIBHM5I5.js +34 -0
  22. package/dist/chunk-NIBHM5I5.js.map +1 -0
  23. package/dist/chunk-RZLMX3IA.js +368 -0
  24. package/dist/chunk-RZLMX3IA.js.map +1 -0
  25. package/dist/core/agent-md.d.ts +36 -0
  26. package/dist/core/agent.d.ts +86 -0
  27. package/dist/core/approval-job.d.ts +43 -0
  28. package/dist/core/assert-graph.d.ts +34 -0
  29. package/dist/core/budget.d.ts +49 -0
  30. package/dist/core/concurrency.d.ts +2 -0
  31. package/dist/core/condition.d.ts +209 -0
  32. package/dist/core/context.d.ts +36 -0
  33. package/dist/core/cost.d.ts +59 -0
  34. package/dist/core/dag.d.ts +20 -0
  35. package/dist/core/decision.d.ts +29 -0
  36. package/dist/core/describe.d.ts +56 -0
  37. package/dist/core/engine-meta.d.ts +5 -0
  38. package/dist/core/env-overlay.d.ts +35 -0
  39. package/dist/core/errors.d.ts +46 -0
  40. package/dist/core/feedback.d.ts +68 -0
  41. package/dist/core/git.d.ts +152 -0
  42. package/dist/core/guards.d.ts +70 -0
  43. package/dist/core/isolated.d.ts +40 -0
  44. package/dist/core/job.d.ts +134 -0
  45. package/dist/core/limits.d.ts +22 -0
  46. package/dist/core/loop.d.ts +24 -0
  47. package/dist/core/merge.d.ts +30 -0
  48. package/dist/core/pipeline.d.ts +35 -0
  49. package/dist/core/process.d.ts +11 -0
  50. package/dist/core/progress.d.ts +82 -0
  51. package/dist/core/redact.d.ts +1 -0
  52. package/dist/core/stats.d.ts +63 -0
  53. package/dist/core/team.d.ts +34 -0
  54. package/dist/core/text.d.ts +8 -0
  55. package/dist/core/tournament.d.ts +25 -0
  56. package/dist/core/types.d.ts +650 -0
  57. package/dist/engines/command-runner.d.ts +1 -0
  58. package/dist/engines/conformance.d.ts +1 -0
  59. package/dist/engines/engine.d.ts +4 -0
  60. package/dist/engines/failure.d.ts +1 -0
  61. package/dist/engines/fallback.d.ts +35 -0
  62. package/dist/engines/message-map.d.ts +1 -0
  63. package/dist/engines/mock.d.ts +1 -0
  64. package/dist/engines/preflight.d.ts +36 -0
  65. package/dist/env/command.d.ts +50 -0
  66. package/dist/env/command.js +65 -0
  67. package/dist/env/command.js.map +1 -0
  68. package/dist/env/environment.d.ts +4 -0
  69. package/dist/env/mock.d.ts +24 -0
  70. package/dist/events/conformance.d.ts +1 -0
  71. package/dist/events/envelope.d.ts +1 -0
  72. package/dist/events/jsonl-store.d.ts +8 -0
  73. package/dist/events/store.d.ts +1 -0
  74. package/dist/graph/commands.d.ts +5 -0
  75. package/dist/graph/conformance.d.ts +32 -0
  76. package/dist/graph/kernel.d.ts +5 -0
  77. package/dist/graph/plan.d.ts +1 -0
  78. package/dist/graph/type.d.ts +7 -0
  79. package/dist/graph/value.d.ts +1 -0
  80. package/dist/graph-types/dag.d.ts +137 -0
  81. package/dist/graph-types/loop.d.ts +194 -0
  82. package/dist/graph-types/team.d.ts +68 -0
  83. package/dist/memory.d.ts +82 -0
  84. package/dist/memory.js +397 -0
  85. package/dist/memory.js.map +1 -0
  86. package/dist/proof/acceptance.d.ts +5 -0
  87. package/dist/proof/artifact.d.ts +6 -0
  88. package/dist/proof/cache.d.ts +4 -0
  89. package/dist/runtime/attempt.d.ts +19 -0
  90. package/dist/runtime/budget.d.ts +4 -0
  91. package/dist/runtime/engine-availability.d.ts +18 -0
  92. package/dist/runtime/graph-executor.d.ts +7 -0
  93. package/dist/runtime/monitor.d.ts +80 -0
  94. package/dist/runtime/node-lifecycle.d.ts +84 -0
  95. package/dist/runtime/paths.d.ts +2 -0
  96. package/dist/runtime/persist.d.ts +31 -0
  97. package/dist/runtime/preflight-record.d.ts +149 -0
  98. package/dist/runtime/process-tree.d.ts +1 -0
  99. package/dist/runtime/result-contract.d.ts +4 -0
  100. package/dist/runtime/result-parts.d.ts +1 -0
  101. package/dist/runtime/run-definition.d.ts +24 -0
  102. package/dist/runtime/run-event.d.ts +9 -0
  103. package/dist/runtime/runner.d.ts +139 -0
  104. package/dist/runtime/supervisor.d.ts +111 -0
  105. package/dist/runtime/team-rooms.d.ts +13 -0
  106. package/dist/runtime/workspace-policy.d.ts +25 -0
  107. package/dist/storage/error.d.ts +1 -0
  108. package/dist/storage/id.d.ts +1 -0
  109. package/dist/storage/local.d.ts +12 -0
  110. package/dist/storage/local.js +1492 -0
  111. package/dist/storage/local.js.map +1 -0
  112. package/dist/testing.d.ts +15 -0
  113. package/dist/testing.js +274 -0
  114. package/dist/testing.js.map +1 -0
  115. package/dist/workflow-agent-response.d.ts +3 -0
  116. package/dist/workflow-support.d.ts +36 -0
  117. package/dist/workflow-support.js +5 -0
  118. package/dist/workflow-support.js.map +1 -0
  119. package/dist/workflow.d.ts +73 -0
  120. package/dist/workspace/conformance.d.ts +1 -0
  121. package/dist/workspace/git-provider.d.ts +26 -0
  122. package/dist/workspace/provider.d.ts +2 -0
  123. package/package.json +91 -0
@@ -0,0 +1,36 @@
1
+ import type { Job, JobContext } from './core/types.js';
2
+ import type { TeamSeat } from '@obversa/api';
3
+ type TeamWorkspaceMode = 'read' | 'write';
4
+ export interface TestCommand {
5
+ readonly command: string;
6
+ readonly args: readonly string[];
7
+ readonly timeoutMs?: number;
8
+ }
9
+ export interface TeamInput {
10
+ readonly brief: string;
11
+ readonly workspace: string;
12
+ readonly files: readonly string[];
13
+ readonly test: TestCommand;
14
+ }
15
+ export interface ReviewerSeat {
16
+ readonly name: string;
17
+ readonly seat: TeamSeat;
18
+ readonly scope?: string;
19
+ }
20
+ export declare function seatIdentity(seat: TeamSeat): TeamSeat['identity'];
21
+ export declare function assertDistinctSeats(seats: readonly TeamSeat[]): void;
22
+ export declare function requireNonEmptyFiles(label: string, job: Job, workspace: string, files: readonly string[]): Job;
23
+ export declare function requireNoFiles(label: string, job: Job, workspace: string, files: readonly string[], phase?: 'body' | 'review'): Job;
24
+ export declare function teamAgent(label: string, seat: TeamSeat, input: TeamInput, instructions: string | ((ctx: JobContext) => string), target?: string, decisionFile?: string, workspaceMode?: TeamWorkspaceMode, recordAs?: {
25
+ readonly role: 'writer' | 'reviewer';
26
+ readonly stage: string;
27
+ }): Job;
28
+ export declare function panelReviewers(reviewers: readonly ReviewerSeat[], input: TeamInput, reviewTarget?: string, recordAs?: {
29
+ readonly role: 'writer' | 'reviewer';
30
+ readonly stage: string;
31
+ }): Array<{
32
+ name: string;
33
+ scope?: string;
34
+ job: Job;
35
+ }>;
36
+ export { INVALID_TEAM_DECISION, outcomeFromAgentText } from './workflow-agent-response.js';
@@ -0,0 +1,5 @@
1
+ export { INVALID_TEAM_DECISION, assertDistinctSeats, outcomeFromAgentText, panelReviewers, requireNoFiles, requireNonEmptyFiles, seatIdentity, teamAgent } from './chunk-DV5P4QLI.js';
2
+ import './chunk-NIBHM5I5.js';
3
+ import './chunk-5GLEABOU.js';
4
+ //# sourceMappingURL=workflow-support.js.map
5
+ //# sourceMappingURL=workflow-support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"workflow-support.js"}
@@ -0,0 +1,73 @@
1
+ import { type TeamSeat } from '@obversa/api';
2
+ import type { Job, Outcome, ConditionInput } from './core/types.js';
3
+ export interface BriefSource {
4
+ readonly brief: string;
5
+ readonly files?: readonly string[];
6
+ }
7
+ export interface PersonRole {
8
+ readonly kind: 'person';
9
+ readonly question: string;
10
+ }
11
+ export type WorkflowRole = TeamSeat | readonly TeamSeat[] | PersonRole;
12
+ export interface WorkflowStageBase {
13
+ readonly writes?: string | readonly string[];
14
+ readonly desc?: string;
15
+ readonly gate?: string;
16
+ readonly when?: ConditionInput;
17
+ readonly optional?: boolean;
18
+ readonly needs?: string | readonly string[];
19
+ readonly sendsBackTo?: string;
20
+ readonly retry?: number;
21
+ /** An interrupted attempt may run again without a person's reconciliation. */
22
+ readonly retrySafe?: boolean;
23
+ }
24
+ export type WorkflowStage = WorkflowStageBase & {} & ({
25
+ readonly agent: string;
26
+ readonly reviewedBy?: string;
27
+ readonly run?: never;
28
+ readonly panel?: never;
29
+ readonly input?: never;
30
+ } | {
31
+ readonly run: string | readonly string[];
32
+ readonly agent?: never;
33
+ readonly panel?: never;
34
+ readonly input?: never;
35
+ } | {
36
+ readonly panel: string;
37
+ readonly agree?: number;
38
+ readonly agent?: never;
39
+ readonly run?: never;
40
+ readonly input?: never;
41
+ } | {
42
+ readonly input: string;
43
+ readonly agent?: never;
44
+ readonly run?: never;
45
+ readonly panel?: never;
46
+ });
47
+ export interface NamedStage {
48
+ readonly name: string;
49
+ readonly config: WorkflowStage;
50
+ }
51
+ export interface WorkflowOptions {
52
+ readonly timeout?: string | number;
53
+ }
54
+ export interface WorkflowRecord {
55
+ readonly outcome: Outcome;
56
+ summary(): string;
57
+ }
58
+ export interface WorkflowPostContext {
59
+ readonly record: WorkflowRecord;
60
+ }
61
+ export interface WorkflowConfig {
62
+ readonly brief: string | BriefSource;
63
+ readonly options?: WorkflowOptions;
64
+ readonly roles: Readonly<Record<string, WorkflowRole>>;
65
+ readonly stages: readonly NamedStage[];
66
+ readonly post?: {
67
+ readonly always?: (context: WorkflowPostContext) => void | Promise<void>;
68
+ };
69
+ }
70
+ export declare function briefFromFile(path: string | URL): BriefSource;
71
+ export declare function person(question: string): PersonRole;
72
+ export declare function stage(name: string, config: WorkflowStage): NamedStage;
73
+ export declare function workflow(name: string, config: WorkflowConfig): Job;
@@ -0,0 +1 @@
1
+ export { runWorkspaceProviderConformance, assertWorkspaceProviderConformance, type WorkspaceProviderConformanceFixture, type WorkspaceProviderConformanceFailure, type WorkspaceProviderConformanceReport, } from '@obversa/api/testing';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The single-repository Git worktree provider (roadmap D12): the one safe
3
+ * Git default.
4
+ *
5
+ * Capture and verify are read-only — status, head, and content digests.
6
+ * Fork validates the anchor first; a changed anchor fails before a branch
7
+ * or worktree exists. A successful fork writes exactly two things into
8
+ * the bound repository's metadata — a new ref at the anchored revision
9
+ * and a worktree registration — plus the worktree directory itself at a
10
+ * deterministic sibling path. The user's checkout, index, and dirty files
11
+ * are untouched. The create order is fixed: ref first, then the worktree,
12
+ * so a crash between the two leaves a detectable bare ref that cleanup
13
+ * can remove or retry; a second fork of the same child id fails at the
14
+ * existing ref or path instead of duplicating anything.
15
+ *
16
+ * The lease lives in private Git refs. Its complete JSON record is a Git blob.
17
+ * Git's expected-object-id update makes publication, release, and recovery
18
+ * change only the exact record they checked. Acquisition creates the one ref
19
+ * with a complete blob, so a kill cannot publish a partial valid owner.
20
+ */
21
+ import { type WorkspaceProvider } from './provider.js';
22
+ /** Create the single-repository Git worktree provider for one checkout. */
23
+ export declare function createGitWorktreeProvider(options: {
24
+ readonly repositoryPath: string;
25
+ readonly signal?: AbortSignal;
26
+ }): WorkspaceProvider;
@@ -0,0 +1,2 @@
1
+ export type { WorkspaceAnchor, WorkspaceHeadDrift, WorkspaceFilesDrift, WorkspaceRepositoryDrift, WorkspaceDrift, VerifyResult, ForkOk, ForkChangedAnchor, ForkExists, ForkIncomplete, ForkUnleased, ForkNoRevision, ForkInvalidChild, ForkResult, LeaseClaimed, LeaseHeld, LeaseIncomplete, AcquireResult, WorkspaceReleaseResult, RecoverResult, WorkspaceProvider, } from '@obversa/api';
2
+ export type { GitWorkspaceSnapshot } from '../core/git.js';
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "@obversa/runtime",
3
+ "version": "0.1.0",
4
+ "description": "Model how your team really works. Durable agent workflows, reviews that send work back, no database needed.",
5
+ "license": "MIT",
6
+ "author": "Jonny Neill <jonnyneill@hotmail.com>",
7
+ "type": "module",
8
+ "main": "./dist/api.js",
9
+ "types": "./dist/api.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/api.d.ts",
13
+ "import": "./dist/api.js"
14
+ },
15
+ "./testing": {
16
+ "types": "./dist/testing.d.ts",
17
+ "import": "./dist/testing.js"
18
+ },
19
+ "./memory": {
20
+ "types": "./dist/memory.d.ts",
21
+ "import": "./dist/memory.js"
22
+ },
23
+ "./workflow-support": {
24
+ "types": "./dist/workflow-support.d.ts",
25
+ "import": "./dist/workflow-support.js"
26
+ },
27
+ "./env/command": {
28
+ "types": "./dist/env/command.d.ts",
29
+ "import": "./dist/env/command.js"
30
+ },
31
+ "./storage/local": {
32
+ "types": "./dist/storage/local.d.ts",
33
+ "import": "./dist/storage/local.js"
34
+ },
35
+ "./package.json": "./package.json"
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "README.md",
40
+ "LICENSE"
41
+ ],
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "engines": {
46
+ "node": ">=22.12.0"
47
+ },
48
+ "dependencies": {
49
+ "p-limit": "^7.3.0",
50
+ "toposort": "^2.0.2",
51
+ "@obversa/core": "0.1.0"
52
+ },
53
+ "peerDependencies": {
54
+ "@obversa/api": "0.1.0"
55
+ },
56
+ "devDependencies": {
57
+ "@types/node": "22.12.0",
58
+ "@types/toposort": "^2.0.7",
59
+ "execa": "^9.6.1",
60
+ "@obversa/api": "0.1.0"
61
+ },
62
+ "keywords": [
63
+ "agent",
64
+ "graph",
65
+ "workflow",
66
+ "runtime",
67
+ "obversa",
68
+ "software-factory",
69
+ "product-factory",
70
+ "agent-pipeline",
71
+ "agent-harness",
72
+ "domain-specific-harness",
73
+ "multi-agent",
74
+ "durable-workflow"
75
+ ],
76
+ "repository": {
77
+ "type": "git",
78
+ "url": "git+https://github.com/jonny981/obversa.git"
79
+ },
80
+ "homepage": "https://docs.obversa.ai",
81
+ "bugs": {
82
+ "url": "https://github.com/jonny981/obversa/issues"
83
+ },
84
+ "scripts": {
85
+ "build": "tsup && tsc -p tsconfig.build.json",
86
+ "typecheck": "tsc --noEmit",
87
+ "typecheck:ts6": "tsc6 --noEmit",
88
+ "test": "vitest run",
89
+ "test:watch": "vitest"
90
+ }
91
+ }