@notation/factory 0.5.4 → 0.6.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.
- package/contracts/index.ts +1 -1
- package/contracts/outpost.ts +5 -2
- package/contracts/runner.ts +16 -0
- package/deployer/sdk.gen.ts +1 -1
- package/implementations/container.ts +10 -3
- package/package.json +1 -1
- package/router/channel.ts +18 -8
- package/router/deliveries.ts +110 -9
- package/router/handle.test.ts +305 -7
- package/router/handle.ts +247 -17
- package/router/index.ts +27 -2
- package/router/run.ts +73 -7
- package/runner/index.ts +352 -52
- package/runner/runner.test.ts +304 -7
package/contracts/index.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type {
|
|
|
18
18
|
Runtime,
|
|
19
19
|
TriggerEntry,
|
|
20
20
|
} from "./outpost.ts";
|
|
21
|
-
export type { CodeHostRunner, RunContext, RuntimeOutput, RuntimeRunner } from "./runner.ts";
|
|
21
|
+
export type { CodeHostRunner, RunContext, RuntimeOutput, RuntimeRunner, ToolCall } from "./runner.ts";
|
|
22
22
|
export type {
|
|
23
23
|
CodeHostEntry,
|
|
24
24
|
ConnectionEntry,
|
package/contracts/outpost.ts
CHANGED
|
@@ -20,12 +20,15 @@ export interface PolicyContract extends ResourceGroup {
|
|
|
20
20
|
readonly provider: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
/** A machine size given as its resources, in place of one of the provider's names. */
|
|
24
|
+
export type CustomInstanceType = { vcpu: number; memoryMib: number; diskMb: number };
|
|
25
|
+
|
|
23
26
|
/** In an outpost's config: a container, with its runtimes' and policies' ids. */
|
|
24
27
|
export type ContainerEntry = {
|
|
25
28
|
/** The Dockerfile, relative to `.factory/`. Without it, the container gets Factory's default image. */
|
|
26
29
|
image?: string;
|
|
27
|
-
/** The size of the machine
|
|
28
|
-
instanceType?: string;
|
|
30
|
+
/** The size of the machine: one of the provider's names, or its resources. */
|
|
31
|
+
instanceType?: string | CustomInstanceType;
|
|
29
32
|
runtimes: string[];
|
|
30
33
|
policies: string[];
|
|
31
34
|
files: Record<string, string | Record<string, unknown>>;
|
package/contracts/runner.ts
CHANGED
|
@@ -25,6 +25,9 @@ export type RunContext = {
|
|
|
25
25
|
configDir: string;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
/** A tool that the agent called: the tool's name, and its input as the CLI wrote it. The runner logs the input's main argument, such as a shell command or a file's path. */
|
|
29
|
+
export type ToolCall = { name: string; input?: unknown };
|
|
30
|
+
|
|
28
31
|
/** What a runtime's CLI said at the end of a run. */
|
|
29
32
|
export type RuntimeOutput = { result?: string; isError?: boolean; sessionId?: string };
|
|
30
33
|
|
|
@@ -71,6 +74,19 @@ export type RuntimeRunner = {
|
|
|
71
74
|
* under the agent's messages.
|
|
72
75
|
*/
|
|
73
76
|
model?(line: string): string | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Reads one line of the CLI's output while it runs, and returns the
|
|
79
|
+
* session's id, if the line has it. The runner saves the session during
|
|
80
|
+
* the run once it knows the id, so a run that is lost can be resumed.
|
|
81
|
+
* Without it, the runner saves a new session only at the end of the run.
|
|
82
|
+
*/
|
|
83
|
+
session?(line: string): string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Reads one line of the CLI's output while it runs, and returns the tools
|
|
86
|
+
* that the agent called on that line. The runner logs each one to the
|
|
87
|
+
* container's logs.
|
|
88
|
+
*/
|
|
89
|
+
tools?(line: string): ToolCall[];
|
|
74
90
|
/** Extra environment for the CLI. */
|
|
75
91
|
env?: Record<string, string>;
|
|
76
92
|
};
|