service-itsm-agentic-setup-employee-agent-configure
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate an IT Service Employee Agent (broad or specialized)
创建IT服务员工Agent(通用或专用)
Create and activate an IT Service Employee Agent as a Next-Gen Authoring (NGA) native agent — Agent-Script-based (/bundle), appearing natively in Agentforce Studio's Agents list with no external-link icon — entirely through the Salesforce CLI (). This skill does not call the legacy ; instead it reuses a shipped ITSM Employee template's field and feeds it into the NGA bundle pipeline: → → . Commands: for Connect API GET/POST; for the SOQL idempotency + verify reads.
AiAuthoringBundleDefVersf/connect/service-itsm/createAgentagentScriptPOST /nextgen-authoring/bundlesPOST /nextgen-authoring/bundle-versions/{id}/publishPOST /nextgen-authoring/bundle-versions/{id}/activatesf api request restsf data queryGET /connect/service-itsm/agent-templates?agentType=AgentforceEmployeeAgentIT Service Employeesvc_emp_intelligence__data[]agentScriptconfig.developer_nameconfig.agent_labelmasterLabelreferences/specialized-templates.mdHelper scripts (invoked via ) hold every JSON-parsing / decision rule so the model never eyeballs a response body (A9): , , (HTML-decodes + substitutes the template's and writes the body to a JSON file so large content and free-text quotes never hit an inline shell string), (deterministic report renderer).
Bashclassify-preflight.mjsclassify-agent-existence.mjsbuild-create-body.mjsagentScriptrender-report.mjsTemplate selection (before Phase 1). Resolve the this run pins: (1) no specialization named ⇒ pin (id ) — the backwards-compatible default; (2) user names a specialization ⇒ keyword-match against , single unambiguous match ⇒ pin that and derive from after (snake-cased); ambiguous ⇒ keyed on ; (3) filter to only — (Fulfiller) redirects to , other namespaces are out of scope. The resolved is the single knob passed to (Phase 1) and (Phase 4).
<masterLabel>IT Service Employeesvc_emp_intelligence__ItEmployeeAssistancereferences/specialized-templates.mdmasterLabeldeveloperNameid__AskUserQuestioniddata[]svc_emp_intelligence__svc_itsm_intelligence__*service-itsm-agentic-setup-fulfiller-agent-configure<masterLabel>classify-preflight.mjsbuild-create-body.mjsPrerequisites. Creation assumes the org-level Agentforce for IT Service prerequisites are already satisfied (Agentforce Studio access + + ). If Phase 1 detects Studio is not accessible — or if any write returns — this skill offers to delegate to (employee path) then resume; on "no", stops. This skill never enables features itself — enablement is a Setup-UI/admin action.
service-cloud-requestor-agentservice-cloud-it-service-employee-agent403 FUNCTIONALITY_NOT_ENABLEDservice-itsm-agentic-setup-agentforce-studio-validate创建并激活一个IT服务员工Agent作为下一代创作(NGA)原生Agent——基于Agent脚本(/包),在Agentforce Studio的Agent列表中以原生形式显示,无外部链接图标——全程通过**Salesforce CLI()**完成。本技能不会调用旧版接口;而是复用已发布的ITSM员工模板的字段,并将其输入到NGA包流水线中: → → 。使用的命令:用于Connect API的GET/POST请求;用于SOQL幂等性检查和验证读取。
AiAuthoringBundleDefVersf/connect/service-itsm/createAgentagentScriptPOST /nextgen-authoring/bundlesPOST /nextgen-authoring/bundle-versions/{id}/publishPOST /nextgen-authoring/bundle-versions/{id}/activatesf api request restsf data queryGET /connect/service-itsm/agent-templates?agentType=AgentforceEmployeeAgentIT Service Employeesvc_emp_intelligence__data[]agentScriptconfig.developer_nameconfig.agent_labelmasterLabelreferences/specialized-templates.md辅助脚本(通过调用)包含所有JSON解析/决策逻辑,避免模型直接解析响应体(规则A9):、、(对模板的进行HTML解码和替换,并将请求体写入JSON文件,避免大内容和自由文本引号出现在内联shell字符串中)、(确定性报告渲染器)。
Bashclassify-preflight.mjsclassify-agent-existence.mjsbuild-create-body.mjsagentScriptrender-report.mjs模板选择(第1阶段前)。确定本次运行要关联的:(1) 用户未指定专用模板 ⇒ 关联(ID为)——向后兼容的默认选项;(2) 用户指定了专用模板 ⇒ 通过进行关键词匹配,匹配结果唯一明确 ⇒ 关联该,并从ID中后的部分派生(蛇形命名);匹配结果模糊 ⇒ 触发,以ID为键进行询问;(3) 将过滤为仅包含命名空间的模板——(处理者模板)会重定向到流程,其他命名空间的模板不在本技能范围内。确定后的会传入(第1阶段)和(第4阶段)。
<masterLabel>IT Service Employeesvc_emp_intelligence__ItEmployeeAssistancereferences/specialized-templates.mdmasterLabel__developerNameAskUserQuestiondata[]svc_emp_intelligence__svc_itsm_intelligence__*service-itsm-agentic-setup-fulfiller-agent-configure<masterLabel>classify-preflight.mjsbuild-create-body.mjs前置条件。创建Agent的前提是,组织级别的Agentforce for IT Service前置条件已满足(拥有Agentforce Studio访问权限 + + 权限)。如果第1阶段检测到无法访问Studio——或任何写入操作返回——本技能会主动提议将任务委托给(员工路径),然后继续流程;若用户拒绝,则停止操作。本技能不会自行启用任何功能——功能启用属于Setup-UI/管理员操作。
service-cloud-requestor-agentservice-cloud-it-service-employee-agent403 FUNCTIONALITY_NOT_ENABLEDservice-itsm-agentic-setup-agentforce-studio-validateScope
范围
- In scope: Reading ; extracting an Employee template's Agent Script (broad default or a user-named specialization from
agent-templates— all underreferences/specialized-templates.md); creating the Employee agent as an NGA-native agent viasvc_emp_intelligence__→createBundleWithVersion→publish; SOQL-verifying live; idempotent skip on duplicate developer name — all viaactivate.sf - Out of scope: The Fulfiller agent (); enabling org-level feature toggles (validated by
service-itsm-agentic-setup-fulfiller-agent-configure); low-level topic/action authoring; perm-set assignment; content-bundle deployment; CMDB CRUD; Discovery / Service Graph; the legacyservice-itsm-agentic-setup-agentforce-studio-validateroute; anycreateAgententry outsidedata[].svc_emp_intelligence__
- 包含范围:读取;提取员工模板的Agent脚本(通用默认模板或用户指定的专用模板,均来自
agent-templates且属于references/specialized-templates.md命名空间);通过svc_emp_intelligence__→createBundleWithVersion→publish流程将员工Agent创建为NGA原生Agent;通过SOQL验证Agent是否生效;基于重复开发者名称实现幂等性跳过——所有操作均通过activate完成。sf - 排除范围:处理者Agent(流程);启用组织级功能开关(由
service-itsm-agentic-setup-fulfiller-agent-configure流程验证);低级别主题/动作创作;权限集分配;内容包部署;CMDB增删改查;Discovery/服务图谱;旧版service-itsm-agentic-setup-agentforce-studio-validate路由;createAgent中不属于data[]命名空间的任何条目。svc_emp_intelligence__
Preconditions
前置条件
If any of these are unmet, surfaces an auth error or a //; surface the raw error verbatim and stop — do not fabricate state.
sf401403404- CLI authenticated to the target org (
sfshows Connected). All calls usesf org display -o <alias>; never extract the access token by hand.--target-org <alias> - API v67.0+ — pinned in the URL path; do not hand-edit below the minimum.
- ITSM features + templates provisioned — resolved template must be present. If returns nothing or the routes 404, run
agent-templates(agent pathservice-itsm-agentic-setup-agentforce-studio-validate).employee - ≥ 18 on PATH.
node
若以下任一条件未满足,会显示认证错误或返回//;直接显示原始错误并停止操作——请勿虚构状态。
sf401403404- CLI已认证到目标组织(
sf显示已连接)。所有调用均使用sf org display -o <alias>参数;请勿手动提取访问令牌。--target-org <alias> - API版本v67.0+——在URL路径中固定指定;请勿手动修改为低于该版本。
- 已配置ITSM功能和模板——确定的模板必须存在。若接口返回空或路由返回404,请运行
agent-templates流程(员工路径)。service-itsm-agentic-setup-agentforce-studio-validate - PATH中存在≥ 18版本。
node
Operations at a glance
操作概览
| Concern | Command | Notes |
|---|---|---|
| Studio access (precondition read) | | |
| List agent templates + Agent Script (read) | | |
| Enumerate existing agent + latest version status (read) | | Keyed PRIMARILY on the template's |
| Create the NGA bundle (write) | | Body built by |
| Publish the bundle version (write) | | Returns |
| Activate the bundle version (write) | | Empty response on success; agent is now live and NGA-native |
| Activate an existing inactive version (write) | | Reactivation path only (Phase 2b) — skips create/publish |
| Verify agent is live (read) | | |
Full command shapes and the ITSM Connect API reference live in ; the reactivation-path call + idempotency verdict table live in ; the response-body error codes and recurring gotchas live in .
references/cli-invocation.mdreferences/reactivation.mdreferences/error-taxonomy.mdNever extract the access token. Use/sf api request restdirectly — they use the CLI's stored session for the target org. Do not pull thesf data queryout ofaccessTokenand hand-build an HTTP request with it; that bypasses the CLI session and leaks a bearer token into shell context.sf org display
rule.--jsontakessf data query(results come back in a--jsonenvelope — that's what the classifier expects)..result.records[]does not — omitsf api request restthere; its raw stdout body is already JSON.--json
| 关注点 | 命令 | 说明 |
|---|---|---|
| Studio访问权限(前置条件读取) | | |
| 列出Agent模板及Agent脚本(读取) | | 必须指定 |
| 枚举现有Agent及最新版本状态(读取) | | 主要基于模板的 |
| 创建NGA包(写入) | | 请求体由 |
| 发布包版本(写入) | | 返回 |
| 激活包版本(写入) | | 成功时返回空响应;此时Agent已生效且为NGA原生Agent |
| 激活现有未激活版本(写入) | | 仅用于重新激活流程(第2b阶段)——跳过创建/发布步骤 |
| 验证Agent是否生效(读取) | | |
完整的命令格式和ITSM Connect API参考可查看;重新激活流程的调用及幂等性判定表可查看;响应体错误码及常见问题可查看。
references/cli-invocation.mdreferences/reactivation.mdreferences/error-taxonomy.md请勿提取访问令牌。直接使用/sf api request rest——它们会使用CLI中存储的目标组织会话。请勿从sf data query中提取sf org display并手动构建HTTP请求;这会绕过CLI会话,并将Bearer令牌泄露到shell环境中。accessToken
规则。--json必须添加sf data query参数(结果会封装在--json中——这是分类器所需的格式)。.result.records[]无需添加该参数;其标准输出本身就是JSON格式。sf api request rest
Clarifying Questions
澄清问题
Collect from the user (ask only what is not already in conversation context):
| Field | Default |
|---|---|
| Target org | Default org ( |
Template ( | |
| Developer name | Broad: |
| Label | Broad: |
| Confirm the write | REQUIRED — present resolved template + developerName + label, then require "yes" via |
The collected , , are threaded through every call — selects the row in (which also carries the idempotency key); / are used in the body (both outer / AND the substituted internal /). The idempotency + verify reads key PRIMARILY on the template's (or, after a fresh create, the publish response's ) and fall back to the collected when that is null. A hardcode/collect mismatch on the create body diverges the bundle's outer identity from the script's internal identity.
<masterLabel><developerName><label><masterLabel>agent-templates.data[]botDefinitionId<developerName><label>createBundleWithVersionapiNamelabelconfig.developer_nameconfig.agent_labelbotDefinitionIdpublishedBotId<developerName>Idempotency: keyed PRIMARILY on the template's (Phase-1 row — the platform's authoritative template→ link) and FALLING BACK to the collected . The Phase-2 read is (the half is both the null- fallback AND the guard for a dangling Id link — one whose target was deleted — so a stale link can't slip through to create), + latest . Outcomes: no match on either key ⇒ create; ⇒ ALREADY-CREATED (skip write); ⇒ Phase-2b reactivation offer. Why both keys: the broad agent ships pre-provisioned as ≠ the guess , so catches it — but an agent this skill creates never back-fills (the create path omits ), so its template row stays null and the fallback is what catches a repeat run. The server does reject a duplicate at publish (unique-constraint → bundle cleanup), but only this read turns a repeat into a graceful skip instead of a .
botDefinitionIdagent-templatesBotDefinition<developerName>BotDefinition WHERE Id='<botDefinitionId>' OR DeveloperName='<developerName>'ORbotDefinitionIdBotDefinitionBotVersion.StatusActiveInactiveIT_Service_EmployeeIT_Service_Employee_AgentbotDefinitionIdbotDefinitionIdtemplateNamedeveloperNameDeveloperNameDUPLICATE_VALUE向用户收集以下信息(仅询问对话上下文未包含的内容):
| 字段 | 默认值 |
|---|---|
| 目标组织 | 默认组织( |
模板( | |
| 开发者名称 | 通用模板: |
| 标签 | 通用模板: |
| 确认写入操作 | 必填——展示已确定的模板、开发者名称和标签,然后通过 |
收集到的、、会贯穿所有调用——用于选择中的行(该行还包含幂等性键);/用于请求体(包括外部的/以及内部替换的/)。幂等性和验证读取主要基于模板的(或创建后发布响应中的),当该ID为空时,回退到收集到的。若创建请求体中的硬编码值与收集值不匹配,会导致包的外部标识与脚本内部标识不一致。
<masterLabel><developerName><label><masterLabel>agent-templates.data[]botDefinitionId<developerName><label>createBundleWithVersionapiNamelabelconfig.developer_nameconfig.agent_labelbotDefinitionIdpublishedBotId<developerName>幂等性:主要基于模板的(第1阶段行——平台权威的模板→链接),回退到收集到的。第2阶段的查询为(部分既是为空时的回退方案,也是针对无效ID链接(目标已删除)的防护措施,避免陈旧链接导致重复创建),同时查询最新的。结果:两个键均无匹配 ⇒ 创建;版本为Active ⇒ 已创建(跳过写入);版本为Inactive ⇒ 进入第2b阶段的重新激活提议。为何使用两个键:通用Agent预配置为,与推测的不同,因此可以捕获到它——但本技能创建的Agent不会回填(创建流程省略了),因此其模板行始终为空,此时回退方案可以捕获重复运行。服务器会在发布时拒绝重复的(唯一约束→包清理),但只有该查询能将重复运行转换为优雅的跳过,而非错误。
botDefinitionIdagent-templatesBotDefinition<developerName>BotDefinition WHERE Id='<botDefinitionId>' OR DeveloperName='<developerName>'ORbotDefinitionIdBotDefinitionBotVersion.StatusIT_Service_EmployeeIT_Service_Employee_AgentbotDefinitionIdbotDefinitionIdtemplateNamedeveloperNameDeveloperNameDUPLICATE_VALUEWorkflow
工作流程
Substitute with the collected target org and / with the collected values. Full command shapes + per-phase verdict-branch handling live in — the phase summary below names each step and its load-bearing rule; the reference file holds the exact / invocations to copy.
<alias><developerName><label>references/workflow-detail.mdsfnode- Phase 0 — Establish . Before any phase writes a transient JSON file, invoke the deterministic helper (path is skill-root-qualified so it resolves regardless of the shell's CWD):
${SCRATCH_DIR}. The helper picks the base dir (SCRATCH_DIR="$(node "<skill_dir>/scripts/create-scratch-dir.mjs" "${outputDir:-}")", else${TMPDIR}, else the harness/tmplast-resort — scratch stays OUT of the scored${outputDir}tree) and emits the created dir's absolute path on stdout. Every subsequent phase writes its transient JSON under${outputDir}; the durable${SCRATCH_DIR}stays under the harness dir.${outputDir}/report.md - Phase 1 — Preflight. Capture the Studio-access read + read (with the required
agent-templatesquery param), then classify viaagentType=AgentforceEmployeeAgent— pass the resolvedscripts/classify-preflight.mjs "<masterLabel>"(<masterLabel>for the broad path or the picked specialization's"IT Service Employee"). The classifier also emitsmasterLabelfrom the matched row — capture it; it is the primary Phase-2 idempotency key (the collectedtemplate.botDefinitionIdis the fallback key). Branch on<developerName>:verdict⇒ Phase 2;READY⇒ prerequisite hand-off viaNOT-READY(delegate toAskUserQuestionemployee path on "yes");service-itsm-agentic-setup-agentforce-studio-validate⇒ surface + stop;ERROR(confirmed 404) does not block.studio.signal="CANNOT-CONFIRM" - Phase 2 — Idempotency (primary key , fallback key
botDefinitionId). Take<developerName>from Phase 1. Present ⇒ SOQLtemplate.botDefinitionId(+BotDefinition WHERE Id='<botDefinitionId>' OR DeveloperName='<developerName>'subquery — required, elseBotVersionsis permanently false; theneedsActivationclause makes a dangling Id link — deleted target — fall back to the live same-name agent instead of a falseOR→ duplicate create). Empty/null ⇒ do NOT skip to create; fall back toexists:false(a self-created agent's template row is never back-filled, so itsWHERE DeveloperName='<developerName>'stays null even though the agent exists). Either way classify viabotDefinitionId. Branch:scripts/classify-agent-existence.mjs ${SCRATCH_DIR}/bot-existing.json "<botDefinitionId-or-empty>" "<developerName>"⇒ Phase 3 (create);exists:false+exists:true⇒ ALREADY-CREATED (skip to Phase 7);needsActivation:false+exists:true⇒ Phase 2b. Non-zero exit ⇒ surface CLI error; never assume absent. Why both keys:needsActivation:truecatches the pre-provisionedbotDefinitionId(≠ the guessIT_Service_Employee); theIT_Service_Employee_Agentfallback catches self-created repeats — a miss on both re-creates and hitsdeveloperName.DUPLICATE_VALUE - Phase 2b — Reactivation offer. : "Employee agent
AskUserQuestionexists but latest version is Inactive. Activate it?". On Yes:<developerName>withPOST /connect/bot-versions/<latestVersionId>/activation— skips Phases 3–6, straight to Phase 7. Aggregate verdict is ACTIVATED, not CREATED. On No: stop, no writes.{"status":"Active"} - Phase 3 — Confirm-to-Write (REQUIRED, create path only). If was provided, first render the checkpoint file via
${outputDir}withrender-report.mjs(skip for interactive runs). THEN raise theverdict:"PENDING CONFIRMATION"gate presenting developerName + label + "NGA-native from the Employee template's Agent Script". Proceed only on explicit "yes"; on "no" (including "hold off on activation" / "not yet" / any decline of the atomic chain), re-render withAskUserQuestionand a one-lineverdict:"DECLINED".reason - Phase 4 — Create. (helper re-reads Phase-1 templates JSON, HTML-decodes the matched
scripts/build-create-body.mjs ${SCRATCH_DIR}/agent-templates.json "<masterLabel>" "<developerName>" "<label>" ${SCRATCH_DIR}/create-bundle-body.json, substitutes internalagentScript/config.developer_name, writes body to file — pass the sameconfig.agent_labelused in Phase 1), then<masterLabel>. Capture responsePOST /nextgen-authoring/bundles --body @${SCRATCH_DIR}/create-bundle-body.json— that is theidfor Phases 5–6, notbundleVersionId.bundleId/403 FUNCTIONALITY_NOT_ENABLED⇒ trigger the Phase-1 hand-off; build-script exit 3 ⇒ surface stderr.404 - Phase 5 — Publish. (empty body required). Success:
POST /nextgen-authoring/bundle-versions/<bundleVersionId>/publish --body '{}'— this call creates the underlying{ lastPublishedOn, publishedBotId, publishedBotVersionId }/BotDefinition. Any error ⇒ surface verbatim; never activate an unpublished version.BotVersion - Phase 6 — Activate. . Success returns an empty body — check exit code, do not parse a payload.
POST /nextgen-authoring/bundle-versions/<bundleVersionId>/activate --body '{}' - Phase 7 — Verify. SOQL (+
BotDefinition WHERE Id='<id>'subquery) and classify —BotVersionsis the create path's<id>(captured from Phase 5) or, on the ALREADY-CREATED / reactivation path, the live matched Id the Phase-2 classifier returned (itspublishedBotId/botDefinitionIdoutput — the actualagentIdof the matched record), not the Phase-1 templateBotDefinition.Id(which is null on abotDefinitionIdfallback hit → the verify would runmatchedBy:"developerName"and falsely report failure after a successful skip/activation). ConfirmWHERE Id=''. Any discrepancy ⇒ report verbatim, do not fabricate success.exists:true, count:1, latestVersionStatus:"Active" - Phase 8 — Aggregate verdict. Emit CREATED / ALREADY-CREATED / ACTIVATED / FAILED (ACTIVATED on the Phase-2b path) + Id / bundle
BotDefinitionby re-invokingid— the single source of report text. Ifrender-report.mjswas provided, overwrite${outputDir}; otherwise emit stdout as the turn-side report.${outputDir}/report.md
将替换为收集到的目标组织,/替换为收集到的值。完整的命令格式及各阶段判定分支处理可查看——以下阶段摘要列出了每个步骤及其核心规则;参考文件包含可直接复制的精确/调用命令。
<alias><developerName><label>references/workflow-detail.mdsfnode- 第0阶段——创建。在任何阶段写入临时JSON文件前,调用确定性辅助脚本(路径为技能根目录相对路径,确保无论shell的当前工作目录如何都能解析):
${SCRATCH_DIR}。该辅助脚本会选择基础目录(优先SCRATCH_DIR="$(node "<skill_dir>/scripts/create-scratch-dir.mjs" "${outputDir:-}")",其次${TMPDIR},最后是测试工具的/tmp作为备选——临时目录不会包含在计分的${outputDir}目录树中),并在标准输出中输出创建的目录绝对路径。后续所有阶段的临时JSON文件均写入${outputDir};持久化的${SCRATCH_DIR}保留在测试工具目录中。${outputDir}/report.md - 第1阶段——预检。获取Studio访问权限读取结果 + 读取结果(必须包含
agent-templates查询参数),然后通过agentType=AgentforceEmployeeAgent进行分类——传入已确定的scripts/classify-preflight.mjs "<masterLabel>"(通用流程为<masterLabel>,专用流程为所选模板的"IT Service Employee")。分类器还会输出匹配行的masterLabel——请捕获该值;它是第2阶段的主要幂等性键(收集到的template.botDefinitionId为回退键)。根据<developerName>分支:verdict⇒ 进入第2阶段;READY⇒ 通过NOT-READY提议委托处理前置条件(用户回复"yes"则委托给AskUserQuestion员工路径);service-itsm-agentic-setup-agentforce-studio-validate⇒ 显示错误并停止;ERROR(已确认404)不会阻止流程。studio.signal="CANNOT-CONFIRM" - 第2阶段——幂等性检查(主键为,回退键为
botDefinitionId)。使用第1阶段获取的<developerName>。该值存在 ⇒ 执行SOQL查询template.botDefinitionId(必须包含BotDefinition WHERE Id='<botDefinitionId>' OR DeveloperName='<developerName>'子查询,否则BotVersions始终为false;needsActivation子句使无效ID链接(目标已删除)回退到同名的现有Agent,而非错误地判定OR→重复创建)。该值为空/不存在 ⇒ 请勿直接跳转到创建流程;回退到exists:false查询(本技能创建的Agent的模板行永远不会回填,因此即使Agent存在,其WHERE DeveloperName='<developerName>'仍为空)。无论哪种情况,均通过botDefinitionId进行分类。分支:scripts/classify-agent-existence.mjs ${SCRATCH_DIR}/bot-existing.json "<botDefinitionId-or-empty>" "<developerName>"⇒ 进入第3阶段(创建);exists:false+exists:true⇒ 已创建(跳转到第7阶段);needsActivation:false+exists:true⇒ 进入第2b阶段。若脚本非零退出 ⇒ 显示CLI错误;请勿假设Agent不存在。为何使用两个键:needsActivation:true可以捕获预配置的botDefinitionId(与推测的IT_Service_Employee不同);IT_Service_Employee_Agent回退方案可以捕获本技能创建的重复Agent——若两个键均未匹配,则会重新创建并触发developerName错误。DUPLICATE_VALUE - 第2b阶段——重新激活提议。触发:"员工Agent
AskUserQuestion已存在,但最新版本为未激活状态。是否激活它?"。用户回复是:执行<developerName>请求,请求体为POST /connect/bot-versions/<latestVersionId>/activation——跳过第3-6阶段,直接进入第7阶段。最终判定为已激活,而非已创建。用户回复否:停止操作,不执行任何写入。{"status":"Active"} - 第3阶段——确认写入(必填,仅创建流程)。若提供了,首先通过
${outputDir}渲染检查点文件,render-report.mjs设为verdict(交互式运行可跳过)。然后触发"PENDING CONFIRMATION",展示开发者名称、标签以及"基于员工模板的Agent脚本创建NGA原生Agent"的信息。仅当用户明确回复"yes"时才继续;若用户回复"no"(包括"暂不激活"/"还没准备好"/任何拒绝原子流程的回复),则重新渲染报告,AskUserQuestion设为verdict并添加一行原因说明。"DECLINED" - 第4阶段——创建。执行(辅助脚本会重新读取第1阶段的模板JSON,对匹配的
scripts/build-create-body.mjs ${SCRATCH_DIR}/agent-templates.json "<masterLabel>" "<developerName>" "<label>" ${SCRATCH_DIR}/create-bundle-body.json进行HTML解码,替换内部的agentScript/config.developer_name,并将请求体写入文件——传入与第1阶段相同的config.agent_label),然后执行<masterLabel>请求。捕获响应中的POST /nextgen-authoring/bundles --body @${SCRATCH_DIR}/create-bundle-body.json——该值为第5-6阶段使用的id,而非bundleVersionId。若返回bundleId/403 FUNCTIONALITY_NOT_ENABLED⇒ 触发第1阶段的委托处理;若构建脚本退出码为3 ⇒ 显示标准错误输出。404 - 第5阶段——发布。执行请求(必须传入空请求体)。成功时返回:
POST /nextgen-authoring/bundle-versions/<bundleVersionId>/publish --body '{}'——该调用会创建底层的{ lastPublishedOn, publishedBotId, publishedBotVersionId }/BotDefinition。若出现任何错误 ⇒ 直接显示原始错误;请勿激活未发布的版本。BotVersion - 第6阶段——激活。执行请求。成功时返回空响应——请检查退出码,无需解析响应体。
POST /nextgen-authoring/bundle-versions/<bundleVersionId>/activate --body '{}' - 第7阶段——验证。执行SOQL查询(包含
BotDefinition WHERE Id='<id>'子查询)并进行分类——BotVersions为创建流程中的<id>(第5阶段捕获),或已创建/重新激活流程中第2阶段分类器返回的匹配ID(其publishedBotId/botDefinitionId输出——匹配记录的实际agentId),请勿使用第1阶段模板的BotDefinition.Id(当匹配方式为botDefinitionId时,该ID为空,会导致验证查询matchedBy:"developerName"并错误报告成功跳过/激活后的失败)。确认WHERE Id=''。若出现任何差异 ⇒ 直接报告原始信息,请勿虚构成功状态。exists:true, count:1, latestVersionStatus:"Active" - 第8阶段——汇总判定。通过重新调用输出CREATED / ALREADY-CREATED / ACTIVATED / FAILED(第2b阶段流程输出ACTIVATED) +
render-report.mjsID / 包BotDefinition——该脚本是报告文本的唯一来源。若提供了id,则覆盖${outputDir};否则在标准输出中显示报告内容。${outputDir}/report.md
Rules / Constraints
规则/约束
| Constraint | Rationale |
|---|---|
All calls go through | Leaks a bearer token into shell context; the CLI's stored session is the correct surface |
Idempotency + verify reads key PRIMARILY on the template's | |
Preflight, idempotency, bundle-body construction, and report rendering all live in | JSON parsing + |
Three-call sequence: | Platform enforces DRAFT → published → active; response-body / empty-body / |
Resolve | Label-similar pairs exist; other namespaces belong to other flows ( |
Enumerate | Subquery is what distinguishes Active/Inactive; the server rejects a duplicate |
| REQUIRED confirm-to-write checkpoint before create sequence or reactivation call | Both change live org state — explicit user approval required |
On | Enablement is a Setup-UI/admin action; |
| Report exact CLI response text on any error | Enables support to diagnose failures |
| 约束 | 理由 |
|---|---|
所有调用均通过 | 避免将Bearer令牌泄露到shell环境中;CLI存储的会话是正确的操作入口 |
幂等性和验证读取主要基于模板的 | |
预检、幂等性检查、包请求体构建和报告渲染均通过 | JSON解析 + |
三步调用流程: | 平台要求必须遵循草稿→已发布→已激活的流程;响应体/空响应/ |
在第1阶段前确定 | 存在标签相似的模板对;其他命名空间的模板属于其他流程( |
枚举 | 子查询是区分Active/Inactive的关键;服务器会在发布时拒绝重复的 |
| 必填的写入确认检查点,位于创建流程或重新激活调用之前 | 两种操作都会修改组织的实时状态——需要用户明确批准 |
当 | 功能启用属于Setup-UI/管理员操作; |
| 任何错误均报告精确的CLI响应文本 | 便于支持人员诊断故障 |
Verification Checklist
验证 checklist
- Resolved before Phase 1 (broad default or specialization from
<masterLabel>,references/specialized-templates.mdfiltered todata[], disambiguated onsvc_emp_intelligence__).id - Preflight classified by (PASS or documented CANNOT-CONFIRM); hand-off offered on FAIL; raw error surfaced on ERROR.
classify-preflight.mjs - Idempotency keyed on the template's (Phase-1 row) with the collected developerName as fallback;
botDefinitionId(theBotDefinition WHERE Id='<botDefinitionId>' OR DeveloperName='<developerName>'covers both a null and a danglingOR) + latestbotDefinitionId(subquery present) read + classified before any write.BotVersion.Status - If , Phase-2b reactivation offer presented — no silent skip, no duplicate create.
needsActivation:true - Explicit user confirmation at Phase 3 (create) or Phase 2b (reactivation) before any write.
- Bundle body built by , POSTed via
build-create-body.mjswith the collected--body @<file>/developerName; or write correctly skipped.label - Same (response
bundleVersionId) used for publish + activate; reactivation usedid; legacyPOST /connect/bot-versions/<id>/activationnever called.createAgent - Phase-7 verify confirmed present + latest version Active.
BotDefinition - Access token never extracted; final verdict + /bundle Id reported.
BotDefinition
- 在第1阶段前已确定(通用默认模板或来自
<masterLabel>的专用模板,references/specialized-templates.md已过滤为data[]命名空间,已基于ID进行消歧)。svc_emp_intelligence__ - 预检已通过分类(通过或记录为CANNOT-CONFIRM);失败时提议委托处理;错误时显示原始错误。
classify-preflight.mjs - 幂等性检查基于模板的(第1阶段行),收集到的开发者名称为回退键;已执行
botDefinitionId查询(BotDefinition WHERE Id='<botDefinitionId>' OR DeveloperName='<developerName>'覆盖了OR为空和无效的情况) + 最新botDefinitionId(包含子查询)读取并分类,然后才执行任何写入操作。BotVersion.Status - 若,已展示第2b阶段的重新激活提议——未静默跳过,未重复创建。
needsActivation:true - 在创建流程的第3阶段或重新激活流程的第2b阶段,已获得用户明确确认,然后才执行任何写入操作。
- 包请求体由构建,通过
build-create-body.mjs传入收集到的--body @<file>/developerName;或已正确跳过写入操作。label - 发布和激活使用同一个(响应中的
bundleVersionId);重新激活使用id接口;未调用旧版POST /connect/bot-versions/<id>/activation接口。createAgent - 第7阶段的验证已确认存在且最新版本为Active。
BotDefinition - 未提取访问令牌;已报告最终判定 + /包ID。
BotDefinition
Output Format
输出格式
The report layout is generated deterministically by — the single source of report text for both the chat turn and the harness's . Never hand-compose the layout in prose (A9); always shell out to the helper. Full rendered shape, report-state JSON schema, and checkpoint-write rules live in .
scripts/render-report.mjs${outputDir}/report.mdreferences/report-format.mdTerminal verdicts: . When is set, write at Phase 2, Phase 6 (or Phase 2b), and Phase 8 — each write overwrites the same file. Skip these writes in interactive/chat surfaces.
CREATED | ALREADY-CREATED | ACTIVATED | PENDING CONFIRMATION | DECLINED | FAILED${outputDir}报告布局由确定性生成——该脚本是聊天对话和测试工具的报告文本唯一来源。请勿手动编写报告布局(规则A9);始终通过shell调用辅助脚本。完整的渲染格式、报告状态JSON schema和检查点写入规则可查看。
scripts/render-report.mjs${outputDir}/report.mdreferences/report-format.md最终判定:。当设置时,在第2阶段、第6阶段(或第2b阶段)和第8阶段写入报告——每次写入都会覆盖同一文件。交互式/聊天场景可跳过这些写入操作。
CREATED | ALREADY-CREATED | ACTIVATED | PENDING CONFIRMATION | DECLINED | FAILED${outputDir}Reference File Index
参考文件索引
- — catalog + namespace filter +
references/specialized-templates.md-based disambiguation (before Phase 1 on any specialization).id - — exact
references/workflow-detail.md/sfcommands + full verdict-branch narrative per phase.node - — command shapes, never-extract-token rule, ITSM Connect API reference, helper-script contracts.
references/cli-invocation.md - — Phase-2b activation call + full idempotency verdict table.
references/reactivation.md - — rendered shape, phase-state JSON schema, three-checkpoint write policy.
references/report-format.md - — response-body error codes + recurring foot-guns (any non-2xx / empty body / script non-zero exit).
references/error-taxonomy.md
- ——模板目录 + 命名空间过滤规则 + 基于ID的消歧规则(适用于任何专用模板的第1阶段前)。
references/specialized-templates.md - ——精确的
references/workflow-detail.md/sf命令 + 各阶段完整的判定分支说明。node - ——命令格式、禁止提取令牌规则、ITSM Connect API参考、辅助脚本契约。
references/cli-invocation.md - ——第2b阶段的激活调用 + 完整的幂等性判定表。
references/reactivation.md - ——渲染格式、阶段状态JSON schema、三检查点写入策略。
references/report-format.md - ——响应体错误码 + 常见陷阱(任何非2xx响应/空响应/脚本非零退出)。
references/error-taxonomy.md