@clawmasons/shared 0.1.0 → 0.1.2
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/README.md +7 -0
- package/dist/mason/index.d.ts +3 -0
- package/dist/mason/index.d.ts.map +1 -0
- package/dist/mason/index.js +5 -0
- package/dist/mason/index.js.map +1 -0
- package/dist/mason/proposer.d.ts +36 -0
- package/dist/mason/proposer.d.ts.map +1 -0
- package/dist/mason/proposer.js +121 -0
- package/dist/mason/proposer.js.map +1 -0
- package/dist/mason/scanner.d.ts +64 -0
- package/dist/mason/scanner.d.ts.map +1 -0
- package/dist/mason/scanner.js +212 -0
- package/dist/mason/scanner.js.map +1 -0
- package/dist/role/adapter.d.ts +1 -1
- package/dist/role/adapter.js +2 -2
- package/dist/role/adapter.js.map +1 -1
- package/dist/role/dialect-registry.d.ts +49 -0
- package/dist/role/dialect-registry.d.ts.map +1 -0
- package/dist/role/dialect-registry.js +100 -0
- package/dist/role/dialect-registry.js.map +1 -0
- package/dist/role/index.d.ts +7 -0
- package/dist/schemas/app.d.ts +59 -0
- package/dist/schemas/app.d.ts.map +1 -0
- package/dist/schemas/app.js +42 -0
- package/dist/schemas/app.js.map +1 -0
- package/dist/schemas/chapter-field.d.ts +8 -0
- package/dist/schemas/chapter-field.d.ts.map +1 -0
- package/dist/schemas/chapter-field.js +60 -0
- package/dist/schemas/chapter-field.js.map +1 -0
- package/dist/schemas/role-types.d.ts +74 -74
- package/dist/schemas/role.d.ts +87 -0
- package/dist/schemas/role.d.ts.map +1 -0
- package/dist/schemas/role.js +29 -0
- package/dist/schemas/role.js.map +1 -0
- package/dist/schemas/skill.d.ts +16 -0
- package/dist/schemas/skill.d.ts.map +1 -0
- package/dist/schemas/skill.js +7 -0
- package/dist/schemas/skill.js.map +1 -0
- package/dist/schemas/task.d.ts +43 -0
- package/dist/schemas/task.d.ts.map +1 -0
- package/dist/schemas/task.js +16 -0
- package/dist/schemas/task.js.map +1 -0
- package/dist/toolfilter.d.ts +28 -0
- package/package.json +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const roleChapterFieldSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"role">;
|
|
4
|
+
description: z.ZodOptional<z.ZodString>;
|
|
5
|
+
risk: z.ZodDefault<z.ZodOptional<z.ZodEnum<["HIGH", "MEDIUM", "LOW"]>>>;
|
|
6
|
+
tasks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
7
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
8
|
+
permissions: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
9
|
+
allow: z.ZodArray<z.ZodString, "many">;
|
|
10
|
+
deny: z.ZodArray<z.ZodString, "many">;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
allow: string[];
|
|
13
|
+
deny: string[];
|
|
14
|
+
}, {
|
|
15
|
+
allow: string[];
|
|
16
|
+
deny: string[];
|
|
17
|
+
}>>;
|
|
18
|
+
constraints: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
maxConcurrentTasks: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
requireApprovalFor: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
21
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
22
|
+
maxConcurrentTasks: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
requireApprovalFor: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
24
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
25
|
+
maxConcurrentTasks: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
requireApprovalFor: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
27
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
28
|
+
mounts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
29
|
+
source: z.ZodString;
|
|
30
|
+
target: z.ZodString;
|
|
31
|
+
readonly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
source: string;
|
|
34
|
+
target: string;
|
|
35
|
+
readonly: boolean;
|
|
36
|
+
}, {
|
|
37
|
+
source: string;
|
|
38
|
+
target: string;
|
|
39
|
+
readonly?: boolean | undefined;
|
|
40
|
+
}>, "many">>;
|
|
41
|
+
baseImage: z.ZodOptional<z.ZodString>;
|
|
42
|
+
aptPackages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
type: "role";
|
|
45
|
+
risk: "HIGH" | "MEDIUM" | "LOW";
|
|
46
|
+
permissions: Record<string, {
|
|
47
|
+
allow: string[];
|
|
48
|
+
deny: string[];
|
|
49
|
+
}>;
|
|
50
|
+
description?: string | undefined;
|
|
51
|
+
skills?: string[] | undefined;
|
|
52
|
+
tasks?: string[] | undefined;
|
|
53
|
+
constraints?: z.objectOutputType<{
|
|
54
|
+
maxConcurrentTasks: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
requireApprovalFor: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
56
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
57
|
+
mounts?: {
|
|
58
|
+
source: string;
|
|
59
|
+
target: string;
|
|
60
|
+
readonly: boolean;
|
|
61
|
+
}[] | undefined;
|
|
62
|
+
baseImage?: string | undefined;
|
|
63
|
+
aptPackages?: string[] | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
type: "role";
|
|
66
|
+
permissions: Record<string, {
|
|
67
|
+
allow: string[];
|
|
68
|
+
deny: string[];
|
|
69
|
+
}>;
|
|
70
|
+
description?: string | undefined;
|
|
71
|
+
skills?: string[] | undefined;
|
|
72
|
+
tasks?: string[] | undefined;
|
|
73
|
+
risk?: "HIGH" | "MEDIUM" | "LOW" | undefined;
|
|
74
|
+
constraints?: z.objectInputType<{
|
|
75
|
+
maxConcurrentTasks: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
requireApprovalFor: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
77
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
78
|
+
mounts?: {
|
|
79
|
+
source: string;
|
|
80
|
+
target: string;
|
|
81
|
+
readonly?: boolean | undefined;
|
|
82
|
+
}[] | undefined;
|
|
83
|
+
baseImage?: string | undefined;
|
|
84
|
+
aptPackages?: string[] | undefined;
|
|
85
|
+
}>;
|
|
86
|
+
export type RoleChapterField = z.infer<typeof roleChapterFieldSchema>;
|
|
87
|
+
//# sourceMappingURL=role.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../src/schemas/role.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const permissionEntrySchema = z.object({
|
|
3
|
+
allow: z.array(z.string()),
|
|
4
|
+
deny: z.array(z.string()),
|
|
5
|
+
});
|
|
6
|
+
const mountSchema = z.object({
|
|
7
|
+
source: z.string(),
|
|
8
|
+
target: z.string(),
|
|
9
|
+
readonly: z.boolean().optional().default(false),
|
|
10
|
+
});
|
|
11
|
+
export const roleChapterFieldSchema = z.object({
|
|
12
|
+
type: z.literal("role"),
|
|
13
|
+
description: z.string().optional(),
|
|
14
|
+
risk: z.enum(["HIGH", "MEDIUM", "LOW"]).optional().default("LOW"),
|
|
15
|
+
tasks: z.array(z.string()).optional(),
|
|
16
|
+
skills: z.array(z.string()).optional(),
|
|
17
|
+
permissions: z.record(z.string(), permissionEntrySchema),
|
|
18
|
+
constraints: z
|
|
19
|
+
.object({
|
|
20
|
+
maxConcurrentTasks: z.number().int().positive().optional(),
|
|
21
|
+
requireApprovalFor: z.array(z.string()).optional(),
|
|
22
|
+
})
|
|
23
|
+
.passthrough()
|
|
24
|
+
.optional(),
|
|
25
|
+
mounts: z.array(mountSchema).optional(),
|
|
26
|
+
baseImage: z.string().optional(),
|
|
27
|
+
aptPackages: z.array(z.string()).optional(),
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=role.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role.js","sourceRoot":"","sources":["../../src/schemas/role.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC1B,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CAChD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACjE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACrC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACtC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,qBAAqB,CAAC;IACxD,WAAW,EAAE,CAAC;SACX,MAAM,CAAC;QACN,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC1D,kBAAkB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;KACnD,CAAC;SACD,WAAW,EAAE;SACb,QAAQ,EAAE;IACb,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE;IACvC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const skillChapterFieldSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"skill">;
|
|
4
|
+
artifacts: z.ZodArray<z.ZodString, "many">;
|
|
5
|
+
description: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
type: "skill";
|
|
8
|
+
description: string;
|
|
9
|
+
artifacts: string[];
|
|
10
|
+
}, {
|
|
11
|
+
type: "skill";
|
|
12
|
+
description: string;
|
|
13
|
+
artifacts: string[];
|
|
14
|
+
}>;
|
|
15
|
+
export type SkillChapterField = z.infer<typeof skillChapterFieldSchema>;
|
|
16
|
+
//# sourceMappingURL=skill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/schemas/skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;EAIlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../../src/schemas/skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACxB,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const taskChapterFieldSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"task">;
|
|
4
|
+
taskType: z.ZodEnum<["subagent", "script", "composite", "human"]>;
|
|
5
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
6
|
+
requires: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
apps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
8
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
apps?: string[] | undefined;
|
|
11
|
+
skills?: string[] | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
apps?: string[] | undefined;
|
|
14
|
+
skills?: string[] | undefined;
|
|
15
|
+
}>>;
|
|
16
|
+
tasks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
17
|
+
timeout: z.ZodOptional<z.ZodString>;
|
|
18
|
+
approval: z.ZodOptional<z.ZodEnum<["auto", "confirm", "review"]>>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
type: "task";
|
|
21
|
+
taskType: "subagent" | "script" | "composite" | "human";
|
|
22
|
+
prompt?: string | undefined;
|
|
23
|
+
requires?: {
|
|
24
|
+
apps?: string[] | undefined;
|
|
25
|
+
skills?: string[] | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
tasks?: string[] | undefined;
|
|
28
|
+
timeout?: string | undefined;
|
|
29
|
+
approval?: "auto" | "confirm" | "review" | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
type: "task";
|
|
32
|
+
taskType: "subagent" | "script" | "composite" | "human";
|
|
33
|
+
prompt?: string | undefined;
|
|
34
|
+
requires?: {
|
|
35
|
+
apps?: string[] | undefined;
|
|
36
|
+
skills?: string[] | undefined;
|
|
37
|
+
} | undefined;
|
|
38
|
+
tasks?: string[] | undefined;
|
|
39
|
+
timeout?: string | undefined;
|
|
40
|
+
approval?: "auto" | "confirm" | "review" | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
export type TaskChapterField = z.infer<typeof taskChapterFieldSchema>;
|
|
43
|
+
//# sourceMappingURL=task.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/schemas/task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAajC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const taskChapterFieldSchema = z.object({
|
|
3
|
+
type: z.literal("task"),
|
|
4
|
+
taskType: z.enum(["subagent", "script", "composite", "human"]),
|
|
5
|
+
prompt: z.string().optional(),
|
|
6
|
+
requires: z
|
|
7
|
+
.object({
|
|
8
|
+
apps: z.array(z.string()).optional(),
|
|
9
|
+
skills: z.array(z.string()).optional(),
|
|
10
|
+
})
|
|
11
|
+
.optional(),
|
|
12
|
+
tasks: z.array(z.string()).optional(),
|
|
13
|
+
timeout: z.string().optional(),
|
|
14
|
+
approval: z.enum(["auto", "confirm", "review"]).optional(),
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.js","sourceRoot":"","sources":["../../src/schemas/task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAC9D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,CAAC;SACR,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;QACpC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;KACvC,CAAC;SACD,QAAQ,EAAE;IACb,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC3D,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ResolvedAgent } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A toolFilter entry for a single app in the proxy config.
|
|
4
|
+
*/
|
|
5
|
+
export interface ToolFilter {
|
|
6
|
+
mode: "allow";
|
|
7
|
+
list: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Extract a short name from a chapter package name.
|
|
11
|
+
* Strips the npm scope and any known chapter type prefix.
|
|
12
|
+
*
|
|
13
|
+
* Examples:
|
|
14
|
+
* "@clawmasons/app-github" → "github"
|
|
15
|
+
* "@clawmasons/member-note-taker" → "note-taker"
|
|
16
|
+
* "@clawmasons/slack-server" → "slack-server"
|
|
17
|
+
* "app-github" → "github"
|
|
18
|
+
*/
|
|
19
|
+
export declare function getAppShortName(packageName: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Compute per-app toolFilter allow-lists from the union of all role
|
|
22
|
+
* permissions in a resolved agent.
|
|
23
|
+
*
|
|
24
|
+
* For each app referenced by any role, collects all `allow` lists and
|
|
25
|
+
* computes the set union. Returns a Map keyed by full app package name.
|
|
26
|
+
*/
|
|
27
|
+
export declare function computeToolFilters(agent: ResolvedAgent): Map<string, ToolFilter>;
|
|
28
|
+
//# sourceMappingURL=toolfilter.d.ts.map
|