@segmentstream/ontology 0.113.0 → 0.114.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/CHANGELOG.md +7 -0
- package/dist/analyze.js +11 -8
- package/dist/permissions.d.ts +10 -3
- package/dist/permissions.js +10 -3
- package/dist/runtime/guests.d.ts +2 -1
- package/dist/runtime/guests.js +4 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.114.0
|
|
4
|
+
|
|
5
|
+
`agent_tool:browser` is a built-in permission: roles that name it give their members the agent's
|
|
6
|
+
browser tool, which also needs `agent_tool:sandbox`, where its scripts run. `agent_tool:*` now
|
|
7
|
+
grants it too. Guests never hold it, as they never hold the sandbox: `check` refuses
|
|
8
|
+
`agent_tool:browser` in `guest.permissions`, since the browser acts with the agent's own sign-ins.
|
|
9
|
+
|
|
3
10
|
## 0.113.0
|
|
4
11
|
|
|
5
12
|
A workspace can write every email its people receive, whole. An email in `emails` may be a
|
package/dist/analyze.js
CHANGED
|
@@ -9,7 +9,7 @@ import { CONNECTION_KEY, isConnection } from "./connection.js";
|
|
|
9
9
|
import { isEntity } from "./entity.js";
|
|
10
10
|
import { QUERY_METRICS_ROUTE, LEGACY_MEMBER_NAME, ENTITY_ID, GENERATED_ACTIONS, GENERATED_UPSERT_PREFIX, HISTORY_SUFFIX, MCP_METRIC_TOOLS, MCP_READ_TOOLS, MCP_TOOL_NAME_MAX_LENGTH, MEMBER_ROLE, FEEDBACK_REPORTER_ROLE, GUEST_ROLE, mcpToolName, RESERVED_ENTITY_NAMES, RESERVED_MEMBER_NAMES, RESERVED_RELATIONSHIP_NAMES, SNAKE_CASE_NAME, SYSTEM_PROPERTIES, humanize, isSystemProperty, toCamelCase, } from "./names.js";
|
|
11
11
|
import { REFERENCE_ANNOTATION, propertyDefinition, propertyOptionNames, unknownPropertyOptions, referenceTarget, } from "./property.js";
|
|
12
|
-
import { AGENT_TOOL, AGENT_TOOL_VERBS, EXPLICIT_GRANT_ENTITIES, generatedActionPermissions, grants, isAllowed, namesAgentTools, normalizePermission, parsePermission, parseWorkflowPermission, permissionOf, READ_VERB, rolesGranting, USER_IDENTITY_VERBS, USER_MEMBER_VERBS, WILDCARD, wildcardEntityCovers, WORKSPACE_SOURCE, WORKSPACE_SOURCE_PERMISSION, } from "./permissions.js";
|
|
12
|
+
import { AGENT_TOOL, AGENT_TOOL_VERBS, EXPLICIT_GRANT_ENTITIES, generatedActionPermissions, grants, isAllowed, MEMBER_AGENT_TOOLS, namesAgentTools, normalizePermission, parsePermission, parseWorkflowPermission, permissionOf, READ_VERB, rolesGranting, USER_IDENTITY_VERBS, USER_MEMBER_VERBS, WILDCARD, wildcardEntityCovers, WORKSPACE_SOURCE, WORKSPACE_SOURCE_PERMISSION, } from "./permissions.js";
|
|
13
13
|
import { ON_DELETE, isRelationship } from "./relationship.js";
|
|
14
14
|
import { isRole, member, role } from "./role.js";
|
|
15
15
|
import { CHANNEL_PROVIDERS, DEFAULT_SIGN_IN_POLICY, GUEST_BOT_CHECK_SCHEMES, GUEST_CHANNELS, SIGN_UP_CHANNELS, SIGN_UP_CHAT_CHANNELS, isGuestBotCheckScheme, isGuestChannel, isSignInPolicy, isSignUpChannel, websiteOrigin, } from "./sign-in.js";
|
|
@@ -1690,7 +1690,7 @@ function usesMe(value) {
|
|
|
1690
1690
|
* unlink on every record; an unscoped read of a stored entity is warned about. A guest is no user,
|
|
1691
1691
|
* so a scope naming `me` would match nothing, and the built-in entities, which concern members,
|
|
1692
1692
|
* are not a guest's to use. Of the agent's own tools a guest may hold `agent_tool:web`, never the
|
|
1693
|
-
* sandbox.
|
|
1693
|
+
* sandbox or the browser.
|
|
1694
1694
|
*/
|
|
1695
1695
|
function checkGuestPermissions(input) {
|
|
1696
1696
|
const { entities, guest, report } = input;
|
|
@@ -1716,11 +1716,14 @@ function checkGuestPermissions(input) {
|
|
|
1716
1716
|
report("invalid-sign-in", path, `Guests cannot hold ${String(permission)}; name the entities they may use.`);
|
|
1717
1717
|
continue;
|
|
1718
1718
|
}
|
|
1719
|
-
// A guest may read the agent's listed websites, never run its sandbox
|
|
1720
|
-
// records and files of whoever it acts for,
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1719
|
+
// A guest may read the agent's listed websites, never run its sandbox or drive its browser:
|
|
1720
|
+
// the sandbox reads the records and files of whoever it acts for, the browser acts with the
|
|
1721
|
+
// agent's own sign-ins, and anyone opening the website is a guest.
|
|
1722
|
+
if (parsed.entity === AGENT_TOOL &&
|
|
1723
|
+
(MEMBER_AGENT_TOOLS.has(parsed.verb) || parsed.verb === WILDCARD)) {
|
|
1724
|
+
report("invalid-sign-in", path, `Guests cannot hold ${String(permission)}: the agent's sandbox and browser are never a ` +
|
|
1725
|
+
`guest's. Name ${AGENT_TOOL}:web alone for the agent to read the websites web.domains ` +
|
|
1726
|
+
"lists for them.");
|
|
1724
1727
|
continue;
|
|
1725
1728
|
}
|
|
1726
1729
|
const entity = entities.find((resolved) => resolved.name === parsed.entity);
|
|
@@ -2667,7 +2670,7 @@ function knownVerbs(entities, toolsets = []) {
|
|
|
2667
2670
|
verbs.set(AGENT_TOOL, new Set(AGENT_TOOL_VERBS));
|
|
2668
2671
|
return verbs;
|
|
2669
2672
|
}
|
|
2670
|
-
/** `agent_tool:sandbox and agent_tool:
|
|
2673
|
+
/** `agent_tool:sandbox, agent_tool:web and agent_tool:browser`, for messages. */
|
|
2671
2674
|
function agentToolPermissions() {
|
|
2672
2675
|
return listed(AGENT_TOOL_VERBS.map((tool) => `${AGENT_TOOL}:${tool}`));
|
|
2673
2676
|
}
|
package/dist/permissions.d.ts
CHANGED
|
@@ -45,11 +45,18 @@ export declare const AGENT_TOOL = "agent_tool";
|
|
|
45
45
|
/**
|
|
46
46
|
* The agent's own tools a role may grant. `sandbox`: the shell and file tools in the agent's
|
|
47
47
|
* sandbox, copying a file the caller may read into it, and calling an ontology tool with arguments
|
|
48
|
-
* from a file in it. `web`: fetching pages from the domains the agent's configuration lists.
|
|
49
|
-
* agent's
|
|
48
|
+
* from a file in it. `web`: fetching pages from the domains the agent's configuration lists.
|
|
49
|
+
* `browser`: driving the agent's own cloud browser, signed in as the agent, with scripts that run
|
|
50
|
+
* in its sandbox, so the agent also needs the sandbox for it. The agent's configuration says which
|
|
51
|
+
* of them the agent has; the roles say which caller gets them.
|
|
50
52
|
*/
|
|
51
|
-
export declare const AGENT_TOOL_VERBS: readonly ["sandbox", "web"];
|
|
53
|
+
export declare const AGENT_TOOL_VERBS: readonly ["sandbox", "web", "browser"];
|
|
52
54
|
export type AgentToolVerb = (typeof AGENT_TOOL_VERBS)[number];
|
|
55
|
+
/**
|
|
56
|
+
* The agent tools no guest may hold, whoever opens the website: the sandbox reads the records and
|
|
57
|
+
* files of whoever the agent acts for, and the browser acts with the agent's own sign-ins.
|
|
58
|
+
*/
|
|
59
|
+
export declare const MEMBER_AGENT_TOOLS: ReadonlySet<AgentToolVerb>;
|
|
53
60
|
/** `agent_tool:sandbox`. */
|
|
54
61
|
export declare function agentToolPermission(tool: AgentToolVerb): string;
|
|
55
62
|
/**
|
package/dist/permissions.js
CHANGED
|
@@ -52,10 +52,17 @@ export const AGENT_TOOL = "agent_tool";
|
|
|
52
52
|
/**
|
|
53
53
|
* The agent's own tools a role may grant. `sandbox`: the shell and file tools in the agent's
|
|
54
54
|
* sandbox, copying a file the caller may read into it, and calling an ontology tool with arguments
|
|
55
|
-
* from a file in it. `web`: fetching pages from the domains the agent's configuration lists.
|
|
56
|
-
* agent's
|
|
55
|
+
* from a file in it. `web`: fetching pages from the domains the agent's configuration lists.
|
|
56
|
+
* `browser`: driving the agent's own cloud browser, signed in as the agent, with scripts that run
|
|
57
|
+
* in its sandbox, so the agent also needs the sandbox for it. The agent's configuration says which
|
|
58
|
+
* of them the agent has; the roles say which caller gets them.
|
|
57
59
|
*/
|
|
58
|
-
export const AGENT_TOOL_VERBS = ["sandbox", "web"];
|
|
60
|
+
export const AGENT_TOOL_VERBS = ["sandbox", "web", "browser"];
|
|
61
|
+
/**
|
|
62
|
+
* The agent tools no guest may hold, whoever opens the website: the sandbox reads the records and
|
|
63
|
+
* files of whoever the agent acts for, and the browser acts with the agent's own sign-ins.
|
|
64
|
+
*/
|
|
65
|
+
export const MEMBER_AGENT_TOOLS = new Set(["sandbox", "browser"]);
|
|
59
66
|
/** `agent_tool:sandbox`. */
|
|
60
67
|
export function agentToolPermission(tool) {
|
|
61
68
|
return `${AGENT_TOOL}:${tool}`;
|
package/dist/runtime/guests.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ export declare function isGuestRole(ontology: Ontology, role: string): boolean;
|
|
|
17
17
|
export declare function userRoleNames(ontology: Ontology): ReadonlyArray<string>;
|
|
18
18
|
/**
|
|
19
19
|
* The agent's own tools a caller holds, as every answer naming whom the agent acts for carries them.
|
|
20
|
-
* A guest holds those `guest.permissions` grant, never the sandbox and never
|
|
20
|
+
* A guest holds those `guest.permissions` grant, never the sandbox or the browser, and never
|
|
21
|
+
* implicitly. Anyone
|
|
21
22
|
* else holds those the ontology's roles grant, and the guests' role decides nothing for them: while
|
|
22
23
|
* no other role names an agent tool, they keep the earlier implicit sandbox.
|
|
23
24
|
*/
|
package/dist/runtime/guests.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GUEST_ROLE } from "../names.js";
|
|
2
|
-
import { AGENT_TOOL_VERBS, agentToolPermission, agentToolsOf, isAllowed, permissionsOf, principalScopes, } from "../permissions.js";
|
|
2
|
+
import { AGENT_TOOL_VERBS, agentToolPermission, agentToolsOf, isAllowed, MEMBER_AGENT_TOOLS, permissionsOf, principalScopes, } from "../permissions.js";
|
|
3
3
|
import { WEB_PROVIDER } from "../service/runtime-identity.js";
|
|
4
4
|
import { isRecordId } from "./records.js";
|
|
5
5
|
/**
|
|
@@ -26,13 +26,14 @@ export function userRoleNames(ontology) {
|
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* The agent's own tools a caller holds, as every answer naming whom the agent acts for carries them.
|
|
29
|
-
* A guest holds those `guest.permissions` grant, never the sandbox and never
|
|
29
|
+
* A guest holds those `guest.permissions` grant, never the sandbox or the browser, and never
|
|
30
|
+
* implicitly. Anyone
|
|
30
31
|
* else holds those the ontology's roles grant, and the guests' role decides nothing for them: while
|
|
31
32
|
* no other role names an agent tool, they keep the earlier implicit sandbox.
|
|
32
33
|
*/
|
|
33
34
|
export function agentToolsFor(ontology, principal) {
|
|
34
35
|
if (principal.kind === "guest") {
|
|
35
|
-
return AGENT_TOOL_VERBS.filter((tool) => tool
|
|
36
|
+
return AGENT_TOOL_VERBS.filter((tool) => !MEMBER_AGENT_TOOLS.has(tool) && isAllowed(agentToolPermission(tool), principal));
|
|
36
37
|
}
|
|
37
38
|
return agentToolsOf(ontology.roles.filter((candidate) => !isGuestRole(ontology, candidate.name)), principal);
|
|
38
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/ontology",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.114.0",
|
|
4
4
|
"description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SegmentStream",
|