Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

refactor(soup): typed owner across soup models, filters, projections and GraphQL (#6712)

Will Hutchinson266d8c89ea66
diff --git a/.config/hakari.toml b/.config/hakari.toml
index 6fbd2c73c1..d68f2eb1ab 100644
--- a/.config/hakari.toml
+++ b/.config/hakari.toml
@@ -82,6 +82,12 @@ workspace-members = [
"document_sub_type",
"model_file_type",
"macro_user_id",
+ # Typed owner reference and the bot id it parses. The filter literals'
+ # owner is a `model_owner::Owner`, so both are now in the browser-side
+ # filter model chain (item_filters -> item-filter-index ->
+ # soup-filter-cache-adapter -> cache-wasm) and must stay wasm-safe.
+ "model_owner",
+ "bot_id",
"macro_uuid",
"non_empty",
"cowlike",
diff --git a/.github/workspace-dep-closures.json b/.github/workspace-dep-closures.json
index da892df875..1e7a33773a 100644
--- a/.github/workspace-dep-closures.json
+++ b/.github/workspace-dep-closures.json
@@ -1437,8 +1437,7 @@
],
"bot_id": [
"crates/bot_id",
- "crates/cowlike",
- "crates/workspace-hack"
+ "crates/cowlike"
],
"bot_token": [
"crates/bot_token",
@@ -4617,6 +4616,7 @@
"crates/workspace-hack"
],
"frecency": [
+ "crates/bot_id",
"crates/cowlike",
"crates/document_sub_type",
"crates/filter_ast",
@@ -4625,6 +4625,7 @@
"crates/macro_user_id",
"crates/model-entity",
"crates/model_file_type",
+ "crates/model_owner",
"crates/non_empty",
"crates/notification_state",
"crates/workspace-hack"
@@ -4802,6 +4803,7 @@
"crates/model-entity",
"crates/model-error-response",
"crates/model_file_type",
+ "crates/model_owner",
"crates/model_user",
"crates/models_pagination",
"crates/models_properties",
@@ -4898,6 +4900,7 @@
"crates/model-entity",
"crates/model-error-response",
"crates/model_file_type",
+ "crates/model_owner",
"crates/model_user",
"crates/models_properties",
"crates/non_empty",
@@ -5488,6 +5491,7 @@
"crates/model-entity",
"crates/model-error-response",
"crates/model_file_type",
+ "crates/model_owner",
"crates/model_user",
"crates/models_properties",
"crates/non_empty",
@@ -5737,6 +5741,7 @@
"crates/workspace-hack"
],
"item-filter-index": [
+ "crates/bot_id",
"crates/cowlike",
"crates/document_sub_type",
"crates/filter_ast",
@@ -5744,17 +5749,20 @@
"crates/item_filters",
"crates/macro_user_id",
"crates/model_file_type",
+ "crates/model_owner",
"crates/non_empty",
"crates/notification_state",
"crates/predicate_index"
],
"item_filters": [
+ "crates/bot_id",
"crates/cowlike",
"crates/document_sub_type",
"crates/filter_ast",
"crates/item_filters",
"crates/macro_user_id",
"crates/model_file_type",
+ "crates/model_owner",
"crates/non_empty",
"crates/notification_state"
],
@@ -6676,8 +6684,7 @@
"crates/bot_id",
"crates/cowlike",
"crates/macro_user_id",
- "crates/model_owner",
- "crates/workspace-hack"
+ "crates/model_owner"
],
"model_user": [
"crates/cowlike",
diff --git a/Cargo.lock b/Cargo.lock
index 7e68a35566..5161bd3b27 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2906,7 +2906,6 @@ dependencies = [
"thiserror 2.0.18",
"utoipa",
"uuid",
- "workspace-hack",
]
[[package]]
@@ -4033,6 +4032,7 @@ dependencies = [
"macro_user_id",
"model-entity",
"model_notifications",
+ "model_owner",
"model_user",
"models_pagination",
"models_properties",
@@ -7541,6 +7541,7 @@ dependencies = [
"macro_authorization",
"macro_user_id",
"model-entity",
+ "model_owner",
"model_user",
"models_properties",
"rootcause",
@@ -7688,6 +7689,7 @@ dependencies = [
"macro_user_id",
"model-entity",
"model_file_type",
+ "model_owner",
"models_grouping",
"models_pagination",
"models_properties",
@@ -7717,6 +7719,7 @@ dependencies = [
"item_filters",
"macro_user_id",
"model_file_type",
+ "model_owner",
"notification_state",
"serde",
"serde_json",
@@ -9192,6 +9195,7 @@ dependencies = [
"filter_ast",
"macro_user_id",
"model_file_type",
+ "model_owner",
"nom 8.0.0",
"non_empty",
"notification_state",
@@ -11177,7 +11181,6 @@ dependencies = [
"sqlx",
"thiserror 2.0.18",
"uuid",
- "workspace-hack",
]
[[package]]
@@ -11380,6 +11383,7 @@ dependencies = [
"macro_user_id",
"model",
"model-entity",
+ "model_owner",
"models_pagination",
"models_properties",
"reminders",
@@ -15949,6 +15953,7 @@ dependencies = [
"mockall",
"model-entity",
"model-error-response",
+ "model_owner",
"model_user",
"models_grouping",
"models_pagination",
@@ -16002,7 +16007,7 @@ dependencies = [
"chrono",
"document_sub_type",
"item-filter-index",
- "macro_user_id",
+ "model_owner",
"models_soup",
"postcard",
"predicate-index",
diff --git a/apps/web/src/lib/service-clients/service-search/generated/models/agentSessionFilters.ts b/apps/web/src/lib/service-clients/service-search/generated/models/agentSessionFilters.ts
index 102511dd35..e9cae41ecc 100644
--- a/apps/web/src/lib/service-clients/service-search/generated/models/agentSessionFilters.ts
+++ b/apps/web/src/lib/service-clients/service-search/generated/models/agentSessionFilters.ts
@@ -15,7 +15,8 @@ export interface AgentSessionFilters {
default — see [`crate::ast::agent_session::AgentSessionLiteral::Include`].
Asking for specific `ids` or `owners` also opts in. */
include?: boolean;
- /** Filter by session owner. Examples: ['macro|[email protected]']. Empty to
-include every owner. */
+ /** Filter by session owner principal — a user ('macro|[email protected]'), a bot
+('bot|<uuid>'), or a team (a bare hyphenated uuid). Empty to include every
+owner. */
owners?: string[];
}
diff --git a/apps/web/src/lib/service-clients/service-search/generated/models/chatFilters.ts b/apps/web/src/lib/service-clients/service-search/generated/models/chatFilters.ts
index 6eeb696fd3..85c2826cd8 100644
--- a/apps/web/src/lib/service-clients/service-search/generated/models/chatFilters.ts
+++ b/apps/web/src/lib/service-clients/service-search/generated/models/chatFilters.ts
@@ -17,7 +17,10 @@ export interface ChatFilters {
importance?: ChatFiltersImportance;
/** Filter by chat notification state. */
notification_filters?: NotificationFilters;
- /** Filter by chat owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners. */
+ /** Filter by chat owner principal — a user ('macro|[email protected]'), a bot
+('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+search all owners. */
owners?: string[];
/** A list of project ids to search within. Examples: ['project1']. Empty to ignore project filtering. */
project_ids?: string[];
diff --git a/apps/web/src/lib/service-clients/service-search/generated/models/documentFilters.ts b/apps/web/src/lib/service-clients/service-search/generated/models/documentFilters.ts
index c8a71184cc..a8624fc851 100644
--- a/apps/web/src/lib/service-clients/service-search/generated/models/documentFilters.ts
+++ b/apps/web/src/lib/service-clients/service-search/generated/models/documentFilters.ts
@@ -23,7 +23,10 @@ export interface DocumentFilters {
is_email_attachment?: DocumentFiltersIsEmailAttachment;
/** Filter by document notification state. */
notification_filters?: NotificationFilters;
- /** Filter by document owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners. */
+ /** Filter by document owner principal — a user ('macro|[email protected]'), a bot
+('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+search all owners. */
owners?: string[];
/** A list of project ids to search within. Examples: ['project1'].
filtering. Empty to ignore project filtering. */
diff --git a/apps/web/src/lib/service-clients/service-search/generated/models/projectFilters.ts b/apps/web/src/lib/service-clients/service-search/generated/models/projectFilters.ts
index 8092aa4eb8..da19c936ec 100644
--- a/apps/web/src/lib/service-clients/service-search/generated/models/projectFilters.ts
+++ b/apps/web/src/lib/service-clients/service-search/generated/models/projectFilters.ts
@@ -18,7 +18,10 @@ export interface ProjectFilters {
include_root?: boolean;
/** Filter by project notification state. */
notification_filters?: NotificationFilters;
- /** Filter by project owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners. */
+ /** Filter by project owner principal — a user ('macro|[email protected]'), a bot
+('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+search all owners. */
owners?: string[];
/** Project IDs to search within. Examples: ['project1']. Empty to search all accessible projects.
By default matches children of these projects; set `include_root` to also match the projects themselves. */
diff --git a/apps/web/src/lib/service-clients/service-search/openapi.json b/apps/web/src/lib/service-clients/service-search/openapi.json
index ba0b767231..e65378d168 100644
--- a/apps/web/src/lib/service-clients/service-search/openapi.json
+++ b/apps/web/src/lib/service-clients/service-search/openapi.json
@@ -198,7 +198,7 @@
"items": {
"type": "string"
},
- "description": "Filter by session owner. Examples: ['macro|[email protected]']. Empty to\ninclude every owner."
+ "description": "Filter by session owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Empty to include every\nowner."
}
}
},
@@ -1191,7 +1191,7 @@
"items": {
"type": "string"
},
- "description": "Filter by chat owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "description": "Filter by chat owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
},
"project_ids": {
"type": "array",
@@ -1540,7 +1540,7 @@
"items": {
"type": "string"
},
- "description": "Filter by document owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "description": "Filter by document owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
},
"project_ids": {
"type": "array",
@@ -2766,7 +2766,7 @@
"items": {
"type": "string"
},
- "description": "Filter by project owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "description": "Filter by project owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
},
"project_ids": {
"type": "array",
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/agentSessionFilters.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/agentSessionFilters.ts
index a16c81c3c9..f4d21cea36 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/agentSessionFilters.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/agentSessionFilters.ts
@@ -15,7 +15,8 @@ export interface AgentSessionFilters {
default — see [`crate::ast::agent_session::AgentSessionLiteral::Include`].
Asking for specific `ids` or `owners` also opts in. */
include?: boolean;
- /** Filter by session owner. Examples: ['macro|[email protected]']. Empty to
-include every owner. */
+ /** Filter by session owner principal — a user ('macro|[email protected]'), a bot
+('bot|<uuid>'), or a team (a bare hyphenated uuid). Empty to include every
+owner. */
owners?: string[];
}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/chatFilters.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/chatFilters.ts
index 8a5c9ea96e..b08714f763 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/chatFilters.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/chatFilters.ts
@@ -17,7 +17,10 @@ export interface ChatFilters {
importance?: ChatFiltersImportance;
/** Filter by chat notification state. */
notification_filters?: NotificationFilters;
- /** Filter by chat owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners. */
+ /** Filter by chat owner principal — a user ('macro|[email protected]'), a bot
+('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+search all owners. */
owners?: string[];
/** A list of project ids to search within. Examples: ['project1']. Empty to ignore project filtering. */
project_ids?: string[];
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/documentFilters.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/documentFilters.ts
index d42c9ad3ed..9db01c6755 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/documentFilters.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/documentFilters.ts
@@ -23,7 +23,10 @@ export interface DocumentFilters {
is_email_attachment?: DocumentFiltersIsEmailAttachment;
/** Filter by document notification state. */
notification_filters?: NotificationFilters;
- /** Filter by document owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners. */
+ /** Filter by document owner principal — a user ('macro|[email protected]'), a bot
+('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+search all owners. */
owners?: string[];
/** A list of project ids to search within. Examples: ['project1'].
filtering. Empty to ignore project filtering. */
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/projectFilters.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/projectFilters.ts
index debab5d539..5c07d51625 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/projectFilters.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/projectFilters.ts
@@ -18,7 +18,10 @@ export interface ProjectFilters {
include_root?: boolean;
/** Filter by project notification state. */
notification_filters?: NotificationFilters;
- /** Filter by project owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners. */
+ /** Filter by project owner principal — a user ('macro|[email protected]'), a bot
+('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+search all owners. */
owners?: string[];
/** Project IDs to search within. Examples: ['project1']. Empty to search all accessible projects.
By default matches children of these projects; set `include_root` to also match the projects themselves. */
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwo.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwo.ts
index a85ddbc0f4..cdaf3d4997 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwo.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/soupProjectSoupPropertiesFieldAllOfTwo.ts
@@ -17,7 +17,7 @@ export type SoupProjectSoupPropertiesFieldAllOfTwo = {
id: string;
/** The name of the project */
name: string;
- /** The user id of who created the project */
+ /** The owner of the project */
ownerId: string;
/** The parent project id */
parentId?: SoupProjectSoupPropertiesFieldAllOfTwoParentId;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
index e92d3e462c..2ed2184352 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
@@ -10872,9 +10872,7 @@ export const getItemsSoupResponse = zod
.describe('The time the project was deleted'),
id: zod.uuid().describe('The id of the project'),
name: zod.string().describe('The name of the project'),
- ownerId: zod
- .string()
- .describe('The user id of who created the project'),
+ ownerId: zod.string().describe('The owner of the project'),
parentId: zod
.uuid()
.nullish()
@@ -13316,7 +13314,7 @@ export const postItemsSoupBody = zod
.array(zod.string())
.optional()
.describe(
- "Filter by session owner. Examples: ['macro|[email protected]']. Empty to\ninclude every owner."
+ "Filter by session owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Empty to include every\nowner."
),
})
.optional()
@@ -13533,7 +13531,7 @@ export const postItemsSoupBody = zod
.array(zod.string())
.optional()
.describe(
- "Filter by chat owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "Filter by chat owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
),
project_ids: zod
.array(zod.string())
@@ -13618,7 +13616,7 @@ export const postItemsSoupBody = zod
.array(zod.string())
.optional()
.describe(
- "Filter by document owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "Filter by document owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
),
project_ids: zod
.array(zod.string())
@@ -13843,7 +13841,7 @@ export const postItemsSoupBody = zod
.array(zod.string())
.optional()
.describe(
- "Filter by project owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "Filter by project owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
),
project_ids: zod
.array(zod.string())
@@ -14848,9 +14846,7 @@ export const postItemsSoupResponse = zod
.describe('The time the project was deleted'),
id: zod.uuid().describe('The id of the project'),
name: zod.string().describe('The name of the project'),
- ownerId: zod
- .string()
- .describe('The user id of who created the project'),
+ ownerId: zod.string().describe('The owner of the project'),
parentId: zod
.uuid()
.nullish()
@@ -18265,9 +18261,7 @@ export const postItemsSoupAstResponse = zod
.describe('The time the project was deleted'),
id: zod.uuid().describe('The id of the project'),
name: zod.string().describe('The name of the project'),
- ownerId: zod
- .string()
- .describe('The user id of who created the project'),
+ ownerId: zod.string().describe('The owner of the project'),
parentId: zod
.uuid()
.nullish()
@@ -21952,7 +21946,7 @@ export const postItemsSoupAstGroupedResponse = zod
.describe('The name of the project'),
ownerId: zod
.string()
- .describe('The user id of who created the project'),
+ .describe('The owner of the project'),
parentId: zod
.uuid()
.nullish()
@@ -25369,7 +25363,7 @@ export const postItemsSoupAstGroupedResponse = zod
.describe('The name of the project'),
ownerId: zod
.string()
- .describe('The user id of who created the project'),
+ .describe('The owner of the project'),
parentId: zod
.uuid()
.nullish()
diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
index 1be83e2ac8..bffe364834 100644
--- a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
+++ b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
@@ -138,7 +138,10 @@ export type GraphqlAgentSessionLiteral =
* is the default.
*/
include: boolean; owner?: never; }
- | { id?: never; include?: never; /** The owner option. */
+ | { id?: never; include?: never; /**
+ * The owner principal option — a user (`macro|<email>`), a bot
+ * (`bot|<uuid>`), or a team (a bare hyphenated uuid).
+ */
owner: string; };
/** The two operands of a recursive `CalendarEventFilterExpr` binary expression. */
@@ -336,7 +339,10 @@ export type GraphqlChatLiteral =
importance: boolean; notificationState?: never; owner?: never; projectId?: never; role?: never; updatedAt?: never; }
| { chatId?: never; createdAt?: never; importance?: never; /** Exact notification state for the requester. */
notificationState: NotificationState; owner?: never; projectId?: never; role?: never; updatedAt?: never; }
- | { chatId?: never; createdAt?: never; importance?: never; notificationState?: never; /** The owner option. */
+ | { chatId?: never; createdAt?: never; importance?: never; notificationState?: never; /**
+ * The owner principal option — a user (`macro|<email>`), a bot
+ * (`bot|<uuid>`), or a team (a bare hyphenated uuid).
+ */
owner: string; projectId?: never; role?: never; updatedAt?: never; }
| { chatId?: never; createdAt?: never; importance?: never; notificationState?: never; owner?: never; /** The project id option. */
projectId: string | number; role?: never; updatedAt?: never; }
@@ -435,7 +441,10 @@ export type GraphqlDocumentLiteral =
isEmailAttachment: boolean; notificationState?: never; owner?: never; projectId?: never; subType?: never; updatedAt?: never; }
| { createdAt?: never; fileAssoc?: never; fileType?: never; id?: never; importance?: never; includeCbmAtmNc?: never; isEmailAttachment?: never; /** Exact notification state for the requester. */
notificationState: NotificationState; owner?: never; projectId?: never; subType?: never; updatedAt?: never; }
- | { createdAt?: never; fileAssoc?: never; fileType?: never; id?: never; importance?: never; includeCbmAtmNc?: never; isEmailAttachment?: never; notificationState?: never; /** The owner option. */
+ | { createdAt?: never; fileAssoc?: never; fileType?: never; id?: never; importance?: never; includeCbmAtmNc?: never; isEmailAttachment?: never; notificationState?: never; /**
+ * The owner principal option — a user (`macro|<email>`), a bot
+ * (`bot|<uuid>`), or a team (a bare hyphenated uuid).
+ */
owner: string; projectId?: never; subType?: never; updatedAt?: never; }
| { createdAt?: never; fileAssoc?: never; fileType?: never; id?: never; importance?: never; includeCbmAtmNc?: never; isEmailAttachment?: never; notificationState?: never; owner?: never; /** The project id option. */
projectId: string | number; subType?: never; updatedAt?: never; }
@@ -847,7 +856,10 @@ export type GraphqlProjectLiteral =
importance: boolean; notificationState?: never; owner?: never; projectId?: never; projectIdSelf?: never; updatedAt?: never; }
| { createdAt?: never; importance?: never; /** Exact notification state for the requester. */
notificationState: NotificationState; owner?: never; projectId?: never; projectIdSelf?: never; updatedAt?: never; }
- | { createdAt?: never; importance?: never; notificationState?: never; /** The owner option. */
+ | { createdAt?: never; importance?: never; notificationState?: never; /**
+ * The owner principal option — a user (`macro|<email>`), a bot
+ * (`bot|<uuid>`), or a team (a bare hyphenated uuid).
+ */
owner: string; projectId?: never; projectIdSelf?: never; updatedAt?: never; }
| { createdAt?: never; importance?: never; notificationState?: never; owner?: never; /** The project id option. */
projectId: string | number; projectIdSelf?: never; updatedAt?: never; }
diff --git a/apps/web/src/lib/service-clients/service-storage/openapi.json b/apps/web/src/lib/service-clients/service-storage/openapi.json
index c6a36d9560..d0e667ea69 100644
--- a/apps/web/src/lib/service-clients/service-storage/openapi.json
+++ b/apps/web/src/lib/service-clients/service-storage/openapi.json
@@ -14415,7 +14415,7 @@
"items": {
"type": "string"
},
- "description": "Filter by session owner. Examples: ['macro|[email protected]']. Empty to\ninclude every owner."
+ "description": "Filter by session owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Empty to include every\nowner."
}
}
},
@@ -18389,7 +18389,7 @@
"items": {
"type": "string"
},
- "description": "Filter by chat owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "description": "Filter by chat owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
},
"project_ids": {
"type": "array",
@@ -20667,7 +20667,7 @@
"items": {
"type": "string"
},
- "description": "Filter by document owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "description": "Filter by document owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
},
"project_ids": {
"type": "array",
@@ -26334,7 +26334,7 @@
"items": {
"type": "string"
},
- "description": "Filter by project owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "description": "Filter by project owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
},
"project_ids": {
"type": "array",
@@ -29120,7 +29120,7 @@
},
"ownerId": {
"type": "string",
- "description": "The user id of who created the project"
+ "description": "The owner of the project"
},
"parentId": {
"type": ["string", "null"],
diff --git a/crates/bot_id/Cargo.toml b/crates/bot_id/Cargo.toml
index e8c1e202eb..5d6426b875 100644
--- a/crates/bot_id/Cargo.toml
+++ b/crates/bot_id/Cargo.toml
@@ -17,4 +17,3 @@ sqlx = { workspace = true, optional = true }
thiserror = { workspace = true }
utoipa = { workspace = true, optional = true }
uuid = { workspace = true }
-workspace-hack = { version = "0.1", path = "../workspace-hack" }
diff --git a/crates/complete_graph/Cargo.toml b/crates/complete_graph/Cargo.toml
index 354e57964f..871bba0b67 100644
--- a/crates/complete_graph/Cargo.toml
+++ b/crates/complete_graph/Cargo.toml
@@ -51,6 +51,7 @@ workspace-hack = { version = "0.1", path = "../workspace-hack" }
activity = { path = "../activity", default-features = false, features = ["realtime"] }
apollo-compiler = { workspace = true }
chrono = { workspace = true }
+model_owner = { path = "../model_owner" }
model_user = { path = "../model_user" }
models_pagination = { path = "../models_pagination" }
models_properties = { path = "../models_properties" }
diff --git a/crates/complete_graph/src/schema/test.rs b/crates/complete_graph/src/schema/test.rs
index e4e77d53fc..940e5a3c7b 100644
--- a/crates/complete_graph/src/schema/test.rs
+++ b/crates/complete_graph/src/schema/test.rs
@@ -27,6 +27,7 @@ use macro_user_id::{
user_id::{MacroUserId, MacroUserIdStr},
};
use model_entity::EntityType as ModelEntityType;
+use model_owner::Owner;
use model_user::UserContext;
use models_pagination::{Paginated, PaginatedCursor, SimpleSortMethod};
use models_soup::{
@@ -87,7 +88,7 @@ fn soup_project(id: Uuid) -> SoupItem<()> {
SoupItem::Project(SoupProject {
id,
name: format!("Project {id}"),
- owner_id: MacroUserIdStr::parse_from_str(VALID_USER_ID).unwrap(),
+ owner_id: Owner::from_principal_str(VALID_USER_ID).unwrap(),
parent_id: None,
created_at: Default::default(),
updated_at: Default::default(),
@@ -102,7 +103,7 @@ fn soup_chat(id: Uuid) -> SoupItem<()> {
id,
name: format!("Chat {id}"),
model: Some("openai/gpt-5.6".to_string()),
- owner_id: MacroUserIdStr::parse_from_str(VALID_USER_ID).unwrap(),
+ owner_id: Owner::from_principal_str(VALID_USER_ID).unwrap(),
project_id: None,
is_persistent: true,
created_at: Default::default(),
@@ -117,7 +118,7 @@ fn grouped_document(id: Uuid) -> SoupItem<soup::domain::models::SoupPropertiesFi
SoupItem::Document(SoupDocument {
id,
document_version_id: 1,
- owner_id: MacroUserIdStr::parse_from_str(VALID_USER_ID).unwrap(),
+ owner_id: Owner::from_principal_str(VALID_USER_ID).unwrap(),
name: format!("Document {id}"),
file_type: None,
sha: None,
diff --git a/crates/graphql_common/Cargo.toml b/crates/graphql_common/Cargo.toml
index f530752a9f..06270ad6c3 100644
--- a/crates/graphql_common/Cargo.toml
+++ b/crates/graphql_common/Cargo.toml
@@ -15,6 +15,7 @@ macro_authorization = { path = "../macro_authorization", default-features = fals
] }
macro_user_id = { path = "../macro_user_id" }
model-entity = { path = "../model-entity" }
+model_owner = { path = "../model_owner" }
models_properties = { path = "../models_properties" }
rootcause = { workspace = true }
serde = { workspace = true }
diff --git a/crates/graphql_common/src/lib.rs b/crates/graphql_common/src/lib.rs
index e7262dc7c1..acd6cb599d 100644
--- a/crates/graphql_common/src/lib.rs
+++ b/crates/graphql_common/src/lib.rs
@@ -17,6 +17,8 @@ mod extract;
mod filter_input;
/// Shared page-size argument validation.
mod limit;
+/// Shared GraphQL owner-type mapping.
+mod owner_type;
/// Property-filter GraphQL input types.
mod property_filter;
/// Request-scoped context used by GraphQL resolvers.
@@ -29,6 +31,7 @@ pub use entity_type::{
pub use extract::extract_part;
pub use filter_input::{IntoFilterExpr, optional_tree, parse_id, parse_macro_user_id, parse_uuid};
pub use limit::parse_limit;
+pub use owner_type::GraphqlOwnerType;
pub use property_filter::{
GraphqlPropertiesBinaryExpr, GraphqlPropertiesExpr, GraphqlPropertiesLiteral,
GraphqlPropertyEntityType, GraphqlPropertyMatchValue,
diff --git a/crates/graphql_common/src/owner_type.rs b/crates/graphql_common/src/owner_type.rs
new file mode 100644
index 0000000000..9f4b40360a
--- /dev/null
+++ b/crates/graphql_common/src/owner_type.rs
@@ -0,0 +1,25 @@
+use async_graphql::Enum;
+use model_owner::OwnerType;
+
+/// GraphQL representation of [`OwnerType`]: the kind of principal that owns an
+/// entity. Paired with an `ownerId` principal string, which is a user id, a
+/// bot id, or a team id depending on this discriminator.
+#[derive(Enum, Copy, Clone, Eq, PartialEq, Hash)]
+pub enum GraphqlOwnerType {
+ /// A Macro user.
+ User,
+ /// A bot.
+ Bot,
+ /// A team.
+ Team,
+}
+
+impl From<OwnerType> for GraphqlOwnerType {
+ fn from(value: OwnerType) -> Self {
+ match value {
+ OwnerType::User => Self::User,
+ OwnerType::Bot => Self::Bot,
+ OwnerType::Team => Self::Team,
+ }
+ }
+}
diff --git a/crates/graphql_soup/Cargo.toml b/crates/graphql_soup/Cargo.toml
index 274afba202..7f2f3d4417 100644
--- a/crates/graphql_soup/Cargo.toml
+++ b/crates/graphql_soup/Cargo.toml
@@ -47,4 +47,5 @@ workspace-hack = { version = "0.1", path = "../workspace-hack" }
[dev-dependencies]
either = { workspace = true }
+model_owner = { path = "../model_owner" }
models_properties = { path = "../models_properties" }
diff --git a/crates/graphql_soup/src/loaders/test.rs b/crates/graphql_soup/src/loaders/test.rs
index 8cd0411fa5..35f2cc585b 100644
--- a/crates/graphql_soup/src/loaders/test.rs
+++ b/crates/graphql_soup/src/loaders/test.rs
@@ -18,6 +18,7 @@ use item_filters::{
project::ProjectLiteral,
},
};
+use model_owner::Owner;
use models_pagination::{Paginated, PaginatedCursor};
use models_properties::service::property_definition_with_options::PropertyDefinitionWithOptions;
use models_soup::{document::SoupDocument, item::SoupItem};
@@ -183,7 +184,7 @@ fn document_named(id: Uuid, name: impl Into<String>) -> SoupItem<()> {
SoupItem::Document(SoupDocument {
id,
document_version_id: 1,
- owner_id: user("macro|[email protected]"),
+ owner_id: Owner::from_principal_str("macro|[email protected]").expect("valid owner"),
name: name.into(),
file_type: None,
sha: None,
diff --git a/crates/graphql_soup/src/objects.rs b/crates/graphql_soup/src/objects.rs
index e8dddbbcfc..7059e53c14 100644
--- a/crates/graphql_soup/src/objects.rs
+++ b/crates/graphql_soup/src/objects.rs
@@ -3,7 +3,7 @@ use async_graphql::{
OutputType, Scalar, ScalarType, SimpleObject, Union, Value as GraphqlValue,
};
use graphql_common::{
- GraphqlCacheDeletion, GraphqlEntity, GraphqlEntityType, GraphqlSoupEntityType,
+ GraphqlCacheDeletion, GraphqlEntity, GraphqlEntityType, GraphqlOwnerType, GraphqlSoupEntityType,
};
use graphql_email::GraphqlEmailLabel;
use graphql_permission::GraphqlEntityPermission;
@@ -309,8 +309,11 @@ fn graphql_entity(
/// Metadata shared by every canonical Soup entity.
#[derive(SimpleObject)]
pub struct GraphqlEntityMetadata {
- /// Owning user, when applicable.
+ /// Owning principal, when applicable.
owner_id: Option<String>,
+ /// The kind of principal `ownerId` names. Null exactly when `ownerId`
+ /// is, for the entities that have no owner of their own.
+ owner_type: Option<GraphqlOwnerType>,
/// Parent project, channel, or team, when applicable.
parent: Option<GraphqlEntity<'static>>,
/// Creation timestamp in RFC 3339 form.
@@ -584,6 +587,7 @@ where
async fn metadata(&self) -> GraphqlEntityMetadata {
GraphqlEntityMetadata {
owner_id: Some(self.0.owner_id.clone()),
+ owner_type: Some(GraphqlOwnerType::User),
parent: None,
created_at: Some(self.0.created_at.to_rfc3339()),
updated_at: Some(self.0.updated_at.to_rfc3339()),
@@ -696,7 +700,8 @@ where
/// Common document metadata.
async fn metadata(&self) -> GraphqlEntityMetadata {
GraphqlEntityMetadata {
- owner_id: Some(self.0.owner_id.as_ref().to_owned()),
+ owner_id: Some(self.0.owner_id.principal_id()),
+ owner_type: Some(self.0.owner_id.owner_type().into()),
parent: self
.0
.project_id
@@ -713,9 +718,14 @@ where
&self.0.name
}
- /// The identifier of the owner.
+ /// The principal identifier of the owner.
async fn owner_id(&self) -> String {
- self.0.owner_id.as_ref().to_owned()
+ self.0.owner_id.principal_id()
+ }
+
+ /// The kind of principal `ownerId` names.
+ async fn owner_type(&self) -> GraphqlOwnerType {
+ self.0.owner_id.owner_type().into()
}
/// The file type.
@@ -859,7 +869,8 @@ where
/// Common chat metadata.
async fn metadata(&self) -> GraphqlEntityMetadata {
GraphqlEntityMetadata {
- owner_id: Some(self.0.owner_id.as_ref().to_owned()),
+ owner_id: Some(self.0.owner_id.principal_id()),
+ owner_type: Some(self.0.owner_id.owner_type().into()),
parent: self
.0
.project_id
@@ -881,9 +892,14 @@ where
self.0.model.as_deref()
}
- /// The identifier of the owner.
+ /// The principal identifier of the owner.
async fn owner_id(&self) -> String {
- self.0.owner_id.as_ref().to_owned()
+ self.0.owner_id.principal_id()
+ }
+
+ /// The kind of principal `ownerId` names.
+ async fn owner_type(&self) -> GraphqlOwnerType {
+ self.0.owner_id.owner_type().into()
}
/// The identifier of the project.
@@ -964,7 +980,8 @@ where
/// contained by its project.
async fn metadata(&self) -> GraphqlEntityMetadata {
GraphqlEntityMetadata {
- owner_id: Some(self.0.owner_id.as_ref().to_owned()),
+ owner_id: Some(self.0.owner_id.principal_id()),
+ owner_type: Some(self.0.owner_id.owner_type().into()),
parent: None,
created_at: Some(self.0.created_at.to_rfc3339()),
updated_at: Some(self.0.updated_at.to_rfc3339()),
@@ -978,9 +995,14 @@ where
&self.0.name
}
- /// The identifier of the owner.
+ /// The principal identifier of the owner.
async fn owner_id(&self) -> String {
- self.0.owner_id.as_ref().to_owned()
+ self.0.owner_id.principal_id()
+ }
+
+ /// The kind of principal `ownerId` names.
+ async fn owner_type(&self) -> GraphqlOwnerType {
+ self.0.owner_id.owner_type().into()
}
/// The bot running this session.
@@ -1064,7 +1086,8 @@ where
/// Common project metadata.
async fn metadata(&self) -> GraphqlEntityMetadata {
GraphqlEntityMetadata {
- owner_id: Some(self.0.owner_id.as_ref().to_owned()),
+ owner_id: Some(self.0.owner_id.principal_id()),
+ owner_type: Some(self.0.owner_id.owner_type().into()),
parent: self
.0
.parent_id
@@ -1081,9 +1104,14 @@ where
&self.0.name
}
- /// The identifier of the owner.
+ /// The principal identifier of the owner.
async fn owner_id(&self) -> String {
- self.0.owner_id.as_ref().to_owned()
+ self.0.owner_id.principal_id()
+ }
+
+ /// The kind of principal `ownerId` names.
+ async fn owner_type(&self) -> GraphqlOwnerType {
+ self.0.owner_id.owner_type().into()
}
/// The identifier of the parent.
@@ -1232,6 +1260,7 @@ where
async fn metadata(&self) -> GraphqlEntityMetadata {
GraphqlEntityMetadata {
owner_id: Some(self.0.thread.owner_id.as_ref().to_owned()),
+ owner_type: Some(GraphqlOwnerType::User),
parent: self
.0
.thread
@@ -1569,6 +1598,7 @@ where
async fn metadata(&self) -> GraphqlEntityMetadata {
GraphqlEntityMetadata {
owner_id: Some(self.0.channel.channel.owner_id.as_ref().to_owned()),
+ owner_type: Some(GraphqlOwnerType::User),
parent: self
.0
.channel
@@ -1734,6 +1764,7 @@ where
async fn metadata(&self) -> GraphqlEntityMetadata {
GraphqlEntityMetadata {
owner_id: Some(self.0.sender_id.clone()),
+ owner_type: Some(GraphqlOwnerType::User),
parent: Some(graphql_entity(
model_entity::EntityType::Channel,
self.0.channel_id,
@@ -1845,6 +1876,7 @@ where
async fn metadata(&self) -> GraphqlEntityMetadata {
GraphqlEntityMetadata {
owner_id: Some(self.0.created_by.clone()),
+ owner_type: Some(GraphqlOwnerType::User),
parent: Some(graphql_entity(
model_entity::EntityType::Channel,
self.0.channel_id,
@@ -1991,6 +2023,7 @@ where
async fn metadata(&self) -> GraphqlEntityMetadata {
GraphqlEntityMetadata {
owner_id: None,
+ owner_type: None,
parent: Some(graphql_entity(
model_entity::EntityType::Team,
self.0.team_id,
@@ -2096,6 +2129,7 @@ where
async fn metadata(&self) -> GraphqlEntityMetadata {
GraphqlEntityMetadata {
owner_id: None,
+ owner_type: None,
parent: None,
created_at: Some(self.0.created_at.to_rfc3339()),
updated_at: Some(self.0.updated_at.to_rfc3339()),
@@ -2214,6 +2248,7 @@ where
async fn metadata(&self) -> GraphqlEntityMetadata {
GraphqlEntityMetadata {
owner_id: None,
+ owner_type: None,
parent: None,
created_at: Some(self.0.created_at.to_rfc3339()),
updated_at: Some(self.0.updated_at.to_rfc3339()),
diff --git a/crates/graphql_soup_filter_input/Cargo.toml b/crates/graphql_soup_filter_input/Cargo.toml
index 26c6478289..3b4d4efd42 100644
--- a/crates/graphql_soup_filter_input/Cargo.toml
+++ b/crates/graphql_soup_filter_input/Cargo.toml
@@ -17,6 +17,7 @@ graphql_common = { path = "../graphql_common", optional = true }
item_filters = { path = "../item_filters", default-features = false }
macro_user_id = { path = "../macro_user_id" }
model_file_type = { path = "../model_file_type" }
+model_owner = { path = "../model_owner" }
notification_state = { path = "../notification_state" }
serde = { workspace = true }
serde_json = { workspace = true }
diff --git a/crates/graphql_soup_filter_input/src/lib.rs b/crates/graphql_soup_filter_input/src/lib.rs
index 583bc46228..26d226d4a6 100644
--- a/crates/graphql_soup_filter_input/src/lib.rs
+++ b/crates/graphql_soup_filter_input/src/lib.rs
@@ -37,6 +37,7 @@ use item_filters::{
};
use macro_user_id::{cowlike::CowLike, email::EmailStr, user_id::MacroUserIdStr};
use model_file_type::FileType;
+use model_owner::Owner;
use notification_state::graphql::GraphqlNotificationState;
use serde::{Deserialize, Serialize};
use serde_json::Value;
@@ -167,6 +168,12 @@ fn parse_macro_user_id(value: String, field: &str) -> InputResult<MacroUserIdStr
.map_err(|err| InputError::new(format!("invalid {field} `{value}`: {err}")))
}
+/// Parse an owner principal — a user, bot, or team — with a field-specific error.
+fn parse_owner(value: String, field: &str) -> InputResult<Owner> {
+ Owner::from_principal_str(&value)
+ .map_err(|err| InputError::new(format!("invalid {field} `{value}`: {err}")))
+}
+
/// Define the recursive GraphQL and serde expression shape for one literal family.
macro_rules! filter_expr_input {
($name:ident, $binary_name:ident, $literal:ty, $target:ty, $type_name:literal) => {
@@ -609,7 +616,8 @@ enum GraphqlDocumentLiteral {
Id(ID),
/// The project id option.
ProjectId(ID),
- /// The owner option.
+ /// The owner principal option — a user (`macro|<email>`), a bot
+ /// (`bot|<uuid>`), or a team (a bare hyphenated uuid).
Owner(String),
/// The importance option.
Importance(bool),
@@ -647,7 +655,7 @@ impl IntoFilterExpr<DocumentLiteral> for GraphqlDocumentLiteral {
),
Self::Id(id) => DocumentLiteral::Id(parse_id(id, "id")?),
Self::ProjectId(id) => DocumentLiteral::ProjectId(parse_id(id, "projectId")?),
- Self::Owner(owner) => DocumentLiteral::Owner(parse_macro_user_id(owner, "owner")?),
+ Self::Owner(owner) => DocumentLiteral::Owner(parse_owner(owner, "owner")?),
Self::Importance(importance) => DocumentLiteral::Importance(importance),
Self::NotificationState(state) => DocumentLiteral::NotificationState(state.into()),
Self::IncludeCbmAtmNc(include) => DocumentLiteral::IncludeCbmAtmNc(include),
@@ -696,7 +704,8 @@ enum GraphqlProjectLiteral {
ProjectId(ID),
/// The project id self option.
ProjectIdSelf(ID),
- /// The owner option.
+ /// The owner principal option — a user (`macro|<email>`), a bot
+ /// (`bot|<uuid>`), or a team (a bare hyphenated uuid).
Owner(String),
/// The importance option.
Importance(bool),
@@ -716,7 +725,7 @@ impl IntoFilterExpr<ProjectLiteral> for GraphqlProjectLiteral {
Self::ProjectIdSelf(id) => {
ProjectLiteral::ProjectIdSelf(parse_id(id, "projectIdSelf")?)
}
- Self::Owner(owner) => ProjectLiteral::Owner(parse_macro_user_id(owner, "owner")?),
+ Self::Owner(owner) => ProjectLiteral::Owner(parse_owner(owner, "owner")?),
Self::Importance(importance) => ProjectLiteral::Importance(importance),
Self::NotificationState(state) => ProjectLiteral::NotificationState(state.into()),
Self::CreatedAt(date) => ProjectLiteral::CreatedAt(date.into_ast()?),
@@ -737,7 +746,8 @@ enum GraphqlChatLiteral {
Role(GraphqlChatRole),
/// The chat id option.
ChatId(ID),
- /// The owner option.
+ /// The owner principal option — a user (`macro|<email>`), a bot
+ /// (`bot|<uuid>`), or a team (a bare hyphenated uuid).
Owner(String),
/// The importance option.
Importance(bool),
@@ -756,7 +766,7 @@ impl IntoFilterExpr<ChatLiteral> for GraphqlChatLiteral {
Self::ProjectId(id) => ChatLiteral::ProjectId(parse_id(id, "projectId")?),
Self::Role(role) => ChatLiteral::Role(role.into_model()),
Self::ChatId(id) => ChatLiteral::ChatId(parse_id(id, "chatId")?),
- Self::Owner(owner) => ChatLiteral::Owner(parse_macro_user_id(owner, "owner")?),
+ Self::Owner(owner) => ChatLiteral::Owner(parse_owner(owner, "owner")?),
Self::Importance(importance) => ChatLiteral::Importance(importance),
Self::NotificationState(state) => ChatLiteral::NotificationState(state.into()),
Self::CreatedAt(date) => ChatLiteral::CreatedAt(date.into_ast()?),
@@ -1132,7 +1142,8 @@ enum GraphqlAgentSessionLiteral {
Include(bool),
/// The id option.
Id(ID),
- /// The owner option.
+ /// The owner principal option — a user (`macro|<email>`), a bot
+ /// (`bot|<uuid>`), or a team (a bare hyphenated uuid).
Owner(String),
}
@@ -1149,7 +1160,7 @@ impl IntoFilterExpr<AgentSessionLiteral> for GraphqlAgentSessionLiteral {
}
Self::Include(true) => AgentSessionLiteral::Include,
Self::Id(id) => AgentSessionLiteral::Id(parse_id(id, "id")?),
- Self::Owner(owner) => AgentSessionLiteral::Owner(parse_macro_user_id(owner, "owner")?),
+ Self::Owner(owner) => AgentSessionLiteral::Owner(parse_owner(owner, "owner")?),
};
Ok(Expr::val(literal))
}
diff --git a/crates/item_filter_index/src/lib.rs b/crates/item_filter_index/src/lib.rs
index 657d346d77..639c096473 100644
--- a/crates/item_filter_index/src/lib.rs
+++ b/crates/item_filter_index/src/lib.rs
@@ -728,7 +728,7 @@ fn compile_document_literal(
}
DocumentLiteral::ProjectId(id) => exact_uuid(vocabulary::project_id(), id),
DocumentLiteral::Owner(owner) => {
- return exact_utf8(vocabulary::owner(), owner.to_string());
+ return exact_utf8(vocabulary::owner(), owner.principal_id());
}
DocumentLiteral::SubType(sub_type) if supports_v2_facts => {
return exact_utf8(vocabulary::document_sub_type(), sub_type.to_string());
@@ -763,7 +763,7 @@ fn compile_project_literal(literal: &ProjectLiteral) -> Result<PredicateExpr, Co
ProjectLiteral::ProjectId(id) => exact_uuid(vocabulary::project_id(), id),
ProjectLiteral::ProjectIdSelf(id) => exact_uuid(vocabulary::id(), id),
ProjectLiteral::Owner(owner) => {
- return exact_utf8(vocabulary::owner(), owner.to_string());
+ return exact_utf8(vocabulary::owner(), owner.principal_id());
}
ProjectLiteral::CreatedAt(date) => date_expr(vocabulary::created_at(), date),
ProjectLiteral::UpdatedAt(date) => date_expr(vocabulary::updated_at(), date),
@@ -776,7 +776,7 @@ fn compile_chat_literal(literal: &ChatLiteral) -> Result<PredicateExpr, CompileE
ChatLiteral::ChatId(id) => exact_uuid(vocabulary::id(), id),
ChatLiteral::ProjectId(id) => exact_uuid(vocabulary::project_id(), id),
ChatLiteral::Owner(owner) => {
- return exact_utf8(vocabulary::owner(), owner.to_string());
+ return exact_utf8(vocabulary::owner(), owner.principal_id());
}
ChatLiteral::CreatedAt(date) => date_expr(vocabulary::created_at(), date),
ChatLiteral::UpdatedAt(date) => date_expr(vocabulary::updated_at(), date),
diff --git a/crates/item_filters/Cargo.toml b/crates/item_filters/Cargo.toml
index f44f45c518..103954388c 100644
--- a/crates/item_filters/Cargo.toml
+++ b/crates/item_filters/Cargo.toml
@@ -17,6 +17,7 @@ either = { workspace = true }
filter_ast = { path = "../filter_ast" }
macro_user_id = { path = "../macro_user_id" }
model_file_type = { path = "../model_file_type" }
+model_owner = { path = "../model_owner" }
nom = { workspace = true }
non_empty = { path = "../non_empty" }
notification_state = { path = "../notification_state" }
diff --git a/crates/item_filters/src/ast.rs b/crates/item_filters/src/ast.rs
index 8d94fd9d6c..e5346795f3 100644
--- a/crates/item_filters/src/ast.rs
+++ b/crates/item_filters/src/ast.rs
@@ -83,6 +83,9 @@ pub enum ExpandErr {
/// invalid macro user id
#[error(transparent)]
MacroIdErr(#[from] macro_user_id::error::ParseErr),
+ /// invalid owner principal
+ #[error(transparent)]
+ OwnerErr(#[from] model_owner::OwnerParseError),
/// unknown document sub type
#[error(transparent)]
DocumentSubTypeErr(#[from] strum::ParseError),
diff --git a/crates/item_filters/src/ast/agent_session.rs b/crates/item_filters/src/ast/agent_session.rs
index ffb5ad5583..6f4b3c0ade 100644
--- a/crates/item_filters/src/ast/agent_session.rs
+++ b/crates/item_filters/src/ast/agent_session.rs
@@ -1,5 +1,5 @@
use filter_ast::{ExpandFrame, Expr, FoldTree, TryExpandNode};
-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
+use model_owner::Owner;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
@@ -21,7 +21,7 @@ pub enum AgentSessionLiteral {
Id(Uuid),
/// Filter by the session's owner.
#[serde(rename = "o")]
- Owner(MacroUserIdStr<'static>),
+ Owner(Owner),
}
impl ExpandFrame<AgentSessionLiteral> for AgentSessionFilters {
@@ -45,7 +45,7 @@ impl ExpandFrame<AgentSessionLiteral> for AgentSessionFilters {
let owners = owners
.iter()
- .map(|owner| MacroUserIdStr::parse_from_str(owner).map(CowLike::into_owned))
+ .map(|owner| Owner::from_principal_str(owner))
.try_expand(|r| r.map(AgentSessionLiteral::Owner), Expr::or)?;
Ok([include, ids, owners].into_iter().fold_with(Expr::and))
diff --git a/crates/item_filters/src/ast/chat.rs b/crates/item_filters/src/ast/chat.rs
index 188775dbbc..bec8f4591d 100644
--- a/crates/item_filters/src/ast/chat.rs
+++ b/crates/item_filters/src/ast/chat.rs
@@ -1,5 +1,5 @@
use filter_ast::{ExpandFrame, Expr, FoldTree, TryExpandNode};
-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
+use model_owner::Owner;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
@@ -20,9 +20,9 @@ pub enum ChatLiteral {
/// the chat has the id [Uuid]
#[serde(rename = "cid")]
ChatId(Uuid),
- /// the chat is owned by [MacroUserIdStr]
+ /// the chat is owned by [Owner]
#[serde(rename = "o")]
- Owner(MacroUserIdStr<'static>),
+ Owner(Owner),
/// this node value filters by chat importance. false short-circuits to match nothing.
#[serde(rename = "imp")]
Importance(bool),
@@ -92,7 +92,7 @@ impl ExpandFrame<ChatLiteral> for ChatFilters {
let owners = owners
.iter()
- .map(|s| MacroUserIdStr::parse_from_str(s).map(CowLike::into_owned))
+ .map(|s| Owner::from_principal_str(s))
.try_expand(|r| r.map(ChatLiteral::Owner), Expr::or)?;
let importance_node = importance.map(|imp| Expr::Literal(ChatLiteral::Importance(imp)));
diff --git a/crates/item_filters/src/ast/document.rs b/crates/item_filters/src/ast/document.rs
index 1c7d64b6a0..c5fa954c53 100644
--- a/crates/item_filters/src/ast/document.rs
+++ b/crates/item_filters/src/ast/document.rs
@@ -5,11 +5,11 @@ use crate::{
use document_sub_type::DocumentSubType;
use either::Either;
use filter_ast::{ExpandFrame, Expr, FoldTree, TryExpandNode};
-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
use model_file_type::{
Archive, Audio, Canvas, Code, Data, Database, Document, Executable, FileAssociation, FileType,
Font, Image, Md, Media, Pdf, ThreeD, ValueError, Vector, Video, Vm, Write,
};
+use model_owner::Owner;
use nom::{
Finish, IResult, Parser, branch::alt, bytes::complete::tag, combinator::eof,
sequence::separated_pair,
@@ -34,7 +34,7 @@ pub enum DocumentLiteral {
ProjectId(Uuid),
/// this node value filters by document owner
#[serde(rename = "o")]
- Owner(MacroUserIdStr<'static>),
+ Owner(Owner),
/// this node value filters by document importance. false short-circuits to match nothing.
#[serde(rename = "imp")]
Importance(bool),
@@ -205,7 +205,7 @@ impl ExpandFrame<DocumentLiteral> for DocumentFilters {
let owners = owners
.iter()
- .map(|s| MacroUserIdStr::parse_from_str(s).map(CowLike::into_owned))
+ .map(|s| Owner::from_principal_str(s))
.try_expand(|r| r.map(DocumentLiteral::Owner), Expr::or)?;
let importance_node = importance.map(|imp| Expr::Literal(DocumentLiteral::Importance(imp)));
diff --git a/crates/item_filters/src/ast/project.rs b/crates/item_filters/src/ast/project.rs
index 6a872cf673..047a925eea 100644
--- a/crates/item_filters/src/ast/project.rs
+++ b/crates/item_filters/src/ast/project.rs
@@ -1,5 +1,5 @@
use filter_ast::{ExpandFrame, Expr, FoldTree, TryExpandNode};
-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
+use model_owner::Owner;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
@@ -19,7 +19,7 @@ pub enum ProjectLiteral {
ProjectIdSelf(Uuid),
/// the owner of the project
#[serde(rename = "o")]
- Owner(MacroUserIdStr<'static>),
+ Owner(Owner),
/// this node value filters by project importance. false short-circuits to match nothing.
#[serde(rename = "imp")]
Importance(bool),
@@ -63,7 +63,7 @@ impl ExpandFrame<ProjectLiteral> for ProjectFilters {
let owners = owners
.iter()
- .map(|s| MacroUserIdStr::parse_from_str(s).map(CowLike::into_owned))
+ .map(|s| Owner::from_principal_str(s))
.try_expand(|r| r.map(ProjectLiteral::Owner), Expr::or)?;
let importance_node = importance.map(|imp| Expr::Literal(ProjectLiteral::Importance(imp)));
diff --git a/crates/item_filters/src/lib.rs b/crates/item_filters/src/lib.rs
index 6e945d32e0..1056e7b78c 100644
--- a/crates/item_filters/src/lib.rs
+++ b/crates/item_filters/src/lib.rs
@@ -91,7 +91,10 @@ pub struct DocumentFilters {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub project_ids: Vec<String>,
- /// Filter by document owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.
+ /// Filter by document owner principal — a user ('macro|[email protected]'), a bot
+ /// ('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+ /// ['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+ /// search all owners.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub owners: Vec<String>,
@@ -157,7 +160,10 @@ pub struct ChatFilters {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub project_ids: Vec<String>,
- /// Filter by chat owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.
+ /// Filter by chat owner principal — a user ('macro|[email protected]'), a bot
+ /// ('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+ /// ['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+ /// search all owners.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub owners: Vec<String>,
@@ -477,8 +483,9 @@ pub struct AgentSessionFilters {
/// Agent session ids to filter by. Empty to include all accessible sessions.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub ids: Vec<String>,
- /// Filter by session owner. Examples: ['macro|[email protected]']. Empty to
- /// include every owner.
+ /// Filter by session owner principal — a user ('macro|[email protected]'), a bot
+ /// ('bot|<uuid>'), or a team (a bare hyphenated uuid). Empty to include every
+ /// owner.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub owners: Vec<String>,
}
@@ -714,7 +721,10 @@ pub struct ProjectFilters {
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub include_root: bool,
- /// Filter by project owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.
+ /// Filter by project owner principal — a user ('macro|[email protected]'), a bot
+ /// ('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+ /// ['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+ /// search all owners.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub owners: Vec<String>,
diff --git a/crates/model_owner/Cargo.toml b/crates/model_owner/Cargo.toml
index d462bebcfb..efd7b0ad12 100644
--- a/crates/model_owner/Cargo.toml
+++ b/crates/model_owner/Cargo.toml
@@ -14,7 +14,6 @@ serde = { workspace = true }
sqlx = { workspace = true, optional = true }
thiserror = { workspace = true }
uuid = { workspace = true }
-workspace-hack = { version = "0.1", path = "../workspace-hack" }
[dev-dependencies]
serde_json = { workspace = true }
diff --git a/crates/models_soup/Cargo.toml b/crates/models_soup/Cargo.toml
index c5457a1bce..e15f0631ae 100644
--- a/crates/models_soup/Cargo.toml
+++ b/crates/models_soup/Cargo.toml
@@ -21,6 +21,7 @@ item_filters = { path = "../item_filters" }
macro_user_id = { path = "../macro_user_id" }
model = { path = "../model" }
model-entity = { path = "../model-entity" }
+model_owner = { path = "../model_owner" }
models_pagination = { path = "../models_pagination" }
models_properties = { path = "../models_properties" }
reminders = { path = "../reminders", default-features = false }
diff --git a/crates/models_soup/src/agent_session.rs b/crates/models_soup/src/agent_session.rs
index 48658dba54..c7caddaec2 100644
--- a/crates/models_soup/src/agent_session.rs
+++ b/crates/models_soup/src/agent_session.rs
@@ -1,5 +1,5 @@
use chrono::Utc;
-use macro_user_id::user_id::MacroUserIdStr;
+use model_owner::Owner;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
@@ -20,7 +20,7 @@ pub struct SoupAgentSession<T = ()> {
/// Who the session belongs to
#[cfg_attr(feature = "schema", schema(value_type = String))]
- pub owner_id: MacroUserIdStr<'static>,
+ pub owner_id: Owner,
/// The bot running this session
pub bot_id: Uuid,
diff --git a/crates/models_soup/src/chat.rs b/crates/models_soup/src/chat.rs
index 7cf2552596..74f26017a3 100644
--- a/crates/models_soup/src/chat.rs
+++ b/crates/models_soup/src/chat.rs
@@ -1,5 +1,5 @@
use chrono::Utc;
-use macro_user_id::user_id::MacroUserIdStr;
+use model_owner::Owner;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
@@ -19,7 +19,7 @@ pub struct SoupChat<T = ()> {
/// Who the chat belongs to
#[cfg_attr(feature = "schema", schema(value_type = String))]
- pub owner_id: MacroUserIdStr<'static>,
+ pub owner_id: Owner,
/// The project id of the chat
#[serde(skip_serializing_if = "Option::is_none")]
diff --git a/crates/models_soup/src/document.rs b/crates/models_soup/src/document.rs
index 9259b0c9fc..c7fa957f76 100644
--- a/crates/models_soup/src/document.rs
+++ b/crates/models_soup/src/document.rs
@@ -1,6 +1,6 @@
use chrono::Utc;
use document_sub_type::DocumentSubType;
-use macro_user_id::user_id::MacroUserIdStr;
+use model_owner::Owner;
use models_properties::EntityType;
use uuid::Uuid;
@@ -62,7 +62,7 @@ pub struct SoupDocument<T = ()> {
/// The owner of the document
#[cfg_attr(feature = "schema", schema(value_type = String))]
- pub owner_id: MacroUserIdStr<'static>,
+ pub owner_id: Owner,
/// The name of the document
pub name: String,
diff --git a/crates/models_soup/src/item/test.rs b/crates/models_soup/src/item/test.rs
index 36f9e32725..ee5ac3386e 100644
--- a/crates/models_soup/src/item/test.rs
+++ b/crates/models_soup/src/item/test.rs
@@ -1,6 +1,6 @@
use super::*;
use crate::chat::SoupChat;
-use macro_user_id::user_id::MacroUserIdStr;
+use model_owner::Owner;
#[derive(Debug, Serialize, Deserialize)]
struct TestPropertiesField {
@@ -12,7 +12,7 @@ fn raw_chat() -> SoupItem<()> {
id: Uuid::nil(),
name: "Test chat".to_string(),
model: Some("openai/gpt-5.6".to_string()),
- owner_id: MacroUserIdStr::try_from("macro|[email protected]".to_string()).unwrap(),
+ owner_id: Owner::try_from("macro|[email protected]".to_string()).unwrap(),
project_id: None,
is_persistent: true,
created_at: DateTime::<Utc>::default(),
diff --git a/crates/models_soup/src/project.rs b/crates/models_soup/src/project.rs
index 55b2b64d02..cdc279a3b8 100644
--- a/crates/models_soup/src/project.rs
+++ b/crates/models_soup/src/project.rs
@@ -1,5 +1,5 @@
use chrono::Utc;
-use macro_user_id::user_id::MacroUserIdStr;
+use model_owner::Owner;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
@@ -14,9 +14,9 @@ pub struct SoupProject<T = ()> {
/// The name of the project
pub name: String,
- /// The user id of who created the project
+ /// The owner of the project
#[cfg_attr(feature = "schema", schema(value_type = String))]
- pub owner_id: MacroUserIdStr<'static>,
+ pub owner_id: Owner,
/// The parent project id
#[serde(skip_serializing_if = "Option::is_none")]
diff --git a/crates/soup/Cargo.toml b/crates/soup/Cargo.toml
index 2fcc08a5b5..87d470ea52 100644
--- a/crates/soup/Cargo.toml
+++ b/crates/soup/Cargo.toml
@@ -73,6 +73,7 @@ macro_authorization = { path = "../macro_authorization", default-features = fals
macro_user_id = { path = "../macro_user_id" }
model-entity = { path = "../model-entity" }
model-error-response = { path = "../model-error-response", optional = true }
+model_owner = { path = "../model_owner" }
models_grouping = { path = "../models_grouping" }
models_pagination = { path = "../models_pagination" }
models_properties = { path = "../models_properties" }
diff --git a/crates/soup/src/domain/models/grouping/test.rs b/crates/soup/src/domain/models/grouping/test.rs
index 695f33ece2..0598ed7a2f 100644
--- a/crates/soup/src/domain/models/grouping/test.rs
+++ b/crates/soup/src/domain/models/grouping/test.rs
@@ -1,6 +1,6 @@
use chrono::DateTime;
use item_filters::ast::EntityFilterAst;
-use macro_user_id::user_id::MacroUserIdStr;
+use model_owner::Owner;
use models_grouping::GroupByField;
use models_pagination::SimpleSortMethod;
use models_soup::{item::SoupItem, project::SoupProject};
@@ -12,7 +12,7 @@ fn project(id: u128) -> SoupItem {
SoupItem::Project(SoupProject {
id: Uuid::from_u128(id),
name: format!("Project {id}"),
- owner_id: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),
+ owner_id: Owner::from_principal_str("macro|[email protected]").unwrap(),
parent_id: None,
created_at: DateTime::default(),
updated_at: DateTime::default(),
diff --git a/crates/soup/src/domain/service/tests.rs b/crates/soup/src/domain/service/tests.rs
index b730133871..33c57352ca 100644
--- a/crates/soup/src/domain/service/tests.rs
+++ b/crates/soup/src/domain/service/tests.rs
@@ -29,6 +29,7 @@ use item_filters::{
ast::{EntityFilterAst, foreign_entity::ForeignEntityLiteral},
};
use model_entity::EntityType;
+use model_owner::Owner;
use models_grouping::{GroupByField, GroupingConfig};
use models_pagination::{
Cursor, CursorVal, CursorWithValAndFilter, FrecencyValue, PaginatedCursor, SimpleSortMethod,
@@ -526,7 +527,7 @@ fn soup_document_with_is_completed(
SoupDocument {
id,
document_version_id: 1,
- owner_id: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),
+ owner_id: Owner::from_principal_str("macro|[email protected]").unwrap(),
name: Default::default(),
file_type: None,
sha: None,
@@ -2527,7 +2528,7 @@ async fn touched_soup_orders_by_touch_and_drops_unhydrated() {
Ok(vec![SoupItem::Project(models_soup::project::SoupProject {
id: project,
name: 'p'.to_string(),
- owner_id: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),
+ owner_id: Owner::from_principal_str("macro|[email protected]").unwrap(),
parent_id: None,
created_at: Default::default(),
updated_at: Default::default(),
@@ -2754,7 +2755,7 @@ async fn unexpanded_touched_hydrates_projects_in_the_main_query() {
SoupItem::Project(models_soup::project::SoupProject {
id: project,
name: 'p'.to_string(),
- owner_id: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),
+ owner_id: Owner::from_principal_str("macro|[email protected]").unwrap(),
parent_id: None,
created_at: Default::default(),
updated_at: Default::default(),
@@ -3174,7 +3175,7 @@ async fn notified_soup_refills_after_hydration_drops_and_ends_when_exhausted() {
Ok(vec![SoupItem::Project(models_soup::project::SoupProject {
id: project,
name: 'p'.to_string(),
- owner_id: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),
+ owner_id: Owner::from_principal_str("macro|[email protected]").unwrap(),
parent_id: None,
created_at: Default::default(),
updated_at: Default::default(),
diff --git a/crates/soup/src/inbound/toolset/test.rs b/crates/soup/src/inbound/toolset/test.rs
index dd263d894a..6e94e86f8e 100644
--- a/crates/soup/src/inbound/toolset/test.rs
+++ b/crates/soup/src/inbound/toolset/test.rs
@@ -401,7 +401,7 @@ fn test_tag_filter_expr_ands_with_existing_propf() {
#[test]
fn test_from_soup_item_resolves_tags_via_caller_map() {
use crate::domain::models::SoupPropertiesField;
- use macro_user_id::user_id::MacroUserIdStr;
+ use model_owner::Owner;
use models_properties::service::property_definition::PropertyDefinition;
use models_properties::service::property_value::PropertyValue;
use models_properties::service::tag_sets::{AppliedTag, TagScope};
@@ -440,7 +440,7 @@ fn test_from_soup_item_resolves_tags_via_caller_map() {
let doc = SoupDocument {
id: Uuid::new_v4(),
document_version_id: 1,
- owner_id: MacroUserIdStr::try_from("macro|[email protected]".to_string()).unwrap(),
+ owner_id: Owner::try_from("macro|[email protected]".to_string()).unwrap(),
name: "tagged.md".to_string(),
file_type: None,
sha: None,
diff --git a/crates/soup/src/outbound/pg_soup_repo.rs b/crates/soup/src/outbound/pg_soup_repo.rs
index 3c0424dd1e..224926d538 100644
--- a/crates/soup/src/outbound/pg_soup_repo.rs
+++ b/crates/soup/src/outbound/pg_soup_repo.rs
@@ -420,9 +420,8 @@ macro_rules! map_soup_type {
.document_version_id
.ok_or_else(|| type_err("document version id must exist"))
.and_then(|s| FromStr::from_str(&s).map_err(type_err))?,
- owner_id: MacroUserIdStr::parse_from_str(&r.user_id)
- .map_err(type_err)?
- .into_owned(),
+ owner_id: ::model_owner::Owner::from_principal_str(&r.user_id)
+ .map_err(type_err)?,
name: r.name,
file_type: r.file_type,
sha: r.sha,
@@ -456,9 +455,8 @@ macro_rules! map_soup_type {
id: Uuid::parse_str(&r.id).map_err(type_err)?,
name: r.name,
model: r.model,
- owner_id: MacroUserIdStr::parse_from_str(&r.user_id)
- .map_err(type_err)?
- .into_owned(),
+ owner_id: ::model_owner::Owner::from_principal_str(&r.user_id)
+ .map_err(type_err)?,
project_id: r
.project_id
.as_deref()
@@ -477,9 +475,8 @@ macro_rules! map_soup_type {
::models_soup::project::SoupProject {
id: Uuid::parse_str(&r.id).map_err(type_err)?,
name: r.name,
- owner_id: MacroUserIdStr::parse_from_str(&r.user_id)
- .map_err(type_err)?
- .into_owned(),
+ owner_id: ::model_owner::Owner::from_principal_str(&r.user_id)
+ .map_err(type_err)?,
parent_id: r
.project_id
.as_deref()
diff --git a/crates/soup/src/outbound/pg_soup_repo/agent_session.rs b/crates/soup/src/outbound/pg_soup_repo/agent_session.rs
index 1a6f6b7320..f373a94436 100644
--- a/crates/soup/src/outbound/pg_soup_repo/agent_session.rs
+++ b/crates/soup/src/outbound/pg_soup_repo/agent_session.rs
@@ -11,8 +11,8 @@ use item_filters::ast::{
agent_session::AgentSessionLiteral,
properties::{PropertiesLiteral, properties_filter_matches_propertyless},
};
-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
use model_entity::EntityType;
+use model_owner::Owner;
use models_pagination::{Query, SimpleSortMethod};
use models_soup::{agent_session::SoupAgentSession, item::SoupItem};
use sqlx::{FromRow, PgPool, Postgres, QueryBuilder};
@@ -272,15 +272,13 @@ fn push_filter(builder: &mut QueryBuilder<'_, Postgres>, expression: &Expr<Agent
}
Expr::Literal(AgentSessionLiteral::Owner(owner)) => {
builder.push("s.owner_id = ");
- builder.push_bind(owner.as_ref().to_string());
+ builder.push_bind(owner.principal_id());
}
}
}
fn row_to_item(row: AgentSessionRow) -> Result<SoupItem<()>, sqlx::Error> {
- let owner_id = MacroUserIdStr::parse_from_str(&row.owner_id)
- .map_err(super::type_err)?
- .into_owned();
+ let owner_id = Owner::from_principal_str(&row.owner_id).map_err(super::type_err)?;
// Mirror `agent_session::domain::model::SessionStatus`'s wire shape: the
// event name is the status once one has arrived.
let status = match row.status.as_str() {
diff --git a/crates/soup/src/outbound/pg_soup_repo/agent_session/test.rs b/crates/soup/src/outbound/pg_soup_repo/agent_session/test.rs
index eb5d6e118d..870eae37f1 100644
--- a/crates/soup/src/outbound/pg_soup_repo/agent_session/test.rs
+++ b/crates/soup/src/outbound/pg_soup_repo/agent_session/test.rs
@@ -173,7 +173,7 @@ async fn include_lists_accessible_sessions_newest_first(pool: PgPool) -> anyhow:
};
assert_eq!(private.name, "Private session");
assert_eq!(private.status, "session/end");
- assert_eq!(private.owner_id.as_ref(), OWNER);
+ assert_eq!(private.owner_id.principal_id(), OWNER);
assert_eq!(private.bot_id, BOT_ID);
let member_items = cursor_soup(
@@ -215,7 +215,7 @@ async fn id_and_owner_literals_constrain_the_page(pool: PgPool) -> anyhow::Resul
request(
MEMBER,
Some(Expr::val(AgentSessionLiteral::Owner(
- MacroUserIdStr::parse_from_str(OWNER)?.into_owned(),
+ Owner::from_principal_str(OWNER)?,
))),
),
)
@@ -227,7 +227,7 @@ async fn id_and_owner_literals_constrain_the_page(pool: PgPool) -> anyhow::Resul
request(
OWNER,
Some(Expr::val(AgentSessionLiteral::Owner(
- MacroUserIdStr::parse_from_str(MEMBER)?.into_owned(),
+ Owner::from_principal_str(MEMBER)?,
))),
),
)
diff --git a/crates/soup/src/outbound/pg_soup_repo/expanded/by_ids.rs b/crates/soup/src/outbound/pg_soup_repo/expanded/by_ids.rs
index bc74dd762c..7038c15617 100644
--- a/crates/soup/src/outbound/pg_soup_repo/expanded/by_ids.rs
+++ b/crates/soup/src/outbound/pg_soup_repo/expanded/by_ids.rs
@@ -3,7 +3,7 @@ use crate::{
outbound::pg_soup_repo::type_err,
};
use document_sub_type::DocumentSubType;
-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
+use macro_user_id::user_id::MacroUserIdStr;
use model_entity::{Entity, EntityType};
#[cfg(test)]
use models_soup::item::SoupItem;
diff --git a/crates/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs b/crates/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs
index e3dc54787d..dee2671fb0 100644
--- a/crates/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs
+++ b/crates/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs
@@ -18,7 +18,8 @@ use item_filters::ast::{
project::ProjectLiteral,
properties::{PropertiesLiteral, PropertyEntityType, PropertyMatchValue},
};
-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
+use macro_user_id::user_id::MacroUserIdStr;
+use model_owner::Owner;
use models_pagination::{Query, SimpleSortMethod};
use models_soup::{
calendar_event::SoupCalendarEvent,
@@ -813,7 +814,9 @@ pub(in crate::outbound::pg_soup_repo) fn build_document_filter(
filter_ast::ExprFrame::Literal(DocumentLiteral::ProjectId(p)) => {
nullable_eq(r#"d."projectId""#, p)
}
- filter_ast::ExprFrame::Literal(DocumentLiteral::Owner(o)) => format!("d.owner = '{o}'"),
+ filter_ast::ExprFrame::Literal(DocumentLiteral::Owner(o)) => {
+ format!("d.owner = {}", sql_string_literal(&o.principal_id()))
+ }
filter_ast::ExprFrame::Literal(DocumentLiteral::Importance(true)) => {
// "Important" documents: non-tasks OR tasks where user is an assignee
r#"(
@@ -880,10 +883,11 @@ pub(in crate::outbound::pg_soup_repo) fn build_document_filter(
}
}
-/// A single-quoted SQL string literal with embedded quotes doubled. The
-/// calendar filter inlines caller-supplied strings (statuses, attendee and
-/// organizer emails), which unlike the ids the sibling builders inline are
-/// not shaped by a parser first.
+/// A single-quoted SQL string literal with embedded quotes doubled. Used for
+/// every caller-supplied string these bind-free builders inline: the calendar
+/// filter's statuses and attendee/organizer emails, and the owner principals,
+/// none of which are constrained to the shape of the uuids the sibling
+/// builders inline.
fn sql_string_literal(value: &str) -> String {
format!("'{}'", value.replace('\'', "''"))
}
@@ -964,7 +968,7 @@ pub(in crate::outbound::pg_soup_repo) fn build_chat_filter(
filter_ast::ExprFrame::Literal(ChatLiteral::Role(_r)) => "TRUE".to_string(),
filter_ast::ExprFrame::Literal(ChatLiteral::ChatId(i)) => format!("c.id = '{i}'"),
filter_ast::ExprFrame::Literal(ChatLiteral::Owner(o)) => {
- format!(r#"c."userId" = '{o}'"#)
+ format!(r#"c."userId" = {}"#, sql_string_literal(&o.principal_id()))
}
// all chats are important
filter_ast::ExprFrame::Literal(ChatLiteral::Importance(true)) => "TRUE".to_string(),
@@ -1005,7 +1009,7 @@ pub(in crate::outbound::pg_soup_repo) fn build_project_filter(
format!(r#"p.id = '{p}'"#)
}
filter_ast::ExprFrame::Literal(ProjectLiteral::Owner(o)) => {
- format!(r#"p."userId" = '{o}'"#)
+ format!(r#"p."userId" = {}"#, sql_string_literal(&o.principal_id()))
}
// all projects are important; TRUE (not empty) keeps the literal
// valid SQL inside And/Or/Not.
@@ -1681,9 +1685,7 @@ impl SoupRow {
document_version_id: document_version_id
.parse()
.map_err(|e| sqlx::Error::Decode(Box::new(e)))?,
- owner_id: MacroUserIdStr::parse_from_str(&user_id)
- .map_err(type_err)?
- .into_owned(),
+ owner_id: Owner::from_principal_str(&user_id).map_err(type_err)?,
name,
file_type,
sha,
@@ -1721,9 +1723,7 @@ impl SoupRow {
id: Uuid::parse_str(&id).map_err(type_err)?,
name,
model,
- owner_id: MacroUserIdStr::parse_from_str(&user_id)
- .map_err(type_err)?
- .into_owned(),
+ owner_id: Owner::from_principal_str(&user_id).map_err(type_err)?,
project_id: project_id
.as_deref()
.map(Uuid::parse_str)
@@ -1748,9 +1748,7 @@ impl SoupRow {
}) => SoupItem::Project(SoupProject {
id: Uuid::parse_str(&id).map_err(type_err)?,
name,
- owner_id: MacroUserIdStr::parse_from_str(&user_id)
- .map_err(type_err)?
- .into_owned(),
+ owner_id: Owner::from_principal_str(&user_id).map_err(type_err)?,
parent_id: project_id
.as_deref()
.map(Uuid::from_str)
diff --git a/crates/soup/src/outbound/pg_soup_repo/expanded/tests.rs b/crates/soup/src/outbound/pg_soup_repo/expanded/tests.rs
index 25fea4e05c..4d2102ed49 100644
--- a/crates/soup/src/outbound/pg_soup_repo/expanded/tests.rs
+++ b/crates/soup/src/outbound/pg_soup_repo/expanded/tests.rs
@@ -1657,7 +1657,7 @@ async fn test_filter_by_owner(db: PgPool) -> anyhow::Result<()> {
match item {
SoupItem::Document(doc) => {
assert_eq!(
- doc.owner_id.as_ref(),
+ doc.owner_id.principal_id(),
"All documents should be owned by user-1"
);
diff --git a/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs b/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs
index 814e605a66..da22507fb3 100644
--- a/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs
+++ b/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_cursor.rs
@@ -1,6 +1,6 @@
use crate::{map_soup_type, outbound::pg_soup_repo::type_err};
use document_sub_type::DocumentSubType;
-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
+use macro_user_id::user_id::MacroUserIdStr;
use models_pagination::{Query, SimpleSortMethod};
use models_soup::item::SoupItem;
use sqlx::PgPool;
diff --git a/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_ids.rs b/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_ids.rs
index 7454292eae..7ed4c12f41 100644
--- a/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_ids.rs
+++ b/crates/soup/src/outbound/pg_soup_repo/unexpanded/by_ids.rs
@@ -1,6 +1,6 @@
use crate::{map_soup_type, outbound::pg_soup_repo::type_err};
use document_sub_type::DocumentSubType;
-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
+use macro_user_id::user_id::MacroUserIdStr;
use model_entity::{Entity, EntityType};
use models_soup::item::SoupItem;
use sqlx::PgPool;
diff --git a/crates/soup_filter_projection/Cargo.toml b/crates/soup_filter_projection/Cargo.toml
index 35fad43629..61592c8e93 100644
--- a/crates/soup_filter_projection/Cargo.toml
+++ b/crates/soup_filter_projection/Cargo.toml
@@ -24,4 +24,4 @@ uuid = { workspace = true }
workspace-hack = { version = "0.1", path = "../workspace-hack", optional = true }
[dev-dependencies]
-macro_user_id = { path = "../macro_user_id" }
+model_owner = { path = "../model_owner" }
diff --git a/crates/soup_filter_projection/src/lib.rs b/crates/soup_filter_projection/src/lib.rs
index c128daa688..1e23f17d84 100644
--- a/crates/soup_filter_projection/src/lib.rs
+++ b/crates/soup_filter_projection/src/lib.rs
@@ -381,7 +381,7 @@ pub fn project_document<T>(
record_key,
kind: SoupFlatEntityKind::Document,
id: document.id,
- owner: document.owner_id.to_string(),
+ owner: document.owner_id.principal_id(),
project_id: document.project_id,
file_type: document.file_type.clone(),
created_at: document.created_at,
@@ -399,7 +399,7 @@ pub fn project_project<T>(
record_key,
kind: SoupFlatEntityKind::Project,
id: project.id,
- owner: project.owner_id.to_string(),
+ owner: project.owner_id.principal_id(),
project_id: project.parent_id,
file_type: None,
created_at: project.created_at,
@@ -417,7 +417,7 @@ pub fn project_chat<T>(
record_key,
kind: SoupFlatEntityKind::Chat,
id: chat.id,
- owner: chat.owner_id.to_string(),
+ owner: chat.owner_id.principal_id(),
project_id: chat.project_id,
file_type: None,
created_at: chat.created_at,
diff --git a/crates/soup_filter_projection/src/test.rs b/crates/soup_filter_projection/src/test.rs
index efe52f70ea..3cd162246b 100644
--- a/crates/soup_filter_projection/src/test.rs
+++ b/crates/soup_filter_projection/src/test.rs
@@ -1,6 +1,6 @@
use base64::{Engine as _, engine::general_purpose::STANDARD_NO_PAD};
use chrono::{TimeZone, Utc};
-use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
+use model_owner::Owner;
use models_soup::{
chat::SoupChat,
document::{SoupDocument, SoupDocumentSubType},
@@ -11,10 +11,8 @@ use uuid::Uuid;
use super::*;
use soup::domain::models::SoupDocumentServerFacts;
-fn owner() -> MacroUserIdStr<'static> {
- MacroUserIdStr::parse_from_str("macro|[email protected]")
- .unwrap()
- .into_owned()
+fn owner() -> Owner {
+ Owner::from_principal_str("macro|[email protected]").unwrap()
}
fn timestamp(micros: u32) -> chrono::DateTime<Utc> {
@@ -374,7 +372,7 @@ fn complete_v3_projection_contains_viewer_importance_and_status_facts() {
record_key: document_key(id),
kind: SoupFlatEntityKind::Document,
id: document.id,
- owner: document.owner_id.to_string(),
+ owner: document.owner_id.principal_id(),
project_id: document.project_id,
file_type: document.file_type,
created_at: document.created_at,
diff --git a/packages/sdk/generated/search/types.gen.ts b/packages/sdk/generated/search/types.gen.ts
index 2280ee88f3..6ec3c7f16f 100644
--- a/packages/sdk/generated/search/types.gen.ts
+++ b/packages/sdk/generated/search/types.gen.ts
@@ -24,8 +24,9 @@ export type AgentSessionFilters = {
*/
include?: boolean;
/**
- * Filter by session owner. Examples: ['macro|[email protected]']. Empty to
- * include every owner.
+ * Filter by session owner principal — a user ('macro|[email protected]'), a bot
+ * ('bot|<uuid>'), or a team (a bare hyphenated uuid). Empty to include every
+ * owner.
*/
owners?: Array<string>;
};
@@ -646,7 +647,10 @@ export type ChatFilters = {
*/
notification_filters?: NotificationFilters;
/**
- * Filter by chat owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.
+ * Filter by chat owner principal — a user ('macro|[email protected]'), a bot
+ * ('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+ * ['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+ * search all owners.
*/
owners?: Array<string>;
/**
@@ -881,7 +885,10 @@ export type DocumentFilters = {
*/
notification_filters?: NotificationFilters;
/**
- * Filter by document owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.
+ * Filter by document owner principal — a user ('macro|[email protected]'), a bot
+ * ('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+ * ['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+ * search all owners.
*/
owners?: Array<string>;
/**
@@ -1468,7 +1475,10 @@ export type ProjectFilters = {
*/
notification_filters?: NotificationFilters;
/**
- * Filter by project owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.
+ * Filter by project owner principal — a user ('macro|[email protected]'), a bot
+ * ('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+ * ['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+ * search all owners.
*/
owners?: Array<string>;
/**
diff --git a/packages/sdk/generated/storage/types.gen.ts b/packages/sdk/generated/storage/types.gen.ts
index d76bc3c79b..c487d888fe 100644
--- a/packages/sdk/generated/storage/types.gen.ts
+++ b/packages/sdk/generated/storage/types.gen.ts
@@ -195,8 +195,9 @@ export type AgentSessionFilters = {
*/
include?: boolean;
/**
- * Filter by session owner. Examples: ['macro|[email protected]']. Empty to
- * include every owner.
+ * Filter by session owner principal — a user ('macro|[email protected]'), a bot
+ * ('bot|<uuid>'), or a team (a bare hyphenated uuid). Empty to include every
+ * owner.
*/
owners?: Array<string>;
};
@@ -2925,7 +2926,10 @@ export type ChatFilters = {
*/
notification_filters?: NotificationFilters;
/**
- * Filter by chat owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.
+ * Filter by chat owner principal — a user ('macro|[email protected]'), a bot
+ * ('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+ * ['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+ * search all owners.
*/
owners?: Array<string>;
/**
@@ -4529,7 +4533,10 @@ export type DocumentFilters = {
*/
notification_filters?: NotificationFilters;
/**
- * Filter by document owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.
+ * Filter by document owner principal — a user ('macro|[email protected]'), a bot
+ * ('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+ * ['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+ * search all owners.
*/
owners?: Array<string>;
/**
@@ -7688,7 +7695,10 @@ export type ProjectFilters = {
*/
notification_filters?: NotificationFilters;
/**
- * Filter by project owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners.
+ * Filter by project owner principal — a user ('macro|[email protected]'), a bot
+ * ('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:
+ * ['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to
+ * search all owners.
*/
owners?: Array<string>;
/**
@@ -9484,7 +9494,7 @@ export type SoupProjectSoupPropertiesField = {
*/
name: string;
/**
- * The user id of who created the project
+ * The owner of the project
*/
ownerId: string;
/**
diff --git a/packages/sdk/specs/search.json b/packages/sdk/specs/search.json
index ba0b767231..e65378d168 100644
--- a/packages/sdk/specs/search.json
+++ b/packages/sdk/specs/search.json
@@ -198,7 +198,7 @@
"items": {
"type": "string"
},
- "description": "Filter by session owner. Examples: ['macro|[email protected]']. Empty to\ninclude every owner."
+ "description": "Filter by session owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Empty to include every\nowner."
}
}
},
@@ -1191,7 +1191,7 @@
"items": {
"type": "string"
},
- "description": "Filter by chat owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "description": "Filter by chat owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
},
"project_ids": {
"type": "array",
@@ -1540,7 +1540,7 @@
"items": {
"type": "string"
},
- "description": "Filter by document owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "description": "Filter by document owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
},
"project_ids": {
"type": "array",
@@ -2766,7 +2766,7 @@
"items": {
"type": "string"
},
- "description": "Filter by project owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "description": "Filter by project owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
},
"project_ids": {
"type": "array",
diff --git a/packages/sdk/specs/storage.json b/packages/sdk/specs/storage.json
index c6a36d9560..d0e667ea69 100644
--- a/packages/sdk/specs/storage.json
+++ b/packages/sdk/specs/storage.json
@@ -14415,7 +14415,7 @@
"items": {
"type": "string"
},
- "description": "Filter by session owner. Examples: ['macro|[email protected]']. Empty to\ninclude every owner."
+ "description": "Filter by session owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Empty to include every\nowner."
}
}
},
@@ -18389,7 +18389,7 @@
"items": {
"type": "string"
},
- "description": "Filter by chat owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "description": "Filter by chat owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
},
"project_ids": {
"type": "array",
@@ -20667,7 +20667,7 @@
"items": {
"type": "string"
},
- "description": "Filter by document owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "description": "Filter by document owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
},
"project_ids": {
"type": "array",
@@ -26334,7 +26334,7 @@
"items": {
"type": "string"
},
- "description": "Filter by project owner. Examples: ['macro|[email protected]'], ['macro|[email protected]', 'macro|[email protected]']. Empty to search all owners."
+ "description": "Filter by project owner principal — a user ('macro|[email protected]'), a bot\n('bot|<uuid>'), or a team (a bare hyphenated uuid). Examples:\n['macro|[email protected]'], ['macro|[email protected]', 'bot|0199...']. Empty to\nsearch all owners."
},
"project_ids": {
"type": "array",
@@ -29120,7 +29120,7 @@
},
"ownerId": {
"type": "string",
- "description": "The user id of who created the project"
+ "description": "The owner of the project"
},
"parentId": {
"type": ["string", "null"],
diff --git a/static_assets/schema.graphql b/static_assets/schema.graphql
index 08474785bf..084930f565 100644
--- a/static_assets/schema.graphql
+++ b/static_assets/schema.graphql
@@ -636,7 +636,8 @@ input GraphqlAgentSessionLiteral @oneOf {
"""
id: ID
"""
- The owner option.
+ The owner principal option — a user (`macro|<email>`), a bot
+ (`bot|<uuid>`), or a team (a bare hyphenated uuid).
"""
owner: String
}
@@ -1414,7 +1415,8 @@ input GraphqlChatLiteral @oneOf {
"""
chatId: ID
"""
- The owner option.
+ The owner principal option — a user (`macro|<email>`), a bot
+ (`bot|<uuid>`), or a team (a bare hyphenated uuid).
"""
owner: String
"""
@@ -1646,7 +1648,8 @@ input GraphqlDocumentLiteral @oneOf {
"""
projectId: ID
"""
- The owner option.
+ The owner principal option — a user (`macro|<email>`), a bot
+ (`bot|<uuid>`), or a team (a bare hyphenated uuid).
"""
owner: String
"""
@@ -2134,10 +2137,15 @@ Metadata shared by every canonical Soup entity.
"""
type GraphqlEntityMetadata {
"""
- Owning user, when applicable.
+ Owning principal, when applicable.
"""
ownerId: String
"""
+ The kind of principal `ownerId` names. Null exactly when `ownerId`
+ is, for the entities that have no owner of their own.
+ """
+ ownerType: GraphqlOwnerType
+ """
Parent project, channel, or team, when applicable.
"""
parent: GraphqlEntity
@@ -3367,6 +3375,26 @@ type GraphqlNumberPropertyValue {
value: Float!
}
+"""
+GraphQL representation of [`OwnerType`]: the kind of principal that owns an
+entity. Paired with an `ownerId` principal string, which is a user id, a
+bot id, or a team id depending on this discriminator.
+"""
+enum GraphqlOwnerType {
+ """
+ A Macro user.
+ """
+ USER
+ """
+ A bot.
+ """
+ BOT
+ """
+ A team.
+ """
+ TEAM
+}
+
"""
The two operands of a recursive `ProjectFilterExpr` binary expression.
"""
@@ -3416,7 +3444,8 @@ input GraphqlProjectLiteral @oneOf {
"""
projectIdSelf: ID
"""
- The owner option.
+ The owner principal option — a user (`macro|<email>`), a bot
+ (`bot|<uuid>`), or a team (a bare hyphenated uuid).
"""
owner: String
"""
@@ -3972,10 +4001,14 @@ type GraphqlSoupAgentSession implements GraphqlSoupEntity {
"""
name: String!
"""
- The identifier of the owner.
+ The principal identifier of the owner.
"""
ownerId: String!
"""
+ The kind of principal `ownerId` names.
+ """
+ ownerType: GraphqlOwnerType!
+ """
The bot running this session.
"""
botId: ID!
@@ -4573,10 +4606,14 @@ type GraphqlSoupChat implements GraphqlSoupEntity {
"""
model: String
"""
- The identifier of the owner.
+ The principal identifier of the owner.
"""
ownerId: String!
"""
+ The kind of principal `ownerId` names.
+ """
+ ownerType: GraphqlOwnerType!
+ """
The identifier of the project.
"""
projectId: ID
@@ -4745,10 +4782,14 @@ type GraphqlSoupDocument implements GraphqlSoupEntity {
"""
name: String!
"""
- The identifier of the owner.
+ The principal identifier of the owner.
"""
ownerId: String!
"""
+ The kind of principal `ownerId` names.
+ """
+ ownerType: GraphqlOwnerType!
+ """
The file type.
"""
fileType: String
@@ -5555,10 +5596,14 @@ type GraphqlSoupProject implements GraphqlSoupEntity {
"""
name: String!
"""
- The identifier of the owner.
+ The principal identifier of the owner.
"""
ownerId: String!
"""
+ The kind of principal `ownerId` names.
+ """
+ ownerType: GraphqlOwnerType!
+ """
The identifier of the parent.
"""
parentId: ID
diff --git a/tooling/xtask/crates/xtask_nextest_filter/determinator.toml b/tooling/xtask/crates/xtask_nextest_filter/determinator.toml
index 459ade4d86..f47e2406ae 100644
--- a/tooling/xtask/crates/xtask_nextest_filter/determinator.toml
+++ b/tooling/xtask/crates/xtask_nextest_filter/determinator.toml
@@ -8,6 +8,5 @@ mark-changed = [
"complete_graph",
"documents",
"seed_cli",
- "sync_service",
"xtask_workflows",
]