@oxygen-agent/cli 1.1022.49 → 1.1024.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/command-families/program.js +0 -4
- package/dist/command-families/tables/register-views.js +3 -3
- package/dist/command-manifest.js +0 -2
- package/dist/commands/approvals.js +1 -1
- package/dist/commands/budget.js +9 -4
- package/dist/commands/companies.js +1 -1
- package/dist/commands/members.js +1 -1
- package/dist/commands/orgs.js +1 -1
- package/dist/commands/publishing.js +25 -16
- package/dist/commands/sequences.js +15 -1
- package/dist/commands/workflows.js +1 -1
- package/node_modules/@oxygen/shared/dist/access/permissions.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/access/permissions.js +1 -1
- package/node_modules/@oxygen/shared/dist/access/roles.d.ts +21 -8
- package/node_modules/@oxygen/shared/dist/access/roles.js +53 -16
- package/node_modules/@oxygen/shared/dist/billing/budget-scopes.d.ts +2 -2
- package/node_modules/@oxygen/shared/dist/billing/budget-scopes.js +2 -2
- package/node_modules/@oxygen/shared/dist/billing/plan-capabilities.js +1 -1
- package/node_modules/@oxygen/shared/dist/capability-intents/index.generated.d.ts +0 -40
- package/node_modules/@oxygen/shared/dist/capability-intents/tables.d.ts +0 -20
- package/node_modules/@oxygen/shared/dist/capability-intents/tables.js +0 -3
- package/node_modules/@oxygen/shared/dist/capability-intents/tables.rules.js +6 -41
- package/node_modules/@oxygen/shared/dist/capability-routes/geo.js +1 -1
- package/node_modules/@oxygen/shared/dist/capability-routes/tables.js +3 -3
- package/node_modules/@oxygen/shared/dist/contracts/browser-operations.js +1 -0
- package/node_modules/@oxygen/shared/dist/contracts/customer-operations.js +1 -1
- package/node_modules/@oxygen/shared/dist/contracts/geo.js +6 -6
- package/node_modules/@oxygen/shared/dist/copilot/plan-hold.d.ts +1 -0
- package/node_modules/@oxygen/shared/dist/copilot/plan-hold.js +5 -2
- package/node_modules/@oxygen/shared/dist/geo/geo.d.ts +168 -2
- package/node_modules/@oxygen/shared/dist/geo/geo.js +358 -71
- package/node_modules/@oxygen/shared/dist/onboarding-leads.js +9 -3
- package/node_modules/@oxygen/shared/dist/publishing/limits.d.ts +7 -0
- package/node_modules/@oxygen/shared/dist/publishing/limits.js +7 -0
- package/node_modules/@oxygen/shared/dist/schedule-label.js +29 -1
- package/node_modules/@oxygen/shared/dist/sequences/enrollment-origin.d.ts +3 -1
- package/node_modules/@oxygen/shared/dist/sequences/enrollment-origin.js +2 -0
- package/node_modules/@oxygen/shared/dist/social-capabilities.js +5 -3
- package/node_modules/@oxygen/shared/dist/tables/column-output-fields.js +12 -0
- package/node_modules/@oxygen/shared/dist/version.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/version.generated.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/version.generated.js +1 -1
- package/node_modules/@oxygen/shared/dist/version.js +1 -1
- package/node_modules/@oxygen/workflows/dist/graph/diff.d.ts +2 -0
- package/node_modules/@oxygen/workflows/dist/graph/diff.js +3 -0
- package/node_modules/@oxygen/workflows/dist/graph/index.d.ts +1 -0
- package/node_modules/@oxygen/workflows/dist/graph/index.js +1 -0
- package/node_modules/@oxygen/workflows/dist/graph/lint.js +44 -1
- package/node_modules/@oxygen/workflows/dist/graph/manifest-schema.d.ts +62 -0
- package/node_modules/@oxygen/workflows/dist/graph/manifest-schema.js +22 -0
- package/node_modules/@oxygen/workflows/dist/graph/output.d.ts +36 -0
- package/node_modules/@oxygen/workflows/dist/graph/output.js +111 -0
- package/node_modules/@oxygen/workflows/dist/graph/types.d.ts +19 -0
- package/node_modules/@oxygen/workflows/dist/graph/types.js +8 -0
- package/package.json +1 -1
- package/dist/commands/callables.d.ts +0 -3
- package/dist/commands/callables.js +0 -111
- package/dist/functions-commands.d.ts +0 -6
- package/dist/functions-commands.js +0 -85
- package/node_modules/@oxygen/shared/dist/contracts/function-library-read.d.ts +0 -14
- package/node_modules/@oxygen/shared/dist/contracts/function-library-read.js +0 -16
package/README.md
CHANGED
|
@@ -14,7 +14,6 @@ import { registerAuthFamily } from "../commands/auth.js";
|
|
|
14
14
|
import { registerBillingFamily } from "../commands/billing.js";
|
|
15
15
|
import { registerBlueprintsFamily } from "../commands/blueprints.js";
|
|
16
16
|
import { registerBudgetFamily } from "../commands/budget.js";
|
|
17
|
-
import { registerCallablesFamily } from "../commands/callables.js";
|
|
18
17
|
import { registerCapabilitiesFamily } from "../commands/capabilities.js";
|
|
19
18
|
import { registerCellsFamily } from "../commands/cells.js";
|
|
20
19
|
import { registerClayMigrationFamily } from "../commands/clay-migration.js";
|
|
@@ -102,7 +101,6 @@ import { defaultApiUrl } from "../credentials.js";
|
|
|
102
101
|
import { registerCrmFileReadCommands } from "../crm-file-read-commands.js";
|
|
103
102
|
import { registerCrmSupportFlags } from "../crm-support-flags.js";
|
|
104
103
|
import { registerCustomerOperationCommands } from "../customer-operation-commands.js";
|
|
105
|
-
import { registerFunctionsCommands } from "../functions-commands.js";
|
|
106
104
|
import { applyOxygenHelp, enableCommandSuggestions, oxygenDocsUrl, validateRequiredOptionValues } from "../help.js";
|
|
107
105
|
import { registerKnowledgeRepositoryCommands } from "../knowledge-repository-commands.js";
|
|
108
106
|
import { resolveCliBinaryName } from "../runtime.js";
|
|
@@ -226,11 +224,9 @@ export function createProgram() {
|
|
|
226
224
|
registerMailboxesFamily(program, handleAsyncAction);
|
|
227
225
|
registerDeliverabilityFamily(program, handleAsyncAction);
|
|
228
226
|
registerDomainsFamily(program, handleAsyncAction);
|
|
229
|
-
registerCallablesFamily(program, handleAsyncAction);
|
|
230
227
|
registerWorkflowsFamily(program, handleAsyncAction);
|
|
231
228
|
registerSkillsFamily(program, handleAsyncAction);
|
|
232
229
|
registerVisualCommands(program, handleAsyncAction);
|
|
233
|
-
registerFunctionsCommands(program, handleAsyncAction);
|
|
234
230
|
registerUgcCommands(program, handleAsyncAction);
|
|
235
231
|
registerKnowledgeRepositoryCommands(program, handleAsyncAction);
|
|
236
232
|
registerAdminLeadMagnetCommands(program, handleAsyncAction);
|
|
@@ -13,7 +13,7 @@ export function registerViews({ tablesCommand, handleAsyncAction }) {
|
|
|
13
13
|
const TABLE_VIEW_CONFIG_HELP = 'JSON view config, typed v2 shape: {"version":2,"groupBy":"<select column key>","filterTree":{...},"sorts":[{"columnKey":"...","direction":"asc|desc"}],"visibleColumns":["..."],"cardFields":["..."]}. '
|
|
14
14
|
+ 'groupBy is the kanban group-by column (--group-by sets it for you); a complete board config is \'{"version":2,"groupBy":"lifecycle_stage"}\'. Malformed v2 is rejected with invalid_view_config.';
|
|
15
15
|
tablesCommand.addCommand(new Command("views")
|
|
16
|
-
.description("Create and manage saved table views (grid / kanban configurations).")
|
|
16
|
+
.description("Create and manage saved table views (grid / kanban / calendar configurations).")
|
|
17
17
|
.addCommand(new Command("list")
|
|
18
18
|
.description("List a table's saved views.")
|
|
19
19
|
.argument("<table>", "Table id or slug.")
|
|
@@ -29,7 +29,7 @@ export function registerViews({ tablesCommand, handleAsyncAction }) {
|
|
|
29
29
|
.description("Create a saved view.")
|
|
30
30
|
.argument("<table>", "Table id or slug.")
|
|
31
31
|
.requiredOption("--name <name>", "View name.")
|
|
32
|
-
.option("--view-type <type>", "table (grid)
|
|
32
|
+
.option("--view-type <type>", "table (grid), kanban (board split into lanes by a select/status column) or calendar (month grid by a date column; set it with --config '{\"version\":2,\"dateField\":\"<column>\"}'). Defaults to table; --group-by implies kanban. A kanban created without --group-by is not refused: the board renders on the table's first groupable column and every read reports that fallback as effective_group_by plus a warning, so pin the column with --group-by.")
|
|
33
33
|
.option("--group-by <column>", "Kanban: the editable select/status column key the board splits on, e.g. --group-by lifecycle_stage. Unknown or non-groupable keys are refused with the groupable candidates. The response's effective_group_by is the column the board actually uses.")
|
|
34
34
|
.option("--config <json>", TABLE_VIEW_CONFIG_HELP)
|
|
35
35
|
.option("--default", "Make this the table's default view.")
|
|
@@ -54,7 +54,7 @@ export function registerViews({ tablesCommand, handleAsyncAction }) {
|
|
|
54
54
|
.argument("<table>", "Table id or slug.")
|
|
55
55
|
.argument("<view>", "View id.")
|
|
56
56
|
.option("--name <name>", "Rename the view.")
|
|
57
|
-
.option("--view-type <type>", "table (grid)
|
|
57
|
+
.option("--view-type <type>", "table (grid), kanban (board) or calendar (month grid by the config's dateField). A kanban whose config names no group column renders on the first groupable column; reads report that fallback as effective_group_by plus a warning.")
|
|
58
58
|
.option("--group-by <column>", "Kanban: change the select/status column the board splits on; folds into the stored config and keeps the rest of it. Refused for a grid view unless --view-type kanban is passed with it.")
|
|
59
59
|
.option("--config <json>", `${TABLE_VIEW_CONFIG_HELP} Replaces the stored config.`)
|
|
60
60
|
.option("--default", "Make this the table's default view.")
|
package/dist/command-manifest.js
CHANGED
|
@@ -240,8 +240,6 @@ const ZERO_CREDIT_APPROVAL_COMMANDS = new Set([
|
|
|
240
240
|
"ugc amplification reconcile",
|
|
241
241
|
"ugc peer-amplification reconcile",
|
|
242
242
|
"ugc sponsorship cancel",
|
|
243
|
-
// A Function binding stores a cap for future runs; creating it executes nothing.
|
|
244
|
-
"functions bind",
|
|
245
243
|
// Same shape: a draft Sequence stores its LinkedIn --max-credits ceiling for a
|
|
246
244
|
// later approved `sequences start`, which carries its own cap. Creating or
|
|
247
245
|
// editing one spends nothing; the manifest said otherwise while MCP called
|
|
@@ -461,7 +461,7 @@ export function registerApprovalsFamily(program, handleAsyncAction) {
|
|
|
461
461
|
}), formatCollabWriteResult);
|
|
462
462
|
}))
|
|
463
463
|
.addCommand(new Command("list")
|
|
464
|
-
.description("Every member of this workspace and
|
|
464
|
+
.description("Every member of this workspace and the role they hold, followed by anyone invited who has not joined yet, and what they will land as. Also names, per member, why a client grant on them would be refused. Same read the /collab/members page renders.")
|
|
465
465
|
.option("--json", "Print a JSON envelope.")
|
|
466
466
|
.action(async (options) => {
|
|
467
467
|
await handleCollabAction("approvals client list", options, () => requestOxygen("/api/cli/collab/members"), formatWorkspaceMembers);
|
package/dist/commands/budget.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readPositiveNumber } from "../command-support.js";
|
|
1
|
+
import { readNonNegativeNumber, readPositiveNumber } from "../command-support.js";
|
|
2
2
|
import { requestOxygen } from "../http-client.js";
|
|
3
3
|
import { readOption } from "../util.js";
|
|
4
4
|
import { formatPublicBudgetScopes } from "@oxygen/shared/billing/budget-scopes";
|
|
@@ -24,11 +24,12 @@ export function registerBudgetFamily(program, handleAsyncAction) {
|
|
|
24
24
|
});
|
|
25
25
|
}))
|
|
26
26
|
.addCommand(new Command("set")
|
|
27
|
-
.description("Set, raise, or lower a standing credit cap (idempotent per scope+window). Daily/monthly windows start at 00:00 UTC and count net reservations plus workspace Workflow and BYOK fee accrual, excluding proven duplicate transfers;
|
|
27
|
+
.description("Set, raise, or lower a standing credit cap (idempotent per scope+window). Daily/monthly windows start at 00:00 UTC and count net reservations plus workspace Workflow and BYOK fee accrual, excluding proven duplicate transfers; a member's credit limit counts only that person's own spend. Inspect current use with `oxygen budget list`.")
|
|
28
28
|
.requiredOption("--scope <scope>", formatPublicBudgetScopes())
|
|
29
29
|
.requiredOption("--window <window>", "per_run, daily, or monthly.")
|
|
30
|
-
.requiredOption("--max-credits <credits>", "Cap in Oxygen credits.")
|
|
30
|
+
.requiredOption("--max-credits <credits>", "Cap in Oxygen credits; 0 only for --scope member, who then spends nothing.")
|
|
31
31
|
.option("--scope-id <id>", "Table id/slug for --scope table (or other scope id). Omit for a scope-wide cap.")
|
|
32
|
+
.option("--member <email>", "The member's email, for --scope member.")
|
|
32
33
|
.option("--action <action>", "warn or hard_block. Defaults to hard_block.")
|
|
33
34
|
.option("--json", "Print a JSON envelope.")
|
|
34
35
|
.action(async (options) => {
|
|
@@ -37,8 +38,12 @@ export function registerBudgetFamily(program, handleAsyncAction) {
|
|
|
37
38
|
body: {
|
|
38
39
|
scope: readOption(options.scope),
|
|
39
40
|
window: readOption(options.window),
|
|
40
|
-
|
|
41
|
+
// A member's credit limit may be 0: they spend nothing.
|
|
42
|
+
max_credits: readOption(options.scope) === "member"
|
|
43
|
+
? readNonNegativeNumber(options.maxCredits)
|
|
44
|
+
: readPositiveNumber(options.maxCredits),
|
|
41
45
|
...(readOption(options.scopeId) ? { scope_id: readOption(options.scopeId) } : {}),
|
|
46
|
+
...(readOption(options.member) ? { member: readOption(options.member) } : {}),
|
|
42
47
|
...(readOption(options.action) ? { action: readOption(options.action) } : {}),
|
|
43
48
|
},
|
|
44
49
|
}));
|
|
@@ -295,7 +295,7 @@ export function registerCompaniesFamily(program, handleAsyncAction) {
|
|
|
295
295
|
.argument("<table>", "Table id or slug.")
|
|
296
296
|
.option("--missing-fields <fields>", "Comma-separated fields to fill.")
|
|
297
297
|
.option("--providers <providers>", "Comma-separated provider pool.")
|
|
298
|
-
.option("--mode <mode>", "dry_run or live. Defaults to live. dry_run returns the same plan as `companies enrich preview` and creates no column; only a live run creates the target columns it fills. To reuse a
|
|
298
|
+
.option("--mode <mode>", "dry_run or live. Defaults to live. dry_run returns the same plan as `companies enrich preview` and creates no column; only a live run creates the target columns it fills. To reuse a workflow per row, add a Workflow column (`columns add --kind tool` with definition mode workflow) before running the column.")
|
|
299
299
|
.option("--max-credits <n>", "Required credit ceiling for live runs.")
|
|
300
300
|
.option("--max-concurrency <n>", "Maximum simultaneous rows, 1–1000. Lower to slow provider calls.")
|
|
301
301
|
.option("--approved", "Approve this live paid run after inspecting the preview.")
|
package/dist/commands/members.js
CHANGED
|
@@ -19,7 +19,7 @@ export function registerMembersFamily(program, _handleAsyncAction) {
|
|
|
19
19
|
await handleCollabAction("members list", options, () => requestOxygen("/api/cli/collab/members"), formatWorkspaceMembers);
|
|
20
20
|
}))
|
|
21
21
|
.addCommand(new Command("role")
|
|
22
|
-
.description(`Set a member's role. ADMIN ONLY. ${ROLE_HELP} An invited address that has not joined yet takes any role but admin, applied the moment they accept. You cannot change your own role
|
|
22
|
+
.description(`Set a member's role, which Clerk holds, so it also shows in Clerk's members list. ADMIN ONLY. ${ROLE_HELP} An invited address that has not joined yet takes any role but admin, applied the moment they accept. You cannot change your own role.`)
|
|
23
23
|
.argument("<email>", "The member's email, or a pending invitation's email.")
|
|
24
24
|
.requiredOption("--role <role>", `One of ${WORKSPACE_ROLES.map((role) => role.id).join(", ")}.`)
|
|
25
25
|
.option("--json", "Print a JSON envelope.")
|
package/dist/commands/orgs.js
CHANGED
|
@@ -224,7 +224,7 @@ export function registerOrgsFamily(program, handleAsyncAction) {
|
|
|
224
224
|
}));
|
|
225
225
|
}))
|
|
226
226
|
.addCommand(new Command("member-role")
|
|
227
|
-
.description("
|
|
227
|
+
.description("Make a member an admin or a member. ADMIN ONLY. Roles are held in Clerk; inviting people is still done in workspace settings. `oxygen members role` sets every role, including sales rep, viewer and client.")
|
|
228
228
|
.argument("<email>", "Workspace member's email.")
|
|
229
229
|
.requiredOption("--role <role>", "admin or member.")
|
|
230
230
|
.option("--json", "Print a JSON envelope.")
|
|
@@ -67,9 +67,15 @@ function buildPublishingMentionsResolveBody(options) {
|
|
|
67
67
|
}
|
|
68
68
|
function buildPublishingPostCreateBody(options) {
|
|
69
69
|
const status = resolvePublishingCreateStatus(options);
|
|
70
|
+
const publishAt = readOption(options.publishAt);
|
|
71
|
+
const groupWith = readOption(options.groupWith);
|
|
72
|
+
if (!publishAt && !groupWith) {
|
|
73
|
+
throw new OxygenError("invalid_request", "Pass --publish-at, or --group-with <post_id> to add a channel to a post that already has a time.", { exitCode: 2 });
|
|
74
|
+
}
|
|
70
75
|
const body = {
|
|
71
76
|
content_text: readPublishingPostText(options, true),
|
|
72
|
-
publish_at:
|
|
77
|
+
...(publishAt ? { publish_at: publishAt } : {}),
|
|
78
|
+
...(groupWith ? { group_with: groupWith } : {}),
|
|
73
79
|
status,
|
|
74
80
|
approved: options.approved === true,
|
|
75
81
|
};
|
|
@@ -254,7 +260,7 @@ function buildPublishingPostUpdateBody(options) {
|
|
|
254
260
|
return body;
|
|
255
261
|
}
|
|
256
262
|
/**
|
|
257
|
-
* The
|
|
263
|
+
* The video cover flags (LinkedIn videos, Instagram Reels): a media id, a local file uploaded first, or
|
|
258
264
|
* (update only) a clear. Sent as the top-level `video_thumbnail_media_asset_id`,
|
|
259
265
|
* which the server merges into content, so the post's attachments are untouched.
|
|
260
266
|
*/
|
|
@@ -780,12 +786,13 @@ export function registerPublishingFamily(program, handleAsyncAction) {
|
|
|
780
786
|
}))
|
|
781
787
|
.addCommand(new Command("create")
|
|
782
788
|
.description("Create a personal Publishing post. Use --ugc-participation-id to save it into one program as an unapproved draft; otherwise it defaults to scheduled and publishes only after approval.")
|
|
783
|
-
.
|
|
789
|
+
.option("--publish-at <iso>", "When the post publishes, e.g. 2026-10-06T09:00:00+02:00. With Z or an offset it is that exact instant; without one (2026-10-06T09:00) it is wall-clock time in --timezone. Required unless --group-with, where the channel takes that post's time.")
|
|
790
|
+
.option("--group-with <post_id>", "Add this as another channel of an existing post (one post per channel), with its own account and copy; reuse the same media_asset_ids to share one upload. It publishes at that post's time, so omit --publish-at and --timezone; `publishing posts get` lists the post's channels under group.")
|
|
784
791
|
.option("--provider <provider>", "Publishing provider: linkedin, x, instagram, tiktok, facebook, or youtube. Defaults to linkedin. LinkedIn publishes through --sender; every other provider publishes through a connected account (--provider-connection), which the worker needs before it can deliver.")
|
|
785
792
|
.option("--channel <channel>", "Publishing channel override. Defaults to provider.")
|
|
786
793
|
.option("--sender <sender_account_id>", "LinkedIn sender account id. Required for LinkedIn before the worker can publish.")
|
|
787
794
|
.option("--provider-connection <connection_id>", "Oxygen integration connection id for Composio-backed providers. Find it with `integrations list` (each integration's connection); create one with `integrations connect <provider>` (an OAuth redirect URL, or Settings > Connections on the web).")
|
|
788
|
-
.option("--title <title>", "
|
|
795
|
+
.option("--title <title>", "Title. YouTube and TikTok publish it as the video title; on other channels it only labels the post in the queue.")
|
|
789
796
|
.option("--text <text>", "Post text. On LinkedIn, tag a person with @<public-identifier> and a company page with @<handle> from its linkedin.com/company/<handle> URL.")
|
|
790
797
|
.option("--text-file <path>", "Read post text from a local file.")
|
|
791
798
|
.option("--content-json <json>", "Structured content. Use media_asset_ids for Oxygen uploads. LinkedIn attachments require [{content:<base64>,content_type:<MIME>,filename:<name>}]; content.mentions is rejected, so put verified @<public-identifier> values in --text. X options have their own flags (--thread-post, --poll-option, --reply-settings, --alt-text, --photo-tag); raw X API keys can still ride in composio.arguments.")
|
|
@@ -805,8 +812,8 @@ export function registerPublishingFamily(program, handleAsyncAction) {
|
|
|
805
812
|
.option("--reply-settings <who>", "X: who can reply: everyone, following, mentioned, or subscribers.")
|
|
806
813
|
.option("--alt-text <media_id=text>", "X: image or GIF description for screen readers (up to 1,000 characters). Repeatable.", collectRepeatable, [])
|
|
807
814
|
.option("--photo-tag <username>", "X: tag an account in the first post's images (up to 10). Repeatable.", collectRepeatable, [])
|
|
808
|
-
.option("--video-thumbnail <media_id>", "LinkedIn video
|
|
809
|
-
.option("--video-thumbnail-file <path>", "Upload a local
|
|
815
|
+
.option("--video-thumbnail <media_id>", "Video cover for a LinkedIn video or Instagram Reel: an uploaded media id (`publishing media upload`); JPEG or PNG on LinkedIn, a JPEG up to 8 MB on Instagram. Needs a video in media_asset_ids (first on Instagram).")
|
|
816
|
+
.option("--video-thumbnail-file <path>", "Upload a local image and use it as the video cover (JPEG or PNG on LinkedIn, JPEG on Instagram).")
|
|
810
817
|
.option("--json", "Print a JSON envelope.")
|
|
811
818
|
.action(async (options) => {
|
|
812
819
|
await handleAsyncAction("publishing posts create", options, async () => requestOxygen("/api/cli/publishing/posts", {
|
|
@@ -815,7 +822,7 @@ export function registerPublishingFamily(program, handleAsyncAction) {
|
|
|
815
822
|
}));
|
|
816
823
|
}))
|
|
817
824
|
.addCommand(new Command("get")
|
|
818
|
-
.description("Get one scheduled post with the sender account it publishes from (id, name, profile URL), resolved media previews, its
|
|
825
|
+
.description("Get one scheduled post with the sender account it publishes from (id, name, profile URL), resolved media previews, its video cover, and attempt history. For an X post, publish_plan lists every post that will be sent, in order, with media, alt text, poll and reply settings (free); for a LinkedIn post that tags a company page, it shows the text sent, each company tag as its page id, once `publishing posts approve` has resolved the tags (before approval it is absent). For a post that goes out on several channels, group lists every channel with its post id, account, copy, time and status. Open web_url to preview the post as it will look on LinkedIn or X.")
|
|
819
826
|
.argument("<post_id>", "Scheduled post id.")
|
|
820
827
|
.option("--json", "Print a JSON envelope.")
|
|
821
828
|
.action(async (postId, options) => {
|
|
@@ -828,15 +835,15 @@ export function registerPublishingFamily(program, handleAsyncAction) {
|
|
|
828
835
|
.option("--channel <channel>", "Publishing channel override.")
|
|
829
836
|
.option("--sender <sender_account_id>", "LinkedIn sender account id.")
|
|
830
837
|
.option("--provider-connection <connection_id>", "Oxygen integration connection id for Composio-backed providers.")
|
|
831
|
-
.option("--title <title>", "
|
|
838
|
+
.option("--title <title>", "Title. YouTube and TikTok publish it as the video title; on other channels it only labels the post in the queue.")
|
|
832
839
|
.option("--text <text>", "Post text. On LinkedIn, tag a person with @<public-identifier> and a company page with @<handle> from its linkedin.com/company/<handle> URL.")
|
|
833
840
|
.option("--text-file <path>", "Read post text from a local file.")
|
|
834
841
|
.option("--content-json <json>", "Structured content. Use media_asset_ids for Oxygen uploads. LinkedIn attachments require [{content:<base64>,content_type:<MIME>,filename:<name>}]; content.mentions is rejected, so put verified @<public-identifier> values in --text. This replaces the existing content object; use --content-merge-json or the X flags to change single keys.")
|
|
835
842
|
.option("--first-comment <text>", "Set the comment OXYGEN posts right after the post, keeping the rest of its content. Revokes approval on an approved post.")
|
|
836
843
|
.option("--clear-first-comment", "Remove the first comment. Revokes approval on an approved post.")
|
|
837
844
|
.option("--composio-action <slug>", "Override the Composio action slug for this scheduled post.")
|
|
838
|
-
.option("--publish-at <iso>", "When the post publishes. With Z or an offset it is that exact instant; without one it is wall-clock time in --timezone, else the post's own timezone.")
|
|
839
|
-
.option("--timezone <tz>", "IANA zone the post is shown in and a --publish-at without an offset is read in. Unchanged when omitted.")
|
|
845
|
+
.option("--publish-at <iso>", "When the post publishes. With Z or an offset it is that exact instant; without one it is wall-clock time in --timezone, else the post's own timezone. On a post with several channels it moves every channel that has not published.")
|
|
846
|
+
.option("--timezone <tz>", "IANA zone the post is shown in and a --publish-at without an offset is read in. Unchanged when omitted; on a post with several channels it changes every channel.")
|
|
840
847
|
.option("--status <status>", "draft or scheduled. Setting scheduled does not itself approve the post.")
|
|
841
848
|
.option("--thread-post <text>", "X: text of the next post in a thread (posts 2, 3, ... in order). Repeatable.", collectRepeatable, [])
|
|
842
849
|
.option("--thread-media <position=media_id>", "X: attach an uploaded media id to thread post N (2 or later), e.g. 2=<media_id>. Repeatable.", collectRepeatable, [])
|
|
@@ -846,9 +853,9 @@ export function registerPublishingFamily(program, handleAsyncAction) {
|
|
|
846
853
|
.option("--alt-text <media_id=text>", "X: image or GIF description for screen readers (up to 1,000 characters). Repeatable.", collectRepeatable, [])
|
|
847
854
|
.option("--photo-tag <username>", "X: tag an account in the first post's images (up to 10). Repeatable.", collectRepeatable, [])
|
|
848
855
|
.option("--content-merge-json <json>", "Merge content keys; null removes a key, e.g. '{\"poll\":null}'. Arrays, including mention_previews, are replaced whole: carry every entry you want to keep.")
|
|
849
|
-
.option("--video-thumbnail <media_id>", "Set the LinkedIn video
|
|
850
|
-
.option("--video-thumbnail-file <path>", "Upload a local
|
|
851
|
-
.option("--clear-video-thumbnail", "Remove the
|
|
856
|
+
.option("--video-thumbnail <media_id>", "Set the video cover of a LinkedIn video or Instagram Reel to an uploaded media id (`publishing media upload`); JPEG or PNG on LinkedIn, a JPEG up to 8 MB on Instagram. The post needs a video attached (first on Instagram).")
|
|
857
|
+
.option("--video-thumbnail-file <path>", "Upload a local image and set it as the video cover (JPEG or PNG on LinkedIn, JPEG on Instagram). To pick a frame from the video instead, open the post's web_url and use Cover.")
|
|
858
|
+
.option("--clear-video-thumbnail", "Remove the video cover.")
|
|
852
859
|
.option("--confirm-not-published", "Only after you checked the account: the post OXYGEN could not confirm is NOT there. Unlocks a post that failed with publishing_effect_outcome_uncertain; if the post is live, do not use it or it publishes twice.")
|
|
853
860
|
.option("--json", "Print a JSON envelope.")
|
|
854
861
|
.action(async (postId, options) => {
|
|
@@ -860,10 +867,12 @@ export function registerPublishingFamily(program, handleAsyncAction) {
|
|
|
860
867
|
.addCommand(new Command("approve")
|
|
861
868
|
.description("Approve a draft or scheduled post; drafts become scheduled for their saved publish time. Costs 0 credits. Owner-only profile approval is configured with senders limits set --publishing-approval-mode owner. LinkedIn checks person handles and page IDs before arming. Current resolved previews with handle mismatches fail before lookups. Company handles are rechecked through the selected sender and server identity cache; free provider reads may be needed even with stored previews. Fix tags with `publishing posts update` and matching mention_previews. queued_at records first arming; publish_at controls publication. Program drafts require UGC approval.")
|
|
862
869
|
.argument("<post_id>", "Draft or scheduled post id.")
|
|
870
|
+
.option("--all-channels", "Approve every channel of this post that still waits for approval, each through the same checks. All are checked before any is approved; rerun after a failure and approved channels are skipped.")
|
|
863
871
|
.option("--json", "Print a JSON envelope.")
|
|
864
872
|
.action(async (postId, options) => {
|
|
865
873
|
await handleAsyncAction("publishing posts approve", options, () => requestOxygen(`/api/cli/publishing/posts/${encodeURIComponent(postId)}/approve`, {
|
|
866
874
|
method: "POST",
|
|
875
|
+
...(options.allChannels ? { body: { all_channels: true } } : {}),
|
|
867
876
|
}));
|
|
868
877
|
}))
|
|
869
878
|
.addCommand(new Command("cancel")
|
|
@@ -1065,7 +1074,7 @@ export function registerPublishingFamily(program, handleAsyncAction) {
|
|
|
1065
1074
|
.addCommand(new Command("media")
|
|
1066
1075
|
.description("Manage Publishing media uploads.")
|
|
1067
1076
|
.addCommand(new Command("upload")
|
|
1068
|
-
.description("Upload a local image, video, or PDF in one step and print its media id. Attach it with --content-json '{\"media_asset_ids\":[...]}', or use
|
|
1077
|
+
.description("Upload a local image, video, or PDF in one step and print its media id. Attach it with --content-json '{\"media_asset_ids\":[...]}', or use an image as a video cover (LinkedIn, Instagram Reels) with `publishing posts update --video-thumbnail`.")
|
|
1069
1078
|
.argument("<path>", "Local file path.")
|
|
1070
1079
|
.option("--content-type <type>", "MIME type when the file extension does not say it, such as video/mp4.")
|
|
1071
1080
|
.option("--scheduled-post <post_id>", "Optional provenance association; it does not attach the file to the post.")
|
|
@@ -1214,9 +1223,9 @@ export function registerPublishingFamily(program, handleAsyncAction) {
|
|
|
1214
1223
|
}));
|
|
1215
1224
|
})))
|
|
1216
1225
|
.addCommand(new Command("analytics")
|
|
1217
|
-
.description("Stored LinkedIn and X engagement snapshots synced in the background. LinkedIn
|
|
1226
|
+
.description("Stored LinkedIn and X engagement snapshots synced in the background. LinkedIn and X include owned posts discovered from the provider, including ones made directly on the network. Reading analytics makes no provider call and uses 0 credits. A snapshotted post completed a sync pass; use per-metric coverage to see which values were populated. Null is unknown, never zero. Read freshness and guidance for delayed refresh; an unconfirmed provider read can pause it. No manual provider retry is available.")
|
|
1218
1227
|
.addCommand(new Command("summary")
|
|
1219
|
-
.description("Workspace LinkedIn or X analytics.
|
|
1228
|
+
.description("Workspace LinkedIn or X analytics. Both include owned posts discovered from the provider, including ones made directly on the network. Uses each post's latest stored snapshot; snapshotted_posts (legacy measured_posts) counts sync passes, while coverage counts non-null values. Read-only: no provider call, 0 credits.")
|
|
1220
1229
|
.option("--channel <channel>", "Channel to summarize: linkedin (default) or x.")
|
|
1221
1230
|
.option("--range <range>", "Publication window: 7d, 30d (default), 90d, or 365d.")
|
|
1222
1231
|
.option("--from <date>", "Custom inclusive UTC start date.")
|
|
@@ -1279,6 +1279,10 @@ function readSequenceSettings(options) {
|
|
|
1279
1279
|
if (options.autoEnrollTableRows !== undefined) {
|
|
1280
1280
|
settings.auto_enroll_table_rows = options.autoEnrollTableRows;
|
|
1281
1281
|
}
|
|
1282
|
+
// An Automated newsletter (sending-domain delivery only); tri-state like the above.
|
|
1283
|
+
if (options.enrollListJoins !== undefined) {
|
|
1284
|
+
settings.enroll_list_joins = options.enrollListJoins;
|
|
1285
|
+
}
|
|
1282
1286
|
// A visible footer mutates outbound copy, so it is opt-in and tri-state:
|
|
1283
1287
|
// absent leaves the stored value alone; either explicit flag persists the
|
|
1284
1288
|
// chosen boolean. Missing/false is interpreted as OFF by the dispatcher.
|
|
@@ -1534,6 +1538,7 @@ export function registerSequencesFamily(program, handleAsyncAction) {
|
|
|
1534
1538
|
.description("List saved HubSpot contact/company segments and readable identity fields available for a Sequence import. These no-bill definition reads change no members, DNC entries, rows, workflows, or enrollments.")
|
|
1535
1539
|
.argument("<sequence>", "Sequence id or slug.")
|
|
1536
1540
|
.option("--query <text>", "Optional case-insensitive words to match in the HubSpot list name.")
|
|
1541
|
+
.option("--connection <id>", "HubSpot connection id to read (one of the returned connections). Defaults to the workspace default.")
|
|
1537
1542
|
.option("--json", "Print a JSON envelope.")
|
|
1538
1543
|
.action(async (sequence, options) => {
|
|
1539
1544
|
await handleAsyncAction("sequences hubspot-list-import lists", options, () => {
|
|
@@ -1541,12 +1546,16 @@ export function registerSequencesFamily(program, handleAsyncAction) {
|
|
|
1541
1546
|
const query = readOption(options.query);
|
|
1542
1547
|
if (query)
|
|
1543
1548
|
params.set("query", query);
|
|
1549
|
+
const connection = readOption(options.connection);
|
|
1550
|
+
if (connection)
|
|
1551
|
+
params.set("connection_id", connection);
|
|
1544
1552
|
return requestOxygen(`/api/cli/sequencer/hubspot-list-import?${params.toString()}`);
|
|
1545
1553
|
});
|
|
1546
1554
|
}))
|
|
1547
1555
|
.addCommand(new Command("configure")
|
|
1548
1556
|
.description("Preview or start a scheduled HubSpot-list import. Preview first; then pass its reviewed fingerprint with --live --approved. The complete DNC list is applied before leads are read or enrolled.")
|
|
1549
1557
|
.argument("<sequence>", "Sequence id or slug.")
|
|
1558
|
+
.option("--connection <id>", "HubSpot connection id every sync cycle reads. Defaults to the workspace default.")
|
|
1550
1559
|
.requiredOption("--lead-list <id>", "Exact HubSpot ILS contact-list id whose current members should be imported.")
|
|
1551
1560
|
.requiredOption("--dnc-list <id>", "Different exact HubSpot ILS contact-list id synchronized additively into Oxygen DNC first.")
|
|
1552
1561
|
.option("--company-dnc-list <id>", "Optional HubSpot company-list id synchronized as all-channel company DNC.")
|
|
@@ -1584,6 +1593,7 @@ export function registerSequencesFamily(program, handleAsyncAction) {
|
|
|
1584
1593
|
method: "POST",
|
|
1585
1594
|
body: {
|
|
1586
1595
|
sequence,
|
|
1596
|
+
...(readOption(options.connection) ? { connection_id: readOption(options.connection) } : {}),
|
|
1587
1597
|
lead_list_id: options.leadList,
|
|
1588
1598
|
dnc_list_id: options.dncList,
|
|
1589
1599
|
...(readOption(options.companyDncList) ? { company_dnc_list_id: readOption(options.companyDncList) } : {}),
|
|
@@ -1682,6 +1692,8 @@ export function registerSequencesFamily(program, handleAsyncAction) {
|
|
|
1682
1692
|
.option("--no-exclude-contacted", "Turn the sequence-level exclude-contacted default back OFF (enrollments then exclude cross-campaign only when a call opts in).")
|
|
1683
1693
|
.option("--auto-enroll-table-rows", "Rows added to the sequence's table join it while it is active (a first launch turns this on unless it was turned off).")
|
|
1684
1694
|
.option("--no-auto-enroll-table-rows", "Keep enrollment manual: launching does not enroll the table, and new rows wait for `sequences enroll`.")
|
|
1695
|
+
.option("--enroll-list-joins", "An Automated newsletter (sending-domain delivery): people who join its subscription list from its first start on are enrolled while it is active, each person once; starting it enrolls nobody already on the list.")
|
|
1696
|
+
.option("--no-enroll-list-joins", "Stop enrolling people who join the subscription list; enrollment stays manual (`sequences enroll --from-list`).")
|
|
1685
1697
|
.option("--company-reply-pause <off|default|statuses>", "Pause the replier's company in this campaign when a reply has one of these statuses. Oxygen detects the company from work-email domains or explicit company fields; with no company identity, only the replier stops. New sequences start with this setting off. 'default' = interested,neutral,not_now,not_interested; or comma-separated Inbox status keys (`inbox labels list`); 'off' disables it. Read the saved setting with `sequences get`.")
|
|
1686
1698
|
.option("--stop-on-reply-scope <scope>", "(deprecated: use --company-reply-pause) 'company_domain' = --company-reply-pause interested,neutral,not_now,not_interested,wrong_person; 'lead' = off.")
|
|
1687
1699
|
.option("--bounce-protection <json>", "Sequence bounce policy JSON (partial updates merge): enabled=true, warning_rate=.02, pause_rate=.03, min_sends=20, window_days=7. Hard bounces / accepted sends in the rolling window; pauses this sequence, not the fleet. Rates are fractions; mailbox protection is separate.")
|
|
@@ -1832,6 +1844,8 @@ export function registerSequencesFamily(program, handleAsyncAction) {
|
|
|
1832
1844
|
.option("--no-exclude-contacted", "Turn the sequence-level exclude-contacted default back OFF (enrollments then exclude cross-campaign only when a call opts in).")
|
|
1833
1845
|
.option("--auto-enroll-table-rows", "Rows added to the sequence's table join it while it is active (a first launch turns this on unless it was turned off).")
|
|
1834
1846
|
.option("--no-auto-enroll-table-rows", "Keep enrollment manual: launching does not enroll the table, and new rows wait for `sequences enroll`.")
|
|
1847
|
+
.option("--enroll-list-joins", "An Automated newsletter (sending-domain delivery): people who join its subscription list from its first start on are enrolled while it is active, each person once; starting it enrolls nobody already on the list.")
|
|
1848
|
+
.option("--no-enroll-list-joins", "Stop enrolling people who join the subscription list; enrollment stays manual (`sequences enroll --from-list`).")
|
|
1835
1849
|
.option("--company-reply-pause <off|default|statuses>", "Pause the replier's company in this campaign when a reply has one of these statuses. Oxygen detects the company from work-email domains or explicit company fields; with no company identity, only the replier stops. New sequences start with this setting off. 'default' = interested,neutral,not_now,not_interested; or comma-separated Inbox status keys (`inbox labels list`); 'off' disables it. Read the saved setting with `sequences get`.")
|
|
1836
1850
|
.option("--stop-on-reply-scope <scope>", "(deprecated: use --company-reply-pause) 'company_domain' = --company-reply-pause interested,neutral,not_now,not_interested,wrong_person; 'lead' = off.")
|
|
1837
1851
|
.option("--bounce-protection <json>", "Sequence bounce policy JSON (partial updates merge): enabled=true, warning_rate=.02, pause_rate=.03, min_sends=20, window_days=7. Hard bounces / accepted sends in the rolling window; pauses this sequence, not the fleet. Rates are fractions; mailbox protection is separate.")
|
|
@@ -1922,7 +1936,7 @@ export function registerSequencesFamily(program, handleAsyncAction) {
|
|
|
1922
1936
|
body.email = email;
|
|
1923
1937
|
}
|
|
1924
1938
|
if (Object.keys(body).length === 0) {
|
|
1925
|
-
throw new Error("Provide at least one field to update (--name, --steps-file, --source-table, --channels, --senders, --tags, --email-*, --clear-email, --max-credits, --max-live-sends, --max-emails-per-mailbox-per-day, --schedule-* sending schedule, --send-window-file, --linkedin-* schedule, --company-reply-pause, --[no-]include-unsubscribe, --[no-]include-unsubscribe-link, --no-stop-on-bounce, --[no-]exclude-contacted, --[no-]auto-enroll-table-rows, or --[no-]tracking-opens / --[no-]tracking-clicks).");
|
|
1939
|
+
throw new Error("Provide at least one field to update (--name, --steps-file, --source-table, --channels, --senders, --tags, --email-*, --clear-email, --max-credits, --max-live-sends, --max-emails-per-mailbox-per-day, --schedule-* sending schedule, --send-window-file, --linkedin-* schedule, --company-reply-pause, --[no-]include-unsubscribe, --[no-]include-unsubscribe-link, --no-stop-on-bounce, --[no-]exclude-contacted, --[no-]auto-enroll-table-rows, --[no-]enroll-list-joins, or --[no-]tracking-opens / --[no-]tracking-clicks).");
|
|
1926
1940
|
}
|
|
1927
1941
|
return requestOxygen(`/api/cli/sequences/${encodeURIComponent(sequence)}`, {
|
|
1928
1942
|
method: "PATCH",
|
|
@@ -1715,7 +1715,7 @@ Full trigger schema: oxygen workflows schema --subject trigger --json
|
|
|
1715
1715
|
}
|
|
1716
1716
|
}))
|
|
1717
1717
|
.addCommand(new Command("mcp")
|
|
1718
|
-
.description("Expose hosted Workflows as dynamic MCP tools (oxygen_workflow_<slug>).
|
|
1718
|
+
.description("Expose hosted Workflows as dynamic MCP tools (oxygen_workflow_<slug>). To run a workflow once per table row, add a Workflow column (columns add --kind tool with definition mode workflow).")
|
|
1719
1719
|
.addCommand(new Command("enable")
|
|
1720
1720
|
.description("Publish an active workflow as a callable MCP tool so any MCP client can run it. The published tool appears to MCP clients as oxygen_workflow_<slug>.")
|
|
1721
1721
|
.argument("<workflow>", "Workflow id, slug, or name.")
|
|
@@ -75,7 +75,7 @@ export declare const PERMISSIONS: readonly [{
|
|
|
75
75
|
}, {
|
|
76
76
|
readonly id: "budgets.manage";
|
|
77
77
|
readonly label: "Set budgets and limits";
|
|
78
|
-
readonly description: "Workspace budgets, credit caps and provider rate limits.";
|
|
78
|
+
readonly description: "Workspace budgets, each person's credit limit, credit caps and provider rate limits.";
|
|
79
79
|
readonly adminOnly: true;
|
|
80
80
|
}, {
|
|
81
81
|
readonly id: "gates.manage";
|
|
@@ -93,7 +93,7 @@ export const PERMISSIONS = [
|
|
|
93
93
|
{
|
|
94
94
|
id: "budgets.manage",
|
|
95
95
|
label: "Set budgets and limits",
|
|
96
|
-
description: "Workspace budgets, credit caps and provider rate limits.",
|
|
96
|
+
description: "Workspace budgets, each person's credit limit, credit caps and provider rate limits.",
|
|
97
97
|
adminOnly: true,
|
|
98
98
|
},
|
|
99
99
|
{
|
|
@@ -44,17 +44,30 @@ export declare function isOxygenRole(value: unknown): value is OxygenRole;
|
|
|
44
44
|
* writes the `org:`-prefixed form, older rows carry the bare one.
|
|
45
45
|
*/
|
|
46
46
|
export declare const WORKSPACE_ADMIN_ROLES: readonly ["admin", "owner", "org:admin", "org:owner"];
|
|
47
|
+
/** The Clerk membership roles of a plain member, in the same two spellings. */
|
|
48
|
+
export declare const WORKSPACE_MEMBER_ROLES: readonly ["member", "org:member"];
|
|
47
49
|
export declare function isWorkspaceAdminRole(role: string | null | undefined): boolean;
|
|
50
|
+
/** The Clerk organization role that carries a workspace role. */
|
|
51
|
+
export declare function clerkRoleKey(role: WorkspaceRoleId): `org:${WorkspaceRoleId}`;
|
|
48
52
|
/**
|
|
49
|
-
* The role a membership
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
|
|
53
|
+
* The workspace role a Clerk membership role carries. No role at all reads as
|
|
54
|
+
* a member, as it always has. A role nobody mapped (a custom role created in
|
|
55
|
+
* Clerk without an entry here) reads as the most restricted role, never as a
|
|
56
|
+
* member.
|
|
57
|
+
*/
|
|
58
|
+
export declare function workspaceRoleForClerkRole(clerkRole: string | null | undefined): WorkspaceRoleId;
|
|
59
|
+
/** The restricted role a Clerk membership role carries, or null for an admin or member. */
|
|
60
|
+
export declare function oxygenRoleForClerkRole(clerkRole: string | null | undefined): OxygenRole | null;
|
|
61
|
+
/**
|
|
62
|
+
* The role a membership acts with. A restricted role held in Clerk decides.
|
|
63
|
+
* Otherwise a restriction set directly on the membership does, even over a
|
|
64
|
+
* Clerk admin, and the members route stays open to Clerk admins (see
|
|
65
|
+
* apps/web/src/lib/access/role-access.ts) so it can always be lifted. Without
|
|
66
|
+
* either, the Clerk admin or member role decides.
|
|
54
67
|
*
|
|
55
|
-
* A stored
|
|
56
|
-
* holds. If it ever does, the safe reading of a broken
|
|
57
|
-
* restricted role, never full access.
|
|
68
|
+
* A stored `oxygen_role` outside OXYGEN_ROLES cannot occur while the CHECK
|
|
69
|
+
* constraint holds. If it ever does, the safe reading of a broken value is the
|
|
70
|
+
* most restricted role, never full access.
|
|
58
71
|
*/
|
|
59
72
|
export declare function effectiveWorkspaceRole(membership: {
|
|
60
73
|
role: string | null | undefined;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
// Workspace roles (ADR 0033): named bundles of permissions.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
3
|
+
// Clerk assigns them: every role is a Clerk organization role keyed
|
|
4
|
+
// `org:<id>` (clerkRoleKey), so a member's role shows, and can be changed, in
|
|
5
|
+
// Clerk as well as in OXYGEN. This file decides what each role may do.
|
|
6
|
+
//
|
|
7
|
+
// The membership mirror keeps Clerk's key in `organization_memberships.role`
|
|
8
|
+
// and the restricted role it carries in `oxygen_role`, which role gates and
|
|
9
|
+
// SQL filters read (apps/web/src/lib/auth/membership-role-mirror.ts). A CHECK
|
|
10
|
+
// constraint pins `oxygen_role` to OXYGEN_ROLES. It can also be set directly
|
|
11
|
+
// on an admin or member: grants from before Clerk held roles, and grants made
|
|
12
|
+
// while a Clerk instance lacks the restricted roles.
|
|
8
13
|
//
|
|
9
14
|
// Adding a role: its id in OXYGEN_ROLES, a migration widening both CHECK
|
|
10
|
-
// constraints,
|
|
11
|
-
//
|
|
15
|
+
// constraints, its definition below, and its Clerk role in each instance
|
|
16
|
+
// (apps/web/scripts/setup-clerk-workspace-roles.ts). Changing what a role may
|
|
17
|
+
// do is an edit to its permission list, nothing else.
|
|
12
18
|
import { PERMISSIONS, isAdminOnlyPermission } from "./permissions.js";
|
|
13
19
|
/** The overlay values a membership can store, most capable first. */
|
|
14
20
|
export const OXYGEN_ROLES = ["rep", "viewer", "client"];
|
|
@@ -75,25 +81,56 @@ export function isOxygenRole(value) {
|
|
|
75
81
|
* writes the `org:`-prefixed form, older rows carry the bare one.
|
|
76
82
|
*/
|
|
77
83
|
export const WORKSPACE_ADMIN_ROLES = ["admin", "owner", "org:admin", "org:owner"];
|
|
84
|
+
/** The Clerk membership roles of a plain member, in the same two spellings. */
|
|
85
|
+
export const WORKSPACE_MEMBER_ROLES = ["member", "org:member"];
|
|
78
86
|
export function isWorkspaceAdminRole(role) {
|
|
79
87
|
return typeof role === "string" && WORKSPACE_ADMIN_ROLES.includes(role.toLowerCase());
|
|
80
88
|
}
|
|
89
|
+
/** The Clerk organization role that carries a workspace role. */
|
|
90
|
+
export function clerkRoleKey(role) {
|
|
91
|
+
return `org:${role}`;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The workspace role a Clerk membership role carries. No role at all reads as
|
|
95
|
+
* a member, as it always has. A role nobody mapped (a custom role created in
|
|
96
|
+
* Clerk without an entry here) reads as the most restricted role, never as a
|
|
97
|
+
* member.
|
|
98
|
+
*/
|
|
99
|
+
export function workspaceRoleForClerkRole(clerkRole) {
|
|
100
|
+
if (clerkRole === null || clerkRole === undefined)
|
|
101
|
+
return "member";
|
|
102
|
+
if (isWorkspaceAdminRole(clerkRole))
|
|
103
|
+
return "admin";
|
|
104
|
+
const normalized = clerkRole.toLowerCase();
|
|
105
|
+
if (WORKSPACE_MEMBER_ROLES.includes(normalized))
|
|
106
|
+
return "member";
|
|
107
|
+
const id = normalized.startsWith("org:") ? normalized.slice("org:".length) : normalized;
|
|
108
|
+
return isOxygenRole(id) ? id : "client";
|
|
109
|
+
}
|
|
110
|
+
/** The restricted role a Clerk membership role carries, or null for an admin or member. */
|
|
111
|
+
export function oxygenRoleForClerkRole(clerkRole) {
|
|
112
|
+
const role = workspaceRoleForClerkRole(clerkRole);
|
|
113
|
+
return isOxygenRole(role) ? role : null;
|
|
114
|
+
}
|
|
81
115
|
/**
|
|
82
|
-
* The role a membership acts with
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* apps/web/src/lib/access/role-access.ts) so
|
|
86
|
-
*
|
|
116
|
+
* The role a membership acts with. A restricted role held in Clerk decides.
|
|
117
|
+
* Otherwise a restriction set directly on the membership does, even over a
|
|
118
|
+
* Clerk admin, and the members route stays open to Clerk admins (see
|
|
119
|
+
* apps/web/src/lib/access/role-access.ts) so it can always be lifted. Without
|
|
120
|
+
* either, the Clerk admin or member role decides.
|
|
87
121
|
*
|
|
88
|
-
* A stored
|
|
89
|
-
* holds. If it ever does, the safe reading of a broken
|
|
90
|
-
* restricted role, never full access.
|
|
122
|
+
* A stored `oxygen_role` outside OXYGEN_ROLES cannot occur while the CHECK
|
|
123
|
+
* constraint holds. If it ever does, the safe reading of a broken value is the
|
|
124
|
+
* most restricted role, never full access.
|
|
91
125
|
*/
|
|
92
126
|
export function effectiveWorkspaceRole(membership) {
|
|
127
|
+
const clerkRole = workspaceRoleForClerkRole(membership.role);
|
|
128
|
+
if (isOxygenRole(clerkRole))
|
|
129
|
+
return clerkRole;
|
|
93
130
|
const overlay = membership.oxygenRole ?? null;
|
|
94
131
|
if (overlay !== null)
|
|
95
132
|
return isOxygenRole(overlay) ? overlay : "client";
|
|
96
|
-
return
|
|
133
|
+
return clerkRole;
|
|
97
134
|
}
|
|
98
135
|
/**
|
|
99
136
|
* For feature gates that know only the overlay: may this membership use a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const PUBLIC_BUDGET_SCOPES: readonly ["org", "table", "workflow_trigger", "monitor"];
|
|
1
|
+
export declare const PUBLIC_BUDGET_SCOPES: readonly ["org", "table", "workflow_trigger", "monitor", "member"];
|
|
2
2
|
export type PublicBudgetScope = (typeof PUBLIC_BUDGET_SCOPES)[number];
|
|
3
3
|
export declare function formatPublicBudgetScopes(): string;
|
|
4
|
-
export declare const PUBLIC_BUDGET_SCOPE_DESCRIPTION = "Cap scope: org (whole workspace), table (a single table), workflow_trigger (one workflow trigger),
|
|
4
|
+
export declare const PUBLIC_BUDGET_SCOPE_DESCRIPTION = "Cap scope: org (whole workspace), table (a single table), workflow_trigger (one workflow trigger), monitor (one scheduled workflow), or member (one person's own spend).";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const PUBLIC_BUDGET_SCOPES = ["org", "table", "workflow_trigger", "monitor"];
|
|
1
|
+
export const PUBLIC_BUDGET_SCOPES = ["org", "table", "workflow_trigger", "monitor", "member"];
|
|
2
2
|
export function formatPublicBudgetScopes() {
|
|
3
3
|
const scopes = [...PUBLIC_BUDGET_SCOPES];
|
|
4
4
|
const last = scopes.pop();
|
|
@@ -6,4 +6,4 @@ export function formatPublicBudgetScopes() {
|
|
|
6
6
|
return "";
|
|
7
7
|
return scopes.length === 0 ? last : `${scopes.join(", ")}, or ${last}`;
|
|
8
8
|
}
|
|
9
|
-
export const PUBLIC_BUDGET_SCOPE_DESCRIPTION = "Cap scope: org (whole workspace), table (a single table), workflow_trigger (one workflow trigger),
|
|
9
|
+
export const PUBLIC_BUDGET_SCOPE_DESCRIPTION = "Cap scope: org (whole workspace), table (a single table), workflow_trigger (one workflow trigger), monitor (one scheduled workflow), or member (one person's own spend).";
|
|
@@ -99,7 +99,7 @@ export const PLAN_GATED_CAPABILITY_COPY = {
|
|
|
99
99
|
publishing_deliver: {
|
|
100
100
|
label: "Publishing a post",
|
|
101
101
|
freeAlternative: "You can draft and review posts on Free. Approving one for delivery to a live account is what needs a plan.",
|
|
102
|
-
deepLinkPath: "/
|
|
102
|
+
deepLinkPath: "/posts",
|
|
103
103
|
},
|
|
104
104
|
managed_email_infrastructure: {
|
|
105
105
|
label: "Buying managed email infrastructure",
|