@notation/factory-droid 0.0.0-stage → 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Notation Labs Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,26 @@
1
+ import { ResourceGroup } from "@notation/resource";
2
+ import {
3
+ type Account as AccountContract,
4
+ type VaultSecret,
5
+ } from "@notation/factory";
6
+ import { runtime } from "./runtime.ts";
7
+
8
+ export type AccountOptions = {
9
+ /**
10
+ * A Factory API key, as a secret in the hub's vault, such as
11
+ * `vault.secret({ id: "factory-api-key", value: key.credentials.value })`.
12
+ * Generate one on the Factory settings page.
13
+ */
14
+ auth: VaultSecret;
15
+ };
16
+
17
+ /** The credentials Droid runs on. The deployer binds them, and injects them into every container that lists `droid.runtime`, and no other. */
18
+ export class Account extends ResourceGroup implements AccountContract {
19
+ readonly runtime = runtime;
20
+ readonly secrets: Record<string, VaultSecret>;
21
+
22
+ constructor(id: string, { auth }: AccountOptions) {
23
+ super("droid/Account", id, {});
24
+ this.secrets = { FACTORY_API_KEY: auth };
25
+ }
26
+ }
@@ -0,0 +1,37 @@
1
+ import { type Agent as AgentContract, OutpostGroup } from "@notation/factory";
2
+ import * as v from "valibot";
3
+ import { runtime } from "./runtime.ts";
4
+
5
+ const agentConfig = v.object({
6
+ model: v.string(),
7
+ /** Passed as `--reasoning-effort`. The levels a model accepts depend on the model. */
8
+ effort: v.optional(v.picklist(["none", "low", "medium", "high"])),
9
+ /**
10
+ * Passed as `--auto`. Without it, a run skips every permission prompt
11
+ * with `--skip-permissions-unsafe`, which only a disposable container
12
+ * should use.
13
+ */
14
+ autonomy: v.optional(v.picklist(["low", "medium", "high"])),
15
+ /** Relative to `.factory/`. Appended to the runner's prompt. */
16
+ systemPrompt: v.optional(v.string()),
17
+ /** Written to `/data/agents/<id>/settings.json`, and merged for each run. */
18
+ settings: v.optional(v.record(v.string(), v.unknown())),
19
+ /** `~/.factory/*` is written to `/data/agents/<id>/`, other `~/*` to `/data/home/`. */
20
+ files: v.optional(v.record(v.string(), v.string())),
21
+ });
22
+ export type AgentConfig = v.InferInput<typeof agentConfig>;
23
+
24
+ export type AgentOptions = AgentConfig;
25
+
26
+ /** A Droid agent. A trigger that runs it must target a container that lists `droid.runtime`. */
27
+ export class Agent extends OutpostGroup<AgentConfig> implements AgentContract {
28
+ readonly runtime = runtime;
29
+
30
+ constructor(id: string, config: AgentOptions) {
31
+ const settings = v.parse(agentConfig, config);
32
+ super("droid/Agent", id, config);
33
+ this.outpost.store.contribute({
34
+ agents: { [id]: { runtime: runtime.id, ...settings } },
35
+ });
36
+ }
37
+ }
@@ -0,0 +1,3 @@
1
+ export { Account, type AccountOptions } from "./account.ts";
2
+ export { Agent, type AgentOptions } from "./agent.ts";
3
+ export { runtime } from "./runtime.ts";
@@ -0,0 +1,10 @@
1
+ import { readFileSync } from "node:fs";
2
+ import type { Runtime } from "@notation/factory";
3
+
4
+ /** Droid, Factory's agent. `setup` installs its CLI, `droid`, in a container's image. Read lazily: an outpost's config, which has no filesystem, never touches it. */
5
+ export const runtime: Runtime = {
6
+ id: "droid",
7
+ get setup() {
8
+ return readFileSync(new URL("../runtime/setup.sh", import.meta.url), "utf8");
9
+ },
10
+ };
package/package.json CHANGED
@@ -1,6 +1,32 @@
1
1
  {
2
2
  "name": "@notation/factory-droid",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "author": "Daniel Grant",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/notationlabs/factory.git",
9
+ "directory": "packages/droid"
10
+ },
11
+ "type": "module",
12
+ "exports": {
13
+ ".": "./implementations/index.ts"
14
+ },
15
+ "files": [
16
+ "implementations",
17
+ "runtime"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "dependencies": {
23
+ "@notation/resource": "0.28.0",
24
+ "valibot": "^1.1.0"
25
+ },
26
+ "peerDependencies": {
27
+ "@notation/factory": "^0.1.0"
28
+ },
29
+ "devDependencies": {
30
+ "@notation/factory": "0.1.0"
31
+ }
6
32
  }
@@ -0,0 +1,12 @@
1
+ # Installs the Droid CLI system-wide. Runs as root at image build. The
2
+ # installer puts droid in root's home, which the factory user can't read.
3
+ set -e
4
+ # Droid's Execute supervisor probes its parent with ps, which slim images lack.
5
+ if ! command -v ps >/dev/null 2>&1; then
6
+ apt-get update
7
+ apt-get install -y --no-install-recommends procps
8
+ rm -rf /var/lib/apt/lists/*
9
+ fi
10
+ curl -fsSL https://app.factory.ai/cli | sh
11
+ install -m 0755 "$(readlink -f /root/.local/bin/droid)" /usr/local/bin/droid
12
+ rm -rf /root/.local /root/.factory
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.