@notation/factory-claude 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 +21 -0
- package/implementations/account.ts +26 -0
- package/implementations/agent.ts +30 -0
- package/implementations/index.ts +3 -0
- package/implementations/runtime.ts +10 -0
- package/package.json +29 -3
- package/runtime/setup.sh +6 -0
- package/README.md +0 -3
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
|
+
* The OAuth token from `claude setup-token`, as a secret in the hub's
|
|
11
|
+
* vault, such as
|
|
12
|
+
* `vault.secret({ id: "claude-oauth-token", value: token.credentials.value })`.
|
|
13
|
+
*/
|
|
14
|
+
auth: VaultSecret;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** The credentials Claude Code runs on. The deployer binds them, and injects them into every container that lists `claude.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("claude/Account", id, {});
|
|
24
|
+
this.secrets = { CLAUDE_CODE_OAUTH_TOKEN: auth };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
effort: v.optional(v.picklist(["low", "medium", "high", "xhigh", "max"])),
|
|
8
|
+
/** Relative to `.factory/`. Appended to the runner's prompt. */
|
|
9
|
+
systemPrompt: v.optional(v.string()),
|
|
10
|
+
/** Merged into `/data/agents/<id>/settings.json`. */
|
|
11
|
+
settings: v.optional(v.record(v.string(), v.unknown())),
|
|
12
|
+
/** `~/.claude/*` is written to `/data/agents/<id>/`, other `~/*` to `/data/home/`. */
|
|
13
|
+
files: v.optional(v.record(v.string(), v.string())),
|
|
14
|
+
});
|
|
15
|
+
export type AgentConfig = v.InferInput<typeof agentConfig>;
|
|
16
|
+
|
|
17
|
+
export type AgentOptions = AgentConfig;
|
|
18
|
+
|
|
19
|
+
/** A Claude Code agent. A trigger that runs it must target a container that lists `claude.runtime`. */
|
|
20
|
+
export class Agent extends OutpostGroup<AgentConfig> implements AgentContract {
|
|
21
|
+
readonly runtime = runtime;
|
|
22
|
+
|
|
23
|
+
constructor(id: string, config: AgentOptions) {
|
|
24
|
+
const settings = v.parse(agentConfig, config);
|
|
25
|
+
super("claude/Agent", id, config);
|
|
26
|
+
this.outpost.store.contribute({
|
|
27
|
+
agents: { [id]: { runtime: runtime.id, ...settings } },
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import type { Runtime } from "@notation/factory";
|
|
3
|
+
|
|
4
|
+
/** Claude Code. `setup` installs its CLI, `claude`, 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: "claude",
|
|
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-claude",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
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/claude"
|
|
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
|
}
|
package/runtime/setup.sh
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Installs Claude Code system-wide. Runs as root at image build. The
|
|
2
|
+
# installer puts claude in root's home, which the factory user can't read.
|
|
3
|
+
set -e
|
|
4
|
+
curl -fsSL https://claude.ai/install.sh | bash
|
|
5
|
+
install -m 0755 "$(readlink -f /root/.local/bin/claude)" /usr/local/bin/claude
|
|
6
|
+
rm -rf /root/.local /root/.claude /root/.claude.json
|
package/README.md
DELETED