grix-connector 4.2.3 → 4.2.5

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.
Files changed (31) hide show
  1. package/dist/adapter/claude/claude-adapter.js +18 -17
  2. package/dist/assets/dsh-bridge/grix-dsh-bridge-4.2.5.tgz +0 -0
  3. package/dist/assets/dsh-bridge/manifest.json +6 -6
  4. package/dist/core/mcp/tools.js +1 -1
  5. package/dist/default-skills/grix-access-control/SKILL.md +1 -1
  6. package/dist/default-skills/grix-admin/SKILL.md +115 -155
  7. package/dist/default-skills/grix-admin/references/api-contract.md +23 -12
  8. package/dist/default-skills/grix-agent-dispatch/SKILL.md +152 -188
  9. package/dist/default-skills/grix-audit-data/SKILL.md +1 -1
  10. package/dist/default-skills/grix-chat-state/SKILL.md +26 -43
  11. package/dist/default-skills/grix-egg/SKILL.md +94 -50
  12. package/dist/default-skills/grix-group/SKILL.md +1 -1
  13. package/dist/default-skills/grix-owner-relay/SKILL.md +30 -64
  14. package/dist/default-skills/grix-query/SKILL.md +1 -1
  15. package/dist/default-skills/grix-skill-library/SKILL.md +52 -0
  16. package/dist/default-skills/grix-widget-visitor-ban/SKILL.md +1 -1
  17. package/dist/default-skills/message-send/SKILL.md +1 -1
  18. package/dist/default-skills/message-unsend/SKILL.md +1 -1
  19. package/dist/default-skills/tailnet-file-share/SKILL.md +38 -72
  20. package/dist/default-skills/tailnet-file-share/references/certificate-trust.md +64 -0
  21. package/dist/mcp/stream-http/security.js +1 -1
  22. package/openclaw-plugin/index.js +120 -3
  23. package/openclaw-plugin/skills/grix-admin/SKILL.md +127 -156
  24. package/openclaw-plugin/skills/grix-egg/SKILL.md +27 -1
  25. package/openclaw-plugin/skills/grix-group/SKILL.md +52 -159
  26. package/openclaw-plugin/skills/grix-query/SKILL.md +54 -248
  27. package/openclaw-plugin/skills/grix-update/SKILL.md +70 -304
  28. package/openclaw-plugin/skills/message-send/SKILL.md +41 -172
  29. package/openclaw-plugin/skills/message-unsend/SKILL.md +29 -170
  30. package/package.json +1 -1
  31. package/dist/assets/dsh-bridge/grix-dsh-bridge-4.2.3.tgz +0 -0
@@ -3135,7 +3135,7 @@ import { homedir as homedir5 } from "node:os";
3135
3135
  import { dirname as dirname3, join as join7 } from "node:path";
3136
3136
  import { promisify } from "node:util";
3137
3137
  var execFileAsync = promisify(execFile);
3138
- var CLI_TIMEOUT_MS = 3e4;
3138
+ var CLI_TIMEOUT_MS = 12e4;
3139
3139
  var GRIX_PROVIDER_ID = "grix";
3140
3140
  function stateDir() {
3141
3141
  const explicit = process.env.OPENCLAW_STATE_DIR?.trim();
@@ -3150,8 +3150,14 @@ function sidecarPath() {
3150
3150
  async function runOpenClaw(args, stdin) {
3151
3151
  const child = execFileAsync("openclaw", args, { timeout: CLI_TIMEOUT_MS });
3152
3152
  child.child.stdin?.end(stdin ?? "");
3153
- const { stdout } = await child;
3154
- return stdout;
3153
+ try {
3154
+ const { stdout } = await child;
3155
+ return stdout;
3156
+ } catch (err2) {
3157
+ const e = err2;
3158
+ const why = e.killed || e.signal ? `timed out after ${CLI_TIMEOUT_MS}ms` : (e.stderr ?? "").trim() || e.message;
3159
+ throw new Error(`openclaw ${args.join(" ")} failed: ${why}`);
3160
+ }
3155
3161
  }
3156
3162
  function configFilePath() {
3157
3163
  const explicit = process.env.OPENCLAW_CONFIG_PATH?.trim();
@@ -10866,6 +10872,51 @@ var TOOLS = [
10866
10872
  }
10867
10873
  }
10868
10874
  },
10875
+ {
10876
+ name: "grix_egg_search",
10877
+ description: "Search the Grix egg market (published skill/persona packages the owner can hatch into a new agent or install into an existing one). Keyword matching is per-term AND over name + description + category, so search short keywords (one concept per call) rather than a whole sentence; omit keyword to browse a category. Results include id, name, description, category, install_count, can_create_agent, and existing_agent_client_types.",
10878
+ inputSchema: {
10879
+ type: "object",
10880
+ properties: {
10881
+ keyword: { type: "string", description: "Short search keyword(s); terms are ANDed. Omit to list by category." },
10882
+ categoryId: { type: "string", description: "Optional egg category ID to restrict results." },
10883
+ locale: { type: "string", description: "Optional locale such as zh-CN or en; defaults to the owner's locale." },
10884
+ page: { type: "integer", description: "Page number, starting from 1." },
10885
+ pageSize: { type: "integer", description: "Items per page (1-50), default 20." }
10886
+ }
10887
+ },
10888
+ validation: {
10889
+ required: [],
10890
+ properties: {
10891
+ keyword: { type: "string", maxLength: 200 },
10892
+ categoryId: { type: "string" },
10893
+ locale: { type: "string", maxLength: 16 },
10894
+ page: { type: "integer", minimum: 1 },
10895
+ pageSize: { type: "integer", minimum: 1, maximum: 50 }
10896
+ }
10897
+ }
10898
+ },
10899
+ {
10900
+ name: "grix_egg_get",
10901
+ description: "Get one Grix egg by id \u2014 full description, current version, and whether it can create a new agent or install into existing agents. Use after grix_egg_search to show details before the owner decides to hatch.",
10902
+ inputSchema: {
10903
+ type: "object",
10904
+ properties: {
10905
+ id: { type: "string", description: "Egg ID from grix_egg_search." },
10906
+ locale: { type: "string", description: "Optional locale." },
10907
+ version: { type: "integer", description: "Optional specific version; defaults to the current one." }
10908
+ },
10909
+ required: ["id"]
10910
+ },
10911
+ validation: {
10912
+ required: ["id"],
10913
+ properties: {
10914
+ id: { type: "string" },
10915
+ locale: { type: "string", maxLength: 16 },
10916
+ version: { type: "integer", minimum: 1 }
10917
+ }
10918
+ }
10919
+ },
10869
10920
  {
10870
10921
  name: "grix_skill_set",
10871
10922
  description: "Create, update, or delete one of your owner's custom skills in the platform skill library. The skill library auto-syncs to every machine the owner runs an agent on (a per-machine `grix/skills` directory), so defining a skill here makes it available on all of them. A skill is a plain SKILL.md package (frontmatter + body), same standard as other Grix skills. Provide `name` and the full `content` (the SKILL.md text) to create or overwrite by name. To delete a skill, pass its `name` with an empty `content` string. How and when any agent actually loads/uses a synced skill is arranged by the owner (in a system prompt or in conversation); this tool only manages the library.",
@@ -11098,6 +11149,10 @@ function toolCallToInvoke(toolName, args) {
11098
11149
  return buildAccessControlInvoke(args);
11099
11150
  case "grix_widget_visitor_ban":
11100
11151
  return buildWidgetVisitorBanInvoke(args);
11152
+ case "grix_egg_search":
11153
+ return buildEggSearchInvoke(args);
11154
+ case "grix_egg_get":
11155
+ return buildEggGetInvoke(args);
11101
11156
  case "grix_skill_set":
11102
11157
  return buildSkillSetInvoke(args);
11103
11158
  case "grix_skill_get":
@@ -11128,6 +11183,21 @@ function buildQueryInvoke(args) {
11128
11183
  if (args.beforeId != null) params.before_id = args.beforeId;
11129
11184
  return { action: invokeAction, params };
11130
11185
  }
11186
+ function buildEggSearchInvoke(args) {
11187
+ const params = {};
11188
+ if (args.keyword != null) params.keyword = args.keyword;
11189
+ if (args.categoryId != null) params.category_id = args.categoryId;
11190
+ if (args.locale != null) params.locale = args.locale;
11191
+ if (args.page != null) params.page = args.page;
11192
+ if (args.pageSize != null) params.page_size = args.pageSize;
11193
+ return { action: "egg_search", params };
11194
+ }
11195
+ function buildEggGetInvoke(args) {
11196
+ const params = { id: args.id };
11197
+ if (args.locale != null) params.locale = args.locale;
11198
+ if (args.version != null) params.version = args.version;
11199
+ return { action: "egg_get", params };
11200
+ }
11131
11201
  var AUDIT_DATA_ACTION_MAP = {
11132
11202
  get_manifest: "audit_get_manifest",
11133
11203
  list_spans: "audit_list_spans",
@@ -11618,6 +11688,49 @@ function createGrixQueryTool(api, ctx) {
11618
11688
  };
11619
11689
  }
11620
11690
 
11691
+ // src/openclaw/admin/egg-market-tools.ts
11692
+ function createEggMarketTool(toolName, label, api, ctx) {
11693
+ const def = TOOLS.find((t) => t.name === toolName);
11694
+ const contextAccountId = ctx?.agentAccountId;
11695
+ return {
11696
+ name: toolName,
11697
+ label,
11698
+ description: def.description,
11699
+ parameters: def.inputSchema,
11700
+ async execute(_toolCallId, params) {
11701
+ try {
11702
+ const accountId = resolveStrictToolAccountId({ toolName, contextAccountId });
11703
+ const account = resolveGrixAccount({
11704
+ cfg: api.config,
11705
+ accountId,
11706
+ strictAccountScope: true
11707
+ });
11708
+ if (!account.enabled) {
11709
+ throw new Error(`Grix account "${account.accountId}" is disabled.`);
11710
+ }
11711
+ if (!account.configured) {
11712
+ throw new Error(`Grix account "${account.accountId}" is not configured.`);
11713
+ }
11714
+ const { action, params: invokeParams } = toolCallToInvoke(toolName, params);
11715
+ const client = requireActiveAibotClient(accountId);
11716
+ const data = await client.agentInvoke(action, invokeParams);
11717
+ return jsonToolResult({ ok: true, accountId: account.accountId, action, data });
11718
+ } catch (err2) {
11719
+ return jsonToolResult({
11720
+ ok: false,
11721
+ error: err2 instanceof Error ? err2.message : String(err2)
11722
+ });
11723
+ }
11724
+ }
11725
+ };
11726
+ }
11727
+ function createGrixEggSearchTool(api, ctx) {
11728
+ return createEggMarketTool("grix_egg_search", "Grix Egg Search", api, ctx);
11729
+ }
11730
+ function createGrixEggGetTool(api, ctx) {
11731
+ return createEggMarketTool("grix_egg_get", "Grix Egg Get", api, ctx);
11732
+ }
11733
+
11621
11734
  // src/openclaw/admin/audit-data-tool.ts
11622
11735
  var auditDataDef = TOOLS.find((tool) => tool.name === "grix_audit_data");
11623
11736
  function createGrixAuditDataTool(api, ctx) {
@@ -12836,6 +12949,8 @@ async function bindAgent(agentName) {
12836
12949
  var DEFAULT_TOOLS_ALLOW = [
12837
12950
  "message",
12838
12951
  "grix_query",
12952
+ "grix_egg_search",
12953
+ "grix_egg_get",
12839
12954
  "grix_group",
12840
12955
  "grix_register",
12841
12956
  "grix_message_send",
@@ -14473,6 +14588,8 @@ var plugin = {
14473
14588
  api.registerTool((ctx) => createGrixGroupTool(api, ctx), { optional: true });
14474
14589
  api.registerTool((ctx) => createGrixAdminTool(api, ctx), { optional: true });
14475
14590
  api.registerTool((ctx) => createGrixEggTool(api, ctx), { optional: true });
14591
+ api.registerTool((ctx) => createGrixEggSearchTool(api, ctx), { optional: true });
14592
+ api.registerTool((ctx) => createGrixEggGetTool(api, ctx), { optional: true });
14476
14593
  api.registerTool((ctx) => createGrixRegisterTool(api, ctx), { optional: true });
14477
14594
  api.registerTool((ctx) => createGrixUpdateTool(api, ctx), { optional: true });
14478
14595
  api.registerTool((ctx) => createGrixMessageSendTool(api, ctx), { optional: true });
@@ -1,164 +1,135 @@
1
1
  ---
2
2
  name: grix-admin
3
- description: Responsible for OpenClaw local configuration, binding, and runtime convergence; can create new remote API agents through the current agent's WS channel, and supports querying, creating, modifying agent categories and assigning categories to agents.
3
+ description: Grix agent administration for OpenClaw — create remote API agents, manage agent categories, and rotate API keys through `grix_admin`, and bind an agent's remote parameters into the local OpenClaw configuration with validation and routing verification. For "create me an agent for X" requests, run `grix-egg` discovery first; use this skill when the user already has agent parameters to bind, asks for category management, or grix-egg found no matching egg / the user wants a blank agent.
4
4
  ---
5
5
 
6
- # Grix Agent Admin
7
-
8
- `grix-admin` is responsible for three things:
9
-
10
- 1. Landing existing remote agent parameters into local OpenClaw and handling runtime convergence after binding.
11
- 2. When the current main agent is already online and has the corresponding scope, creating new remote API agents through `grix_admin`'s direct actions, then continuing with local landing.
12
- 3. During agent creation or subsequent agent management, reusing `grix_admin`'s direct actions to query categories, create categories, modify categories, and assign categories to agents.
13
-
14
- ## Entry Method
15
-
16
- 1. In most cases, enter this skill from `grix_admin`'s `task` entry; the first line of `task` must clearly state `bind-local`, `create-and-bind`, or `category-manage`.
17
- 2. Only when executing remote API agent creation or category operations within this skill should you directly call `grix_admin` once, without passing `task` again.
18
- 3. In new flows, always explicitly pass `action` when directly calling `grix_admin`:
19
- - `create_agent`
20
- - `list_categories`
21
- - `create_category`
22
- - `update_category`
23
- - `assign_category`
24
- 4. The legacy direct call format for `create_agent` is still compatible, but should not be used in new flows.
25
-
26
- ## Agent Creation Intake
27
-
28
- Before any `create_agent` API call:
29
-
30
- 1. Ensure both `agentName` and `introduction` are present and specific. Never create an Agent with an empty, generic, or placeholder introduction.
31
- 2. If either the Agent name or a usable introduction is missing or too vague, pause before calling the tool and ask one concise question: “这个 Agent 主要做什么?核心职责、服务对象和工作边界是什么?”
32
- 3. Convert the user's answer into:
33
- - A concise, professional `agentName` that reflects the Agent's role.
34
- - A professional `introduction` that states its purpose, core responsibilities, intended users or scenarios, operating expectations, and important boundaries.
35
- 4. Preserve the user's facts and intent. Do not invent permissions, business authority, expertise, or responsibilities that the user did not grant.
36
- 5. Treat `introduction` as the Agent's behavioral specification, not promotional copy.
37
- 6. Pass the finalized professional text in the actual `introduction` field of `action=create_agent`.
38
-
39
- ## Direct Action List
40
-
41
- 1. `action=create_agent`
42
- - Required by this skill: `agentName`, `introduction`
43
- - Optional: `isMain`, `categoryId`, `categoryName`, `parentCategoryId`, `categorySortOrder`
44
- - `categoryId` and `categoryName` cannot be provided simultaneously
45
- - When `categoryName` is given, it first checks for duplicates under `parentCategoryId`; if not found, creates and assigns
46
- 2. `action=list_categories`
47
- - Required: none
48
- 3. `action=create_category`
49
- - Required: `name`, `parentId`
50
- - Optional: `sortOrder`
51
- 4. `action=update_category`
52
- - Required: `categoryId`, `name`, `parentId`
53
- - Optional: `sortOrder`
54
- 5. `action=assign_category`
55
- - Required: `agentId`, `categoryId`
56
- - `categoryId=0` means clear the category
57
-
58
- ## Mode A: bind-local (OpenClaw Local Binding)
59
-
60
- Input fields (written in `grix_admin.task`):
61
-
62
- 1. First line must be `bind-local`
63
- 2. `agent_name` (required)
64
- 3. `agent_id` (required)
65
- 4. `api_endpoint` (required)
66
- 5. `api_key` (required)
67
-
68
- Execution rules:
69
-
70
- 1. Do not perform remote creation; execute local binding directly. Do not call scripts that directly modify `openclaw.json`.
71
- 2. Prepare local directories:
72
- - `workspace=~/.openclaw/workspace-<agent_name>`
73
- - `agentDir=~/.openclaw/agents/<agent_name>/agent`
74
- - Persona files belong only in the workspace root; add minimal `IDENTITY.md`, `SOUL.md`, and `AGENTS.md` if required files are missing.
75
- 3. Read the current account, agent, tool profile, tool allowlist, session visibility, and binding configuration.
76
- 4. Resolve `model` by reusing the existing agent model, then `agents.defaults.model.primary`; if neither exists, report the missing model and stop.
77
- 5. Merge the account and agent entries, bind the agent to `grix:<agent_name>`, set the coding tool profile and required Grix tools, and restore `channels.grix.enabled=true` only if it is explicitly disabled.
78
- 6. Use official OpenClaw CLI commands item by item; do not overwrite the entire config.
79
- 7. Perform static validation:
6
+ # Grix Agent Admin (OpenClaw)
7
+
8
+ Three workflows:
9
+
10
+ | Workflow | What it does |
11
+ |---|---|
12
+ | [`bind-local`](#workflow-a--bind-local) | Bind an existing remote agent's parameters into local OpenClaw, validate, verify routing |
13
+ | [`create-and-bind`](#workflow-b--create-and-bind) | Create a remote agent via `grix_admin`, then run `bind-local` |
14
+ | [`category-manage`](#workflow-c--category-manage) | List / create / update / assign categories via `grix_admin` |
15
+
16
+ ## Two ways `grix_admin` is called
17
+
18
+ 1. **Delegated workflow** — the caller passes only `task`, whose first line
19
+ names the workflow (`bind-local`, `create-and-bind`, `category-manage`)
20
+ followed by `key=value` lines. `grix-register` hands off this way. You then
21
+ run the workflow described below.
22
+ 2. **Direct action** — pass `action` plus its fields (table below). Use this
23
+ for every remote call *inside* a workflow. `task` and `action` cannot be
24
+ combined in one call.
25
+
26
+ **Creating a new agent from a business description?** Run the `grix-egg` skill
27
+ first (search the egg market, let the owner hatch a ready-made egg). Come here
28
+ for creation only when no egg matched or the user explicitly wants a blank
29
+ agent — and say so in your reply.
30
+
31
+ All remote operations go through `grix_admin` on the current account's WS
32
+ channel — never hand-written HTTP or scripts, never across accounts, and
33
+ never ask the user for a website account or password.
34
+
35
+ ## `grix_admin` direct actions
36
+
37
+ | `action` | Required | Optional |
38
+ |---|---|---|
39
+ | `create_agent` | `agentName`, `introduction` | `isMain`, `categoryId`, `categoryName`, `parentCategoryId`, `categorySortOrder` |
40
+ | `list_categories` | — | — |
41
+ | `create_category` | `name`, `parentId` | `sortOrder` |
42
+ | `update_category` | `categoryId`, `name`, `parentId` | `sortOrder` |
43
+ | `assign_category` | `agentId`, `categoryId` (`0` clears) | — |
44
+ | `rotate_api_key` | `agentId` | — |
45
+
46
+ Notes:
47
+
48
+ - `categoryId` and `categoryName` are mutually exclusive — report the conflict
49
+ and stop if both are given.
50
+ - With `categoryName`, the backend looks for an exact match under
51
+ `parentCategoryId`, creating it if absent. If several exact matches exist,
52
+ stop and ask the owner for an explicit `categoryId`.
53
+ - `isMain=true` only when actually creating a new main API agent.
54
+ - `code=4003` means a missing scope — report the exact `agent.api.create` or
55
+ `agent.category.*` scope.
56
+
57
+ ## Agent creation intake (before any `create_agent`)
58
+
59
+ 1. `agentName` and `introduction` must both be present and specific. Never
60
+ create an agent with an empty, generic, or placeholder introduction.
61
+ 2. If either is missing or vague, ask one concise question in the user's
62
+ language: what does this agent mainly do — core responsibilities, whom it
63
+ serves, and its boundaries?
64
+ 3. Turn the answer into a concise professional `agentName` and an
65
+ `introduction` that states purpose, core responsibilities, intended users or
66
+ scenarios, operating expectations, and boundaries. Treat `introduction` as
67
+ the agent's behavioral specification, not marketing copy.
68
+ 4. Preserve the user's facts and intent; do not invent permissions, authority,
69
+ or expertise they did not grant.
70
+
71
+ ## Workflow A — `bind-local`
72
+
73
+ Inputs: `agent_name`, `agent_id`, `api_endpoint`, `api_key` (all required).
74
+ Missing field → say which and stop. Do not create anything remotely, and do
75
+ not call back to `grix-register`.
76
+
77
+ 1. Prepare local directories: `workspace=~/.openclaw/workspace-<agent_name>`
78
+ and `agentDir=~/.openclaw/agents/<agent_name>/agent`. Persona files live
79
+ only in the workspace root; add minimal `IDENTITY.md`, `SOUL.md`, and
80
+ `AGENTS.md` if missing.
81
+ 2. Read the current account, agent, tool profile, tool allowlist, session
82
+ visibility, and binding configuration.
83
+ 3. Resolve `model`: reuse the existing agent model, else
84
+ `agents.defaults.model.primary`; if neither exists, report the missing
85
+ model and stop.
86
+ 4. Merge the account and agent entries, bind the agent to
87
+ `grix:<agent_name>`, set the coding tool profile and required Grix tools,
88
+ and restore `channels.grix.enabled=true` only if it was explicitly
89
+ disabled. Apply each change with the official OpenClaw CLI item by item —
90
+ never overwrite or hand-edit `openclaw.json`.
91
+ 5. Static validation:
80
92
  - `openclaw config validate`
81
93
  - `openclaw config get --json channels.grix.accounts.<agent_name>`
82
94
  - `openclaw config get --json agents.list`
83
95
  - `openclaw agents bindings --agent <agent_name> --json`
84
- 8. If real routing verification is available, perform it immediately. Falling back to the main agent, default assistant behavior, an old persona, or an ID mismatch means the runtime has not switched.
85
- 9. Only when static validation passes but real routing verification fails may one `openclaw gateway restart` be used as targeted remediation; then repeat the same verification once.
86
- 10. If real verification is unavailable, state “config has been written, runtime not yet tested, needs subsequent upper-level flow to continue verification”.
87
-
88
- ## Mode B: create-and-bind (Create Remote Agent Then Bind Locally)
89
-
90
- Fields written in `grix_admin.task`:
91
-
92
- 1. First line must be `create-and-bind`
93
- 2. `agentName` (required)
94
- 3. `introduction` (required; professionally organized according to **Agent Creation Intake**)
95
- 4. `isMain` (optional, default `false`)
96
- 5. `categoryId` (optional)
97
- 6. `categoryName` (optional)
98
- 7. `parentCategoryId` (optional, default `0`)
99
- 8. `categorySortOrder` (optional)
100
-
101
- Execution rules:
102
-
103
- 1. Confirm the current session is bound to a valid Grix account; cross-account execution is prohibited.
104
- 2. If both `categoryId` and `categoryName` are provided, report an error and stop.
105
- 3. Call `grix_admin` once with `action=create_agent`, passing `agentName`, `introduction`, and the supplied optional fields.
106
- 4. Read `createdAgent.id`, `createdAgent.agent_name`, `createdAgent.api_endpoint`, and `createdAgent.api_key` from the result.
107
- 5. If category assignment was requested but not completed by the return result, supplement it through the appropriate direct category actions.
108
- 6. In the `categoryName` flow, if multiple exact matches exist under the same parent, stop and ask the owner to use an explicit `categoryId`.
109
- 7. Continue immediately with `bind-local` using the returned parameters.
110
- 8. `isMain=true` should only be used when actually creating a new main API agent.
111
- 9. Do not claim completion until static validation and any available real routing verification pass.
112
-
113
- ## Mode C: category-manage (Category Management)
114
-
115
- Fields written in `grix_admin.task`:
116
-
117
- 1. First line must be `category-manage`
118
- 2. `operation` (required): `list`, `create`, `update`, or `assign`
119
- 3. `name` (`create` / `update` required)
120
- 4. `parentId` (`create` / `update` required)
121
- 5. `sortOrder` (`create` / `update` optional)
122
- 6. `categoryId` (`update` / `assign` required; `0` clears an assignment)
123
- 7. `agentId` (`assign` required)
124
-
125
- Execution rules:
126
-
127
- 1. Strictly bind all operations to the current session account; cross-account execution is prohibited.
128
- 2. Complete all remote steps through `grix_admin` direct actions; do not hand-write HTTP or temporary scripts.
129
- 3. Map operations directly: `list_categories`, `create_category`, `update_category`, or `assign_category`.
130
- 4. If the task also creates a new agent, use `create-and-bind` instead.
131
-
132
- ## Remote Creation Fallback
133
-
134
- If the task has neither existing agent parameters nor an online main channel with `agent.api.create`, stop and ask the owner to create the remote agent through the backend admin path. After obtaining the parameters, proceed with `bind-local`.
135
-
136
- ## Guardrails
137
-
138
- 1. Never ask for a website account or password.
139
- 2. `bind-local` must not call back to `grix-register`.
140
- 3. All remote creation and category actions must go through `grix_admin` direct actions via the current account's WS channel.
141
- 4. Never repeatedly echo the complete `api_key` in plaintext.
142
- 5. Do not manually modify `openclaw.json`; use official OpenClaw CLI commands.
143
- 6. Do not claim full convergence until static validation and any available real routing verification pass.
144
- 7. Use at most one targeted gateway restart, only under the failure conditions defined by `bind-local`.
145
-
146
- ## Error Handling
147
-
148
- 1. For missing fields, clearly state which field is missing and stop.
149
- 2. If `agentName` or a usable `introduction` is missing, ask for the Agent's purpose, responsibilities, intended users, and boundaries before remote creation.
150
- 3. If both `categoryId` and `categoryName` are supplied, report the conflict and stop.
151
- 4. For `code=4003`, report the exact missing `agent.api.create` or `agent.category.*` scope.
152
- 5. Report the exact failed OpenClaw CLI command and validation result.
153
- 6. If one permitted restart and retest still fail, report the flow as failed or partially complete.
154
-
155
- ## Response Style
156
-
157
- 1. Clearly state whether the execution is `bind-local`, `create-and-bind`, or `category-manage`.
158
- 2. Report remote creation, category handling, local config writing, and validation as separate phases when applicable.
159
- 3. Clearly distinguish static configuration success from verified runtime convergence.
160
- 4. If a later phase fails after remote creation, report the overall result as partially complete.
161
-
162
- ## References
163
-
164
- 1. [references/api-contract.md](references/api-contract.md)
96
+ 6. If real routing verification is available, run it now. Falling back to the
97
+ main agent, default assistant behavior, an old persona, or an ID mismatch
98
+ means the runtime has not switched.
99
+ 7. Only when static validation passes but routing verification fails, run
100
+ **one** `openclaw gateway restart` and repeat the verification once.
101
+
102
+ Reporting: distinguish "config written and statically valid" from "runtime
103
+ verified". If verification cannot be run, say "config has been written,
104
+ runtime not yet tested, needs the upper-level flow to continue verification".
105
+ Never echo the full `api_key` in plaintext.
106
+
107
+ ## Workflow B — `create-and-bind`
108
+
109
+ Inputs: `agentName`, `introduction` (required; run the intake above);
110
+ `isMain`, `categoryId` | `categoryName`, `parentCategoryId` (default `0`),
111
+ `categorySortOrder` (optional).
112
+
113
+ 1. Call `grix_admin` once with `action=create_agent` and the supplied fields.
114
+ 2. Read `createdAgent.id`, `agent_name`, `api_endpoint`, `api_key` from the
115
+ result. If a requested category was not applied, finish it with the
116
+ category actions.
117
+ 3. Continue immediately with Workflow A using those values.
118
+ 4. Report remote creation and local binding as separate phases; if binding
119
+ fails after creation succeeded, report the overall result as partial.
120
+
121
+ Fallback: if no agent parameters exist and the current account lacks
122
+ `agent.api.create`, stop and ask the owner to create the agent in the backend
123
+ admin, then run Workflow A with the parameters they provide.
124
+
125
+ ## Workflow C — `category-manage`
126
+
127
+ Inputs: `operation` (`list` | `create` | `update` | `assign`) plus the fields
128
+ required by the matching action above. Map directly to `list_categories`,
129
+ `create_category`, `update_category`, `assign_category`. If the request also
130
+ creates an agent, use Workflow B instead.
131
+
132
+ ## Reference
133
+
134
+ [references/api-contract.md](references/api-contract.md) — request/response
135
+ shapes for each action and the local binding checklist.
@@ -1,10 +1,36 @@
1
1
  ---
2
2
  name: grix-egg
3
- description: "Program-driven hatching: AI only organizes parameters and calls `grix_egg`; the program handles creation, installation, binding, acceptance, and status reporting. Use for creating or installing an Agent from an egg package, including collecting and professionally organizing its name and behavioral introduction before remote creation."
3
+ description: "Grix egg market for OpenClaw — the FIRST entry when the user wants a new agent or assistant for some purpose: search published eggs (skill and persona packages) with `grix_egg_search` / `grix_egg_get`, present matches, and hatch the chosen one yourself from the package URLs `grix_egg_get` returns (via the `grix_egg` tool); only when nothing fits fall back to grix-admin. Hatching itself is program-driven: AI organizes parameters and calls `grix_egg`; the program handles creation, installation, binding, acceptance, and status reporting."
4
4
  ---
5
5
 
6
6
  # Grix Egg
7
7
 
8
+ ## 0. Discovery first — find an egg before creating an agent
9
+
10
+ When the user describes an agent they want ("帮我建一个跟进外贸询盘的助手",
11
+ "I need a bot that reviews PRs") and there is no install card yet, search the
12
+ egg market before anything else; do **not** go to `grix-admin`.
13
+
14
+ 1. Distill the description into **2–4 short keywords** (role noun, domain,
15
+ core action). The backend ANDs terms against name + description +
16
+ category, so a whole sentence returns nothing.
17
+ 2. Call `grix_egg_search` **once per keyword** (`pageSize` 10) in the user's
18
+ language / `locale`; merge, rank by keyword hits then `install_count`. If
19
+ nothing matches, browse by `categoryId` with no keyword.
20
+ 3. Show at most 3–5 candidates: name (+ emoji), one-line description,
21
+ category, `install_count`, and whether it hatches a **new agent**
22
+ (`can_create_agent`) or installs as a **skill into an existing agent**
23
+ (`existing_agent_client_types`). `grix_egg_get` gives the full text.
24
+ 4. The user picks one → `grix_egg_get` returns the package URLs
25
+ (`persona_zip_url` / `skill_zip_url`, each with a `*_sha256`). Call
26
+ `grix_egg` with structured parameters (section 3, no install card):
27
+ `route: create_new` + `agentName` + `introduction` + `downloadUrl` =
28
+ `persona_zip_url` for a new agent, or `route: existing` + `downloadUrl`
29
+ for an existing one; pass the sha256 as `packageHash`. No `installId`
30
+ exists in this path, so no status card is sent.
31
+ 5. No egg fits, or the user explicitly wants a blank agent → hand over to
32
+ `grix-admin` and say clearly that no ready-made egg matched.
33
+
8
34
  `grix-egg` follows a "program-first, AI-assists" approach.
9
35
  AI no longer manually relays create/bind/accept.
10
36