Class SpaceScopeDeclaration
space_scope of an ai-tool-definitions.json entry). A tool
without one is refused while a call is limited. Exactly one of three kinds:
- a space argument:
space_argnames the argument holding the space id, which must be the call's space; for a read,when_absentsays what an absent or null value means, "use_scope" to read the call's space, anything else to refuse; - an object by id:
object_argnames the argument holding the id, andresolvertheSpaceScopeResolverthat tells the object's space, which must be the call's space; - a read of nothing that belongs to a space, such as the user directory:
unscoped: true.
when_absent: it names the place it changes, and an
absent space is refused, never filled in, since filling it in would change
the target the asker approved.
The call's arguments are then limited to allowed_args, the space or
object argument and false_only_args, each of the latter false or
absent.
An object declaration may say how its id is written, id_format:
"numeric", the default, for decimal digits, or
"hex32" for a JSON string of exactly 32 lowercase
hexadecimal digits, or "matrix_room" for a JSON string
holding a Matrix room id, ! and its local part, with or without
: and its server name and port; the last two are handed to the
resolver as sent. An id_format on another kind, or any other
value, makes the declaration malformed, and the tool is refused.
space_admin: true marks a tool whose use depends on a role in the
space above member, a read or a write. On a write, it administers the
space itself (its settings, its members and their roles, its join
requests, its deletion) or moderates its content (pinning a post,
deleting a post, which a manager may do to another member's), rather than
adding content to it. On a read, it returns what not every member of the
space may see: what only its managers may see (its pending join
requests), or a result that depends on the caller's manager, redactor or
publisher role (its scheduled posts, every one of which its managers,
redactors and publishers see, and each other member only their own).
The server enforces nothing more for it, read or write: the declaration
is checked and the call limited as without the flag. A caller reads it:
one that lets someone approve such a write asks the approver for the
right to manage the space; one whose run answers where every member of
the space reads it keeps such a read out of the run.
space_role names, for a write, the role in the space that a
person must hold for a digital worker to make that write on their behalf
(EXO-91405): "member", "redactor"
(who may add content: any member of a space without redactors),
"publisher" or "manager"; or, on a
declaration of the object kind, "editor": the person must
be able to edit the very object the call reaches, which the declaration's
resolver tells (SpaceScopeResolver#canEdit). A write that declares
none needs "manager", and so does a space_admin
one, which may declare no other role
(getEffectiveSpaceRole(boolean)). An unknown value, another role
on a space_admin declaration, a role on a declaration of the
unscoped kind, or "editor" on one that isn't of the
object kind, makes the declaration malformed. The server enforces
nothing more for it: the caller that runs a digital worker's write for a
person reads it, and lets the write run only for one who holds that role,
the worker remaining the author of what it does. A run with no person
behind it (a scheduled one) asks no role: a write a manager's standing
approval covers runs at once, and any other is a proposal whose approving
manager must hold the role: for a "editor" write, be
able to edit the object in person.
Owned by the add-on that ships the tool: always read from its file, never from the persisted copy an administrator edits.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringTheid_formatvalue of an id of 32 lowercase hexadecimal digits.static final StringTheid_formatvalue of a Matrix room id, with or without its server name.static final StringTheid_formatvalue of a decimal id, the default.static final StringThespace_roleof a write on an object only who could edit that object in person may have made for them, as the object's resolver tells.static final StringThespace_roleof a write only who manages the space may have made for them; the default.static final StringThespace_roleof a write any member of the space may have made for them.static final StringThespace_roleof a write who may publish in the space may have made for them.static final StringThespace_roleof a write who may add content to the space may have made for them.Thespace_rolevalues naming a role in the space, the lowest first.static final StringThewhen_absentvalue that reads the call's space. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetEffectiveSpaceRole(boolean write) The role in the space a person must hold for a digital worker to make this write for them: "manager" for aspace_admindeclaration or one that declares no role, the declared one otherwise.booleanisHexId()booleanbooleanbooleanbooleanbooleanbooleanisWellFormedFor(boolean write) Tells whether the declaration is well formed for its tool: exactly one kind, and, for a write, one that names the place it changes (a space or an object) with nowhen_absent.
-
Field Details
-
USE_SCOPE
-
ID_FORMAT_NUMERIC
Theid_formatvalue of a decimal id, the default.- See Also:
-
ID_FORMAT_HEX32
Theid_formatvalue of an id of 32 lowercase hexadecimal digits.- See Also:
-
ID_FORMAT_MATRIX_ROOM
Theid_formatvalue of a Matrix room id, with or without its server name.- See Also:
-
SPACE_ROLE_MEMBER
Thespace_roleof a write any member of the space may have made for them.- See Also:
-
SPACE_ROLE_REDACTOR
Thespace_roleof a write who may add content to the space may have made for them.- See Also:
-
SPACE_ROLE_PUBLISHER
Thespace_roleof a write who may publish in the space may have made for them.- See Also:
-
SPACE_ROLE_MANAGER
Thespace_roleof a write only who manages the space may have made for them; the default.- See Also:
-
SPACE_ROLE_EDITOR
Thespace_roleof a write on an object only who could edit that object in person may have made for them, as the object's resolver tells.- See Also:
-
SPACE_ROLES
-
-
Constructor Details
-
SpaceScopeDeclaration
public SpaceScopeDeclaration()
-
-
Method Details
-
isSpaceKind
public boolean isSpaceKind()- Returns:
- true when the declaration names a space argument and nothing else
-
isObjectKind
public boolean isObjectKind()- Returns:
- true when the declaration names an object argument with its resolver, and nothing else
-
isUnscopedKind
public boolean isUnscopedKind()- Returns:
- true when the declaration reaches nothing that belongs to a space, and names no space or object argument
-
isWellFormedFor
public boolean isWellFormedFor(boolean write) Tells whether the declaration is well formed for its tool: exactly one kind, and, for a write, one that names the place it changes (a space or an object) with nowhen_absent.- Parameters:
write- true when the tool isn't marked read-only- Returns:
- true when a call limited to one space may run the tool, its arguments permitting
-
getEffectiveSpaceRole
The role in the space a person must hold for a digital worker to make this write for them: "manager" for aspace_admindeclaration or one that declares no role, the declared one otherwise.- Parameters:
write- true when the tool isn't marked read-only- Returns:
- the role, null for a read
-
isHexId
public boolean isHexId()- Returns:
- true when the object id is written as 32 lowercase hexadecimal digits; false for the default, a decimal number
-
isMatrixRoomId
public boolean isMatrixRoomId()- Returns:
- true when the object id is a Matrix room id; false for the default, a decimal number
-
isUseScopeWhenAbsent
public boolean isUseScopeWhenAbsent()- Returns:
- true when an absent space argument reads the call's space; a write declaring it is malformed
-