Skip to content

forcedotcom/sf-skills / plugins/builder/service-omni/skills/service-omni-presence-user-config-deploy

service-omni-presence-user-config-deploy

Verified

Use to deploy an Omni PresenceUserConfig (presence configuration) as one whole-record Metadata write with the decline/ACW fields set consistently: Auto-Accept off, Decline on, Decline Reason on (with a PresenceDeclineReason deployed in the same package), and an After-Conversation-Work wrap-up timer. Agents are assigned by username. Idempotent via the Metadata API files[].state signal. Triggers: create presence configuration, enable decline + decline reason + ACW wrap-up timer for agents, assign presence config to users. Do not use for ServicePresenceStatus (separate skill), for permission-set access to statuses, or to set the channel-level ACW timer on a ServiceChannel.

FileKindSize
SKILL.mdskill md5.5 KB
references/api-notes.mdmarkdown3.0 KB
scripts/deploy-and-report.shexecutablescript12.6 KB
scripts/tests/_bootstrap.pyscript4.3 KB
scripts/tests/test_presence_user_config_contracts.pyexecutablescript5.9 KB

scripts/tests/test_presence_user_config_contracts.py

View on GitHub
#!/usr/bin/env python3
"""Contract tests for service-omni-presence-user-config-deploy/scripts/deploy-and-report.sh."""
from __future__ import annotations

import json
import sys
import unittest
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parent))
from _bootstrap import (  # noqa: E402
    FakeSf,
    _FAKE_SF_PROD,
    _FAKE_SF_SANDBOX,
    run,
)


def _last_json(out: str) -> dict:
    dec = json.JSONDecoder()
    obj, i, n = None, 0, len(out)
    while i < n:
        if out[i] in "{[":
            try:
                cand, end = dec.raw_decode(out, i)
                if isinstance(cand, dict):
                    obj = cand
                i = end
                continue
            except json.JSONDecodeError:
                pass
        i += 1
    assert obj is not None, f"no JSON object found in output:\n{out}"
    return obj


class InputContractTests(unittest.TestCase):
    def test_missing_args_rejected(self):
        rc, out = run([], scrub_sf=True)
        self.assertEqual(rc, 1, out)
        self.assertIn("Usage", out)

    def test_injection_shaped_config_name_rejected(self):
        rc, out = run(["org", "Bad Name; DROP"], scrub_sf=True)
        self.assertEqual(rc, 1, out)
        self.assertIn("Invalid config_developer_name", out)

    def test_capacity_out_of_range_rejected(self):
        rc, out = run(["org", "Omni_Demo_Presence_Config"], scrub_sf=True,
                      extra_env={"CAPACITY": "0"})
        self.assertEqual(rc, 1, out)
        self.assertIn("Invalid CAPACITY", out)

    def test_acw_out_of_range_rejected(self):
        rc, out = run(["org", "Omni_Demo_Presence_Config"], scrub_sf=True,
                      extra_env={"ACW_SECONDS": "5"})
        self.assertEqual(rc, 1, out)
        self.assertIn("Invalid ACW_SECONDS", out)


class ProductionGuardTests(unittest.TestCase):
    def test_refuses_production_org(self):
        with FakeSf(_FAKE_SF_PROD) as p:
            rc, out = run(["prodorg"], path_prefix=p)
        self.assertEqual(rc, 1, out)
        v = _last_json(out)
        self.assertEqual(v["status"], "blocked", out)
        self.assertIn("production", v["blocking_issue"].lower())


class DeployTests(unittest.TestCase):
    def test_created_reports_states_and_assignments(self):
        with FakeSf(_FAKE_SF_SANDBOX) as p:
            rc, out = run(["sandbox", "Omni_Demo_Presence_Config", "agent1@example.com,agent2@example.com"],
                          path_prefix=p, extra_env={"FAKE_STATE_DR": "Created", "FAKE_STATE_PUC": "Created"})
        self.assertEqual(rc, 0, out)
        v = _last_json(out)
        self.assertEqual(v["status"], "created", out)
        self.assertEqual(v["config"]["state"], "Created", out)
        self.assertEqual(v["decline_reason"]["state"], "Created", out)
        self.assertEqual(v["config"]["acw_seconds"], 60, out)
        self.assertIn("agent1@example.com", v["assigned_usernames"], out)
        self.assertIn("agent2@example.com", v["assigned_usernames"], out)

    def test_reused_when_both_unchanged(self):
        with FakeSf(_FAKE_SF_SANDBOX) as p:
            rc, out = run(["sandbox"], path_prefix=p,
                          extra_env={"FAKE_STATE_DR": "Unchanged", "FAKE_STATE_PUC": "Unchanged"})
        self.assertEqual(rc, 0, out)
        v = _last_json(out)
        self.assertEqual(v["status"], "reused", out)

    def test_updated_when_config_changed(self):
        with FakeSf(_FAKE_SF_SANDBOX) as p:
            rc, out = run(["sandbox"], path_prefix=p,
                          extra_env={"FAKE_STATE_DR": "Unchanged", "FAKE_STATE_PUC": "Changed"})
        self.assertEqual(rc, 0, out)
        v = _last_json(out)
        self.assertEqual(v["status"], "updated", out)

    def test_deploy_failure_points_at_base_settings(self):
        with FakeSf(_FAKE_SF_SANDBOX) as p:
            rc, out = run(["sandbox"], path_prefix=p, extra_env={"FAKE_DEPLOY_FAIL": "1"})
        self.assertEqual(rc, 1, out)
        v = _last_json(out)
        self.assertEqual(v["status"], "blocked", out)
        self.assertTrue(any(a.get("target_skill") == "service-omni-base-settings-configure"
                            for a in v["manual_actions"]), out)

    def test_empty_status_on_decline_does_not_swallow_unrelated_failure(self):
        # Regression (blocker 3): with PRESENCE_STATUS_ON_DECLINE="" the presence-status case arm was
        # effectively `*""*`, matching EVERY failure and misreporting an unrelated deploy error as a
        # missing presence status. An unrelated failure must now surface as the generic message.
        with FakeSf(_FAKE_SF_SANDBOX) as p:
            rc, out = run(["sandbox"], path_prefix=p, extra_env={
                "FAKE_DEPLOY_FAIL": "1",
                "FAKE_DEPLOY_PROBLEM": "FIELD_CUSTOM_VALIDATION_EXCEPTION: unrelated failure",
                "PRESENCE_STATUS_ON_DECLINE": "",
            })
        self.assertEqual(rc, 1, out)
        v = _last_json(out)
        self.assertEqual(v["status"], "blocked", out)
        self.assertIn("FIELD_CUSTOM_VALIDATION_EXCEPTION", v["blocking_issue"], out)
        self.assertNotIn("presenceStatusOnDecline", v["blocking_issue"], out)
        self.assertFalse(any(a.get("target_skill") == "service-omni-presence-status-deploy"
                             for a in v.get("manual_actions", [])), out)

    def test_plan_only_reports_without_deploying(self):
        with FakeSf(_FAKE_SF_SANDBOX) as p:
            calllog = str(Path(p) / "calls.log")
            rc, out = run(["sandbox", "Omni_Demo_Presence_Config", "agent1@example.com"],
                          path_prefix=p, extra_env={"PLAN_ONLY": "1", "FAKE_SF_CALLLOG": calllog})
            log = Path(calllog).read_text() if Path(calllog).exists() else ""
        self.assertEqual(rc, 0, out)
        v = _last_json(out)
        self.assertTrue(v.get("plan_mode"), out)
        self.assertEqual(v["status"], "action_needed", out)
        self.assertNotIn("project deploy", log, "plan mode must not deploy")


if __name__ == "__main__":
    unittest.main(verbosity=2)
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall