@springbrand/agent-runtime 0.1.3-alpha.7 → 0.2.0-alpha.13

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 (40) hide show
  1. package/package.json +4 -3
  2. package/src/adapter/cloudflare/index.ts +1 -0
  3. package/src/adapter/cloudflare/sandbox/adapter.ts +4 -0
  4. package/src/adapter/cloudflare/subagent/definition.ts +60 -5
  5. package/src/adapter/cloudflare/universal-agent/hooks.ts +23 -1
  6. package/src/adapter/cloudflare/universal-agent/preparation.ts +34 -0
  7. package/src/adapter/cloudflare/universal-agent/tools.ts +7 -7
  8. package/src/adapter/cloudflare/workspace/git-fs.ts +178 -0
  9. package/src/adapter/cloudflare/workspace/version-control.ts +374 -0
  10. package/src/db/index.ts +4 -0
  11. package/src/db/runtime-event-outbox.repo.ts +34 -1
  12. package/src/db/schema.ts +42 -0
  13. package/src/db/submission-admission.repo.ts +127 -0
  14. package/src/db/submission.repo.ts +54 -3
  15. package/src/index.ts +3 -0
  16. package/src/kernel/bindings.ts +52 -0
  17. package/src/kernel/durable-lifecycle.ts +100 -0
  18. package/src/kernel/public-contracts.ts +11 -0
  19. package/src/kernel/receipts.ts +1 -0
  20. package/src/kernel/subagent-runtime.ts +137 -0
  21. package/src/kernel/submission-authority.ts +114 -0
  22. package/src/kernel/submission-lifecycle.ts +17 -5
  23. package/src/lib/prompt.ts +3 -0
  24. package/src/pi/runtime-adapter/assembly.ts +2 -1
  25. package/src/pi/runtime-adapter/execution.ts +8 -1
  26. package/src/pi/runtime-adapter/index.ts +33 -0
  27. package/src/pi/runtime-adapter/models.ts +9 -0
  28. package/src/pi/tool/core-host.ts +5 -1
  29. package/src/pi/tool/core.ts +1 -10
  30. package/src/pi/tool/index.ts +1 -0
  31. package/src/pi/tool/mcp.ts +2 -2
  32. package/src/pi/tool/schedule.ts +30 -18
  33. package/src/pi/tool/subagent.ts +142 -16
  34. package/src/pi/tool/workspace-revision.ts +64 -0
  35. package/src/runtime-agent-context.ts +1 -0
  36. package/src/runtime-assembler.ts +16 -1
  37. package/src/runtime-definition.ts +12 -0
  38. package/src/runtime.ts +427 -46
  39. package/src/tool-registry.ts +2 -0
  40. package/src/workspace-versioning.ts +46 -0
@@ -1,6 +1,7 @@
1
1
  import type { ExecutionLevel } from "./lib/execution-level";
2
2
  import type {
3
3
  RuntimeMemoryPort,
4
+ RuntimeSubagentPort,
4
5
  WorkspacePort,
5
6
  } from "./kernel/bindings";
6
7
  import type { RuntimeExtensionConfig } from "./kernel/extensions";
@@ -102,6 +103,7 @@ export function piCandidateToToolSpec(candidate: PiToolCandidate): ToolSpec {
102
103
  export interface RuntimeToolBindings {
103
104
  readonly workspace?: WorkspacePort;
104
105
  readonly memory?: RuntimeMemoryPort;
106
+ readonly subagents?: RuntimeSubagentPort;
105
107
  }
106
108
 
107
109
  /**
@@ -0,0 +1,46 @@
1
+ export type WorkspaceRevision = {
2
+ revision: string;
3
+ treeHash: string;
4
+ reason: string;
5
+ createdAt: number;
6
+ };
7
+
8
+ export type WorkspaceRevisionManifest = {
9
+ revision: string;
10
+ treeHash: string;
11
+ files: readonly {
12
+ path: string;
13
+ size: number;
14
+ }[];
15
+ };
16
+
17
+ export interface WorkspaceVersionPort {
18
+ current(): Promise<WorkspaceRevision | null>;
19
+ checkpoint(input: { reason: string }): Promise<{
20
+ revision: string | null;
21
+ treeHash: string | null;
22
+ changed: boolean;
23
+ }>;
24
+ list(input?: { limit?: number }): Promise<readonly WorkspaceRevision[]>;
25
+ manifest(revision: string): Promise<WorkspaceRevisionManifest>;
26
+ readFile(revision: string, path: string): Promise<Uint8Array>;
27
+ restore(input: { revision: string; reason: string }): Promise<{
28
+ revision: string;
29
+ treeHash: string;
30
+ }>;
31
+ }
32
+
33
+ /** Host-scoped restore action exposed to the Agent Runtime. */
34
+ export interface WorkspaceRevisionRestorePort {
35
+ restore(target: string): Promise<{
36
+ restoredFrom: string;
37
+ revision: string;
38
+ treeHash: string;
39
+ }>;
40
+ }
41
+
42
+ export class WorkspaceRevisionNotFoundError extends Error {
43
+ constructor() {
44
+ super("workspace_revision_not_found");
45
+ }
46
+ }