forcedotcom/sf-skills / plugins/builder/service-itsm/skills/service-itsm-agentic-setup-agent-runtime-access-assign
service-itsm-agentic-setup-agent-runtime-access-assign
VerifiedGrant a user the runtime permissions an activated ITSM agent's actions need so the actions do not fail on permission errors. After a Fulfiller or Employee agent is activated, this skill detects which platform feature permission sets are provisioned (Prompt Templates, Data Cloud, Unified Catalog), lets you pick a tier (user/agent vs admin) per feature and which user(s) to assign, then assigns them (license first when license-gated). It also creates a custom "Agent Access" permission set granting the activated agents you choose and assigns it to the user — all via the Salesforce CLI. Use to grant a user access to an activated agent, to assign prompt-template, data-cloud, or unified-catalog access, or to create an Agent Access permission set. DO NOT TRIGGER for enabling Agentforce for IT Service toggles, creating or activating an agent, the Fulfiller activation action-surfacing gap (service-itsm-agentic-setup-itsm-agentforce-permset-assign), CMDB access, or generic permission-set assignment.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 21.4 KB |
| references/cli-invocation.md | markdown | 9.7 KB |
| references/helper-contracts.md | markdown | 10.6 KB |
| references/permset-topology.md | markdown | 7.4 KB |
| scripts/classify-activated-agents.mjsexecutable | script | 4.3 KB |
| scripts/classify-agent-access-state.mjsexecutable | script | 5.4 KB |
| scripts/classify-assignment-state.mjsexecutable | script | 4.7 KB |
| scripts/classify-platform-permset-availability.mjsexecutable | script | 6.3 KB |
| scripts/gate-unified-catalog-tiers.mjsexecutable | script | 4.7 KB |
| scripts/rank-candidate-users.mjsexecutable | script | 4.7 KB |
| scripts/resolve-target-user.mjsexecutable | script | 3.0 KB |
scripts/classify-activated-agents.mjs
View on GitHub#!/usr/bin/env node
// Deterministic classifier for the ACTIVATED agents a user needs access to.
//
// Reads ONE input:
// - BotDefinition query capture (from `sf data query --json`) shaped as:
// SELECT Id, DeveloperName, MasterLabel,
// (SELECT Status FROM BotVersions WHERE Status='Active')
// FROM BotDefinition WHERE Type='InternalCopilot'
// Every NGA / Agentforce agent is a BotDefinition with Type='InternalCopilot';
// an agent is ACTIVATED iff it has at least one BotVersion with Status='Active'
// (the child subquery returns ≥1 record).
//
// The Agent Access custom permset should grant access ONLY to activated agents,
// so this classifier separates activated from inactive and hands the caller the
// activated set to present for a multi-select.
//
// Usage:
// node classify-activated-agents.mjs <bot-definitions.json>
//
// Emits a single JSON object to stdout:
// { agents: [ { Id, DeveloperName, MasterLabel, active } ],
// activatedAgents: [ { Id, DeveloperName, MasterLabel } ],
// inactiveAgents: [ { Id, DeveloperName, MasterLabel } ],
// verdict: "AGENTS-FOUND" | "NONE-ACTIVE" | "CANNOT-CONFIRM",
// reasons: [...] }
// Exit is always 0 on parseable bodies; verdict carries the decision. Exit 2 on
// missing argv.
import { readFileSync } from 'node:fs';
function readEnvelope(path) {
try {
const text = readFileSync(path, 'utf8').trim();
if (!text) return { ok: false, reason: `empty file: ${path}` };
const data = JSON.parse(text);
if (!data || typeof data !== 'object') return { ok: false, reason: `non-object JSON at ${path}` };
if (typeof data.status === 'number' && data.status !== 0) {
return { ok: false, reason: `sf data query at ${path} failed with status ${data.status}` };
}
const records = Array.isArray(data.result?.records) ? data.result.records : null;
if (!records) return { ok: false, reason: `missing result.records[] at ${path}` };
return { ok: true, records };
} catch (e) {
return { ok: false, reason: `unreadable/invalid JSON at ${path}: ${e?.message ?? e}` };
}
}
const [botPath] = process.argv.slice(2);
if (!botPath) {
process.stderr.write('usage: node classify-activated-agents.mjs <bot-definitions.json>\n');
process.exit(2);
}
const bots = readEnvelope(botPath);
if (!bots.ok) {
process.stdout.write(JSON.stringify({
agents: [], activatedAgents: [], inactiveAgents: [],
verdict: 'CANNOT-CONFIRM',
reasons: [bots.reason],
}, null, 2) + '\n');
process.exit(0);
}
// A child-relationship subquery surfaces as a nested { totalSize, records:[...] }
// object, or null when there are no matching children.
function activeVersionCount(r) {
const bv = r?.BotVersions;
if (!bv) return 0;
if (Array.isArray(bv.records)) return bv.records.length;
if (typeof bv.totalSize === 'number') return bv.totalSize;
return 0;
}
const agents = bots.records
.filter((r) => r && typeof r.Id === 'string')
.map((r) => ({
Id: r.Id,
DeveloperName: r.DeveloperName ?? null,
MasterLabel: r.MasterLabel ?? null,
active: activeVersionCount(r) > 0,
}));
const activatedAgents = agents.filter((a) => a.active).map(({ active, ...rest }) => rest);
const inactiveAgents = agents.filter((a) => !a.active).map(({ active, ...rest }) => rest);
const reasons = [];
let verdict;
if (activatedAgents.length > 0) {
verdict = 'AGENTS-FOUND';
reasons.push(`Found ${activatedAgents.length} activated agent(s): ${activatedAgents.map((a) => a.MasterLabel ?? a.DeveloperName).join(', ')}.`);
if (inactiveAgents.length > 0) {
reasons.push(`Excluded ${inactiveAgents.length} agent(s) with no active version (not activated yet): ${inactiveAgents.map((a) => a.MasterLabel ?? a.DeveloperName).join(', ')}.`);
}
reasons.push('Present the activated agents for a multi-select — the Agent Access permset gets one SetupEntityAccess grant per chosen agent.');
} else {
verdict = 'NONE-ACTIVE';
if (agents.length === 0) {
reasons.push('No InternalCopilot agents exist on this org — there is nothing for the Agent Access permset to grant. Create + activate an agent first.');
} else {
reasons.push(`${agents.length} InternalCopilot agent(s) exist but none has an active version — activate an agent before granting access.`);
}
}
process.stdout.write(JSON.stringify({
agents, activatedAgents, inactiveAgents, verdict, reasons,
}, null, 2) + '\n');
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |