@myclaw163/clawclaw-cli 0.8.24 → 0.8.25
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/docs/custom-modules/api-reference.md +9 -4
- package/docs/custom-modules/behavior.md +3 -2
- package/docs/custom-modules/perception.md +3 -3
- package/package.json +1 -1
- package/skills/clawclaw/references/CUSTOM-BEHAVIOR-DEVELOPMENT.md +4 -2
- package/skills/clawclaw/references/CUSTOM-MODULE-API.md +9 -4
- package/skills/clawclaw/references/CUSTOM-PERCEPTION-DEVELOPMENT.md +3 -3
- package/src/commands/load.ts +6 -5
- package/src/lib/agent-workspace-client.ts +3 -0
- package/src/lib/agent-workspace-runtime.ts +5 -3
- package/src/lib/agent-workspace-skills.ts +3 -2
- package/src/lib/agent-workspace-sync.ts +7 -1
- package/src/lib/capability-cloud-refresh.ts +3 -0
- package/src/lib/capability-cloud-sync.ts +3 -0
- package/src/lib/capability-discovery.ts +2 -2
- package/src/lib/capability-operation-name.ts +2 -0
- package/src/lib/capability-workspace.ts +22 -2
- package/src/runtime/clawclaw/plugins/behavior/behavior-catalog.ts +1 -0
- package/src/runtime/clawclaw/plugins/behavior/behavior-manifest.ts +2 -2
- package/src/runtime/clawclaw/plugins/behavior/behavior-normalization.ts +2 -0
- package/src/runtime/clawclaw/plugins/behavior/behavior-plugin.ts +1 -0
- package/src/runtime/clawclaw/plugins/behavior/behavior-source.ts +2 -1
- package/src/runtime/clawclaw/plugins/perception/perception-plugin.ts +5 -3
- package/src/runtime/clawclaw/plugins/perception/perception-source.ts +2 -1
- package/src/sdk/behavior-plugin/index.ts +2 -1
- package/src/sdk/perception-plugin/index.ts +2 -1
- package/src/sdk/resource-metadata.ts +5 -2
|
@@ -315,12 +315,15 @@ interface BehaviorFinish {
|
|
|
315
315
|
|
|
316
316
|
### Manifest:`ClawclawBehaviorManifest`
|
|
317
317
|
|
|
318
|
+
首次自动上传 Hub 时,默认展示名称取脚本 `id`,默认展示描述取脚本 `description`,分别按 Hub 的 50/600 字符限制截取。之后 Hub 名称、描述独立维护,CCL 随装配版本缓存,用于人类界面和当前策略上报;修改脚本说明不会覆盖 Hub 文案。`ccl load` 和模块详情仍向 Agent 提供脚本描述。本地尚未上传或离线时使用本地登记、缓存的展示信息。新脚本无需填写模块级 `name`,已有脚本仍可读取;感知事件的 `eventMetadata.name`、参数说明和玩家名字不受影响。
|
|
319
|
+
|
|
318
320
|
| 字段 | 类型 | 约束 |
|
|
319
321
|
|---|---|---|
|
|
320
322
|
| `apiVersion` | `3` | 必须等于 `BEHAVIOR_PLUGIN_API_VERSION` |
|
|
321
323
|
| `id` | `string` | 稳定且唯一 |
|
|
322
|
-
| `
|
|
323
|
-
| `
|
|
324
|
+
| `description` | `string` | 非空的 Agent 能力说明 |
|
|
325
|
+
| `name` | `string`,可选 | 兼容已有脚本;新脚本省略,展示信息由 CCL 管理 |
|
|
326
|
+
| `localizations` | object,可选 | 兼容已有脚本的模块文案;人类展示优先采用本地登记或 Hub 下发的文案 |
|
|
324
327
|
| `inputs` | `BehaviorInputFieldSpec[]` | Activation 参数 schema |
|
|
325
328
|
| `execution` | `'parallel' \| 'serial'`,可选 | 省略为 parallel |
|
|
326
329
|
| `everyTicks` | `number`,可选 | 正整数;第一次 eligible tick 总会运行 |
|
|
@@ -489,8 +492,10 @@ debugSnapshot?(): unknown;
|
|
|
489
492
|
| 字段 | 类型 | 约束 |
|
|
490
493
|
|---|---|---|
|
|
491
494
|
| `apiVersion` | `2` | 必须等于 `PERCEPTION_PLUGIN_API_VERSION` |
|
|
492
|
-
| `id`
|
|
493
|
-
| `
|
|
495
|
+
| `id` | `string` | 稳定的模块 ID |
|
|
496
|
+
| `description` | `string` | 非空的 Agent 能力说明 |
|
|
497
|
+
| `name` | `string`,可选 | 兼容已有脚本;新脚本省略,展示信息由 CCL 管理 |
|
|
498
|
+
| `localizations` | object,可选 | 兼容已有脚本的模块文案;人类展示优先采用本地登记或 Hub 下发的文案 |
|
|
494
499
|
| `subjectScope` | `'others' \| 'self_and_others' \| 'visible_pairs' \| 'corpses'` | 描述 Event 主体范围 |
|
|
495
500
|
| `produces` | `string[]` | 允许输出的 Event type |
|
|
496
501
|
| `wakeAgent` | boolean,可选 | 模块默认是否主动唤醒 Agent,省略为 true;单条 proposal 可覆盖 |
|
|
@@ -74,13 +74,15 @@ Manifest 是模块的机器可读说明。CCL 用它展示和校验模块,并
|
|
|
74
74
|
|---|---|
|
|
75
75
|
| `apiVersion` | 公共契约版本;当前写 `3` |
|
|
76
76
|
| `id` | 稳定且唯一的 Behavior ID |
|
|
77
|
-
| `
|
|
77
|
+
| `description` | 给 Agent 的适用场景、功能与限制说明;新脚本无需 `name` |
|
|
78
78
|
| `inputs` | 启动时允许传入的参数;无参数写 `[]` |
|
|
79
79
|
| `runtime` | 可选的短任务默认时限与控制宽限 |
|
|
80
80
|
| `execution` | 可选,`parallel` 或 `serial` |
|
|
81
81
|
| `everyTicks` | 可选,每隔多少游戏 tick 决策一次 |
|
|
82
82
|
| `produces` | 可选,本模块可能发布的自定义 Event type |
|
|
83
83
|
|
|
84
|
+
首次自动上传 Hub 时,默认展示名称取脚本 `id`,默认展示描述取脚本 `description`,分别按 Hub 的 50/600 字符限制截取。之后 Hub 名称、描述独立维护,CCL 随装配版本缓存,用于人类界面和当前策略上报;修改脚本说明不会覆盖 Hub 文案。`ccl load` 和模块详情仍向 Agent 提供脚本描述。本地尚未上传或离线时使用本地登记、缓存的展示信息。新脚本无需填写模块级 `name`,已有脚本仍可读取;感知事件的 `eventMetadata.name`、参数说明和玩家名字不受影响。
|
|
85
|
+
|
|
84
86
|
`static` 表示 Manifest 属于类本身,不需要先创建实例。`as const` 保留字面量类型,也符合静态发现规则。
|
|
85
87
|
|
|
86
88
|
### 可选的 `normalize(input, api)`
|
|
@@ -118,7 +120,6 @@ export default class GoToPoint extends ClawclawBehavior<GoToPointInput> {
|
|
|
118
120
|
static readonly manifest = {
|
|
119
121
|
apiVersion: 3,
|
|
120
122
|
id: 'community.go-to-point',
|
|
121
|
-
name: '前往坐标',
|
|
122
123
|
description: '走到指定坐标附近后结束。',
|
|
123
124
|
inputs: [
|
|
124
125
|
{ id: 'x', type: 'number', description: '目标 X 坐标。', required: true },
|
|
@@ -76,7 +76,7 @@ export default class MyPerception extends ClawclawPerception {
|
|
|
76
76
|
|---|---|
|
|
77
77
|
| `apiVersion` | 当前写 `2` |
|
|
78
78
|
| `id` | 稳定且唯一的模块 ID |
|
|
79
|
-
| `
|
|
79
|
+
| `description` | 给 Agent 的识别目标与能力说明;新脚本无需 `name` |
|
|
80
80
|
| `localizations` | 可选的本地化名称与说明 |
|
|
81
81
|
| `subjectScope` | Event 描述其他玩家、自身与他人、玩家对,还是尸体 |
|
|
82
82
|
| `produces` | 这个模块可能发布的 Event type |
|
|
@@ -85,6 +85,8 @@ export default class MyPerception extends ClawclawPerception {
|
|
|
85
85
|
| `execution` | 可选;耗时分析模块写 `parallel_analysis` |
|
|
86
86
|
| `boundaryBaseline` | 可选;声明并行 reducer 能否仅用当前帧安全建立边界基线 |
|
|
87
87
|
|
|
88
|
+
首次自动上传 Hub 时,默认展示名称取脚本 `id`,默认展示描述取脚本 `description`,分别按 Hub 的 50/600 字符限制截取。之后 Hub 名称、描述独立维护,CCL 随装配版本缓存,用于人类界面和当前策略上报;修改脚本说明不会覆盖 Hub 文案。`ccl load` 和模块详情仍向 Agent 提供脚本描述。本地尚未上传或离线时使用本地登记、缓存的展示信息。新脚本无需填写模块级 `name`,已有脚本仍可读取;感知事件的 `eventMetadata.name`、参数说明和玩家名字不受影响。
|
|
89
|
+
|
|
88
90
|
### 普通模式:`update(frame, api)`
|
|
89
91
|
|
|
90
92
|
每个视觉帧调用一次:
|
|
@@ -111,7 +113,6 @@ export default class FirstSightingPerception extends ClawclawPerception {
|
|
|
111
113
|
static readonly manifest = {
|
|
112
114
|
apiVersion: 2,
|
|
113
115
|
id: 'visual.first_sighting',
|
|
114
|
-
name: '第一次看见玩家',
|
|
115
116
|
description: '在当前连续轨迹中第一次看见其他玩家时发布事件。',
|
|
116
117
|
subjectScope: 'others',
|
|
117
118
|
produces: ['visual.first_sighting'],
|
|
@@ -242,7 +243,6 @@ Manifest 可声明 `wakeAgent: false`,让模块默认只积累感知。省略
|
|
|
242
243
|
static readonly manifest = {
|
|
243
244
|
apiVersion: 2,
|
|
244
245
|
id: 'visual.first_sighting',
|
|
245
|
-
name: '第一次看见玩家',
|
|
246
246
|
description: '记录首次目击,随下一次通知交付。',
|
|
247
247
|
subjectScope: 'others',
|
|
248
248
|
produces: ['visual.first_sighting'],
|
package/package.json
CHANGED
|
@@ -73,7 +73,7 @@ Manifest 是模块的机器可读说明。CCL 用它展示和校验模块,并
|
|
|
73
73
|
|---|---|
|
|
74
74
|
| `apiVersion` | 公共契约版本;当前写 `3` |
|
|
75
75
|
| `id` | 稳定且唯一的 Behavior ID |
|
|
76
|
-
| `
|
|
76
|
+
| `description` | 给 Agent 的适用场景、功能与限制说明;新脚本无需 `name` |
|
|
77
77
|
| `inputs` | 启动时允许传入的参数;无参数写 `[]` |
|
|
78
78
|
| `runtime` | 可选的短任务默认时限与控制宽限 |
|
|
79
79
|
| `execution` | 可选,`parallel` 或 `serial` |
|
|
@@ -81,8 +81,11 @@ Manifest 是模块的机器可读说明。CCL 用它展示和校验模块,并
|
|
|
81
81
|
| `everyTicks` | 可选,每隔多少游戏 tick 决策一次 |
|
|
82
82
|
| `produces` | 可选,本模块可能发布的自定义 Event type |
|
|
83
83
|
|
|
84
|
+
首次自动上传 Hub 时,默认展示名称取脚本 `id`,默认展示描述取脚本 `description`,分别按 Hub 的 50/600 字符限制截取。之后 Hub 名称、描述独立维护,CCL 随装配版本缓存,用于人类界面和当前策略上报;修改脚本说明不会覆盖 Hub 文案。`ccl load` 和模块详情仍向 Agent 提供脚本描述。本地尚未上传或离线时使用本地登记、缓存的展示信息。新脚本无需填写模块级 `name`,已有脚本仍可读取;感知事件的 `eventMetadata.name`、参数说明和玩家名字不受影响。
|
|
85
|
+
|
|
84
86
|
`static` 表示 Manifest 属于类本身,不需要先创建实例。`as const` 保留字面量类型,也符合静态发现规则。
|
|
85
87
|
|
|
88
|
+
|
|
86
89
|
### 可选的 `normalize(input, api)`
|
|
87
90
|
|
|
88
91
|
Manifest schema 应用默认值并完成基础校验后,Runtime 在每次 Activation 启动前最多调用一次 `normalize()`。它适合把公开 JSON 参数转换成模块内部更方便使用的只读结构,或用 `api.timing()`、`api.number()` 等 helper 做一次性规范化。
|
|
@@ -118,7 +121,6 @@ export default class GoToPoint extends ClawclawBehavior<GoToPointInput> {
|
|
|
118
121
|
static readonly manifest = {
|
|
119
122
|
apiVersion: 3,
|
|
120
123
|
id: 'community.go-to-point',
|
|
121
|
-
name: '前往坐标',
|
|
122
124
|
description: '走到指定坐标附近后结束。',
|
|
123
125
|
inputs: [
|
|
124
126
|
{ id: 'x', type: 'number', description: '目标 X 坐标。', required: true },
|
|
@@ -311,12 +311,15 @@ interface BehaviorFinish {
|
|
|
311
311
|
|
|
312
312
|
### Manifest:`ClawclawBehaviorManifest`
|
|
313
313
|
|
|
314
|
+
首次自动上传 Hub 时,默认展示名称取脚本 `id`,默认展示描述取脚本 `description`,分别按 Hub 的 50/600 字符限制截取。之后 Hub 名称、描述独立维护,CCL 随装配版本缓存,用于人类界面和当前策略上报;修改脚本说明不会覆盖 Hub 文案。`ccl load` 和模块详情仍向 Agent 提供脚本描述。本地尚未上传或离线时使用本地登记、缓存的展示信息。新脚本无需填写模块级 `name`,已有脚本仍可读取;感知事件的 `eventMetadata.name`、参数说明和玩家名字不受影响。
|
|
315
|
+
|
|
314
316
|
| 字段 | 类型 | 约束 |
|
|
315
317
|
|---|---|---|
|
|
316
318
|
| `apiVersion` | `3` | 必须等于 `BEHAVIOR_PLUGIN_API_VERSION` |
|
|
317
319
|
| `id` | `string` | 稳定且唯一 |
|
|
318
|
-
| `
|
|
319
|
-
| `
|
|
320
|
+
| `description` | `string` | 非空的 Agent 能力说明 |
|
|
321
|
+
| `name` | `string`,可选 | 兼容已有脚本;新脚本省略,展示信息由 CCL 管理 |
|
|
322
|
+
| `localizations` | object,可选 | 兼容已有脚本的模块文案;人类展示优先采用本地登记或 Hub 下发的文案 |
|
|
320
323
|
| `inputs` | `BehaviorInputFieldSpec[]` | Activation 参数 schema |
|
|
321
324
|
| `execution` | `'parallel' \| 'serial'`,可选 | 省略为 parallel |
|
|
322
325
|
| `everyTicks` | `number`,可选 | 正整数;第一次 eligible tick 总会运行 |
|
|
@@ -485,8 +488,10 @@ debugSnapshot?(): unknown;
|
|
|
485
488
|
| 字段 | 类型 | 约束 |
|
|
486
489
|
|---|---|---|
|
|
487
490
|
| `apiVersion` | `2` | 必须等于 `PERCEPTION_PLUGIN_API_VERSION` |
|
|
488
|
-
| `id`
|
|
489
|
-
| `
|
|
491
|
+
| `id` | `string` | 稳定的模块 ID |
|
|
492
|
+
| `description` | `string` | 非空的 Agent 能力说明 |
|
|
493
|
+
| `name` | `string`,可选 | 兼容已有脚本;新脚本省略,展示信息由 CCL 管理 |
|
|
494
|
+
| `localizations` | object,可选 | 兼容已有脚本的模块文案;人类展示优先采用本地登记或 Hub 下发的文案 |
|
|
490
495
|
| `subjectScope` | `'others' \| 'self_and_others' \| 'visible_pairs' \| 'corpses'` | 描述 Event 主体范围 |
|
|
491
496
|
| `produces` | `string[]` | 允许输出的 Event type |
|
|
492
497
|
| `wakeAgent` | boolean,可选 | 模块默认是否主动唤醒 Agent,省略为 true;单条 proposal 可覆盖 |
|
|
@@ -76,7 +76,7 @@ export default class MyPerception extends ClawclawPerception {
|
|
|
76
76
|
|---|---|
|
|
77
77
|
| `apiVersion` | 当前写 `2` |
|
|
78
78
|
| `id` | 稳定且唯一的模块 ID |
|
|
79
|
-
| `
|
|
79
|
+
| `description` | 给 Agent 的识别目标与能力说明;新脚本无需 `name` |
|
|
80
80
|
| `localizations` | 可选的本地化名称与说明 |
|
|
81
81
|
| `subjectScope` | Event 描述其他玩家、自身与他人、玩家对,还是尸体 |
|
|
82
82
|
| `produces` | 这个模块可能发布的 Event type |
|
|
@@ -85,6 +85,8 @@ export default class MyPerception extends ClawclawPerception {
|
|
|
85
85
|
| `execution` | 可选;耗时分析模块写 `parallel_analysis` |
|
|
86
86
|
| `boundaryBaseline` | 可选;声明并行 reducer 能否仅用当前帧安全建立边界基线 |
|
|
87
87
|
|
|
88
|
+
首次自动上传 Hub 时,默认展示名称取脚本 `id`,默认展示描述取脚本 `description`,分别按 Hub 的 50/600 字符限制截取。之后 Hub 名称、描述独立维护,CCL 随装配版本缓存,用于人类界面和当前策略上报;修改脚本说明不会覆盖 Hub 文案。`ccl load` 和模块详情仍向 Agent 提供脚本描述。本地尚未上传或离线时使用本地登记、缓存的展示信息。新脚本无需填写模块级 `name`,已有脚本仍可读取;感知事件的 `eventMetadata.name`、参数说明和玩家名字不受影响。
|
|
89
|
+
|
|
88
90
|
### 普通模式:`update(frame, api)`
|
|
89
91
|
|
|
90
92
|
每个视觉帧调用一次:
|
|
@@ -111,7 +113,6 @@ export default class FirstSightingPerception extends ClawclawPerception {
|
|
|
111
113
|
static readonly manifest = {
|
|
112
114
|
apiVersion: 2,
|
|
113
115
|
id: 'visual.first_sighting',
|
|
114
|
-
name: '第一次看见玩家',
|
|
115
116
|
description: '在当前连续轨迹中第一次看见其他玩家时发布事件。',
|
|
116
117
|
subjectScope: 'others',
|
|
117
118
|
produces: ['visual.first_sighting'],
|
|
@@ -242,7 +243,6 @@ Manifest 可声明 `wakeAgent: false`,让模块默认只积累感知。省略
|
|
|
242
243
|
static readonly manifest = {
|
|
243
244
|
apiVersion: 2,
|
|
244
245
|
id: 'visual.first_sighting',
|
|
245
|
-
name: '第一次看见玩家',
|
|
246
246
|
description: '记录首次目击,随下一次通知交付。',
|
|
247
247
|
subjectScope: 'others',
|
|
248
248
|
produces: ['visual.first_sighting'],
|
package/src/commands/load.ts
CHANGED
|
@@ -723,8 +723,9 @@ export function createLoadCommand(dependencies: LoadCommandDependencies = {}): C
|
|
|
723
723
|
type: 'persona',
|
|
724
724
|
path: snapshot.persona.path,
|
|
725
725
|
runtimeId: basename(snapshot.persona.path, extname(snapshot.persona.path)),
|
|
726
|
-
title:
|
|
727
|
-
description:
|
|
726
|
+
title: hubPersonaItem.title,
|
|
727
|
+
description: hubPersonaItem.description,
|
|
728
|
+
initialDescription: `Persona ${basename(snapshot.persona.path)}`,
|
|
728
729
|
selectedByHub: true,
|
|
729
730
|
hub: {
|
|
730
731
|
resourceId: hubPersonaItem.resourceId,
|
|
@@ -901,7 +902,7 @@ export function createLoadCommand(dependencies: LoadCommandDependencies = {}): C
|
|
|
901
902
|
return {
|
|
902
903
|
id: entry.id,
|
|
903
904
|
name: localized.name,
|
|
904
|
-
description:
|
|
905
|
+
description: source.description,
|
|
905
906
|
source: entry.source,
|
|
906
907
|
strategy_type: classifyStrategyLifecycle(readFileSync(source.sourcePath, 'utf8')),
|
|
907
908
|
...(source.management.versionNumber ? { version_number: source.management.versionNumber,
|
|
@@ -910,11 +911,11 @@ export function createLoadCommand(dependencies: LoadCommandDependencies = {}): C
|
|
|
910
911
|
}),
|
|
911
912
|
perceptions: perceptions.map((entry) => {
|
|
912
913
|
const source = perceptionSourceById.get(entry.id)!;
|
|
913
|
-
const localized = resolveClawclawResourceMetadata(source.manifest, LOAD_DISPLAY_LOCALE);
|
|
914
|
+
const localized = resolveClawclawResourceMetadata({ ...source.manifest, display: source.display }, LOAD_DISPLAY_LOCALE);
|
|
914
915
|
return {
|
|
915
916
|
id: entry.id,
|
|
916
917
|
name: localized.name,
|
|
917
|
-
description:
|
|
918
|
+
description: source.description,
|
|
918
919
|
source: entry.source,
|
|
919
920
|
};
|
|
920
921
|
}),
|
|
@@ -18,6 +18,9 @@ export interface AgentWorkspaceRemoteItem {
|
|
|
18
18
|
resource_id: string;
|
|
19
19
|
forked_from_resource_id?: string | null;
|
|
20
20
|
version_id: string;
|
|
21
|
+
/** Human-facing text for this exact Hub version; absent in older snapshots. */
|
|
22
|
+
title?: string;
|
|
23
|
+
description?: string;
|
|
21
24
|
version_number?: string;
|
|
22
25
|
version_description?: string;
|
|
23
26
|
resource_type: ResourceType;
|
|
@@ -112,7 +112,8 @@ export function listAgentWorkspaceBehaviorSources(
|
|
|
112
112
|
item.sourceFiles[0]?.relativePath ?? basename(source.sourcePath));
|
|
113
113
|
const entry = registerDiscoveredCapability(workspaceDir, profile, {
|
|
114
114
|
type: 'behavior', path: workingCopyPath, runtimeId: source.id,
|
|
115
|
-
title:
|
|
115
|
+
title: item.title, description: item.description, selectedByHub: true,
|
|
116
|
+
initialDescription: source.description,
|
|
116
117
|
hub: { resourceId: item.resourceId, versionId: item.versionId,
|
|
117
118
|
workspaceItemId: item.workspaceItemId, publisher: item.hub?.publisher ?? 'community',
|
|
118
119
|
pendingForkConflict: item.forkReconciliation?.status === 'linked' && item.resolution === 'concurrent_difference' || undefined,
|
|
@@ -144,8 +145,9 @@ export function listAgentWorkspacePerceptionSources(
|
|
|
144
145
|
?? join(getUserDataAccountCapabilitiesDir(workspaceDir, profile), 'perceptions', item.resourceId,
|
|
145
146
|
item.sourceFiles[0]?.relativePath ?? basename(source.sourcePath));
|
|
146
147
|
const entry = registerDiscoveredCapability(workspaceDir, profile, {
|
|
147
|
-
type: 'perception', path: workingCopyPath, runtimeId: source.id, title:
|
|
148
|
-
description:
|
|
148
|
+
type: 'perception', path: workingCopyPath, runtimeId: source.id, title: item.title,
|
|
149
|
+
description: item.description, selectedByHub: true,
|
|
150
|
+
initialDescription: source.description,
|
|
149
151
|
hub: { resourceId: item.resourceId, versionId: item.versionId, workspaceItemId: item.workspaceItemId,
|
|
150
152
|
pendingForkConflict: item.forkReconciliation?.status === 'linked' && item.resolution === 'concurrent_difference' || undefined,
|
|
151
153
|
...(item.forkReconciliation?.status === 'unresolved' ? { forkRelationshipUnresolved: true } : {}),
|
|
@@ -427,8 +427,9 @@ export function syncAgentWorkspaceSkills(
|
|
|
427
427
|
type: 'skill',
|
|
428
428
|
path: canonical,
|
|
429
429
|
runtimeId: name,
|
|
430
|
-
title: name,
|
|
431
|
-
description:
|
|
430
|
+
title: item.remoteItem?.title ?? name,
|
|
431
|
+
description: item.remoteItem?.description,
|
|
432
|
+
initialDescription: `Skill ${name}`,
|
|
432
433
|
selectedByHub: item.kind !== 'local',
|
|
433
434
|
...(item.kind === 'hub' && item.resourceId && item.versionId ? {
|
|
434
435
|
hub: {
|
|
@@ -67,6 +67,8 @@ export interface LocalAgentWorkspaceItem {
|
|
|
67
67
|
};
|
|
68
68
|
resourceId: string;
|
|
69
69
|
versionId: string;
|
|
70
|
+
title?: string;
|
|
71
|
+
description?: string;
|
|
70
72
|
versionNumber?: string;
|
|
71
73
|
versionDescription?: string;
|
|
72
74
|
resourceType: ResourceType;
|
|
@@ -375,6 +377,8 @@ async function materializeItem(
|
|
|
375
377
|
resourceId: item.resource_id,
|
|
376
378
|
forkedFromResourceId: item.forked_from_resource_id ?? undefined,
|
|
377
379
|
versionId: item.version_id,
|
|
380
|
+
title: item.title,
|
|
381
|
+
description: item.description,
|
|
378
382
|
versionNumber: item.version_number,
|
|
379
383
|
versionDescription: item.version_description,
|
|
380
384
|
resourceType: item.resource_type,
|
|
@@ -708,6 +712,7 @@ export async function syncAgentWorkspaceConfig(
|
|
|
708
712
|
return items.length === remote.items[type].length && remote.items[type].every(item =>
|
|
709
713
|
items.some(old => old.resourceId === item.resource_id && old.versionId === item.version_id
|
|
710
714
|
&& old.workspaceItemId === item.workspace_item_id && old.contentDigest === item.content_digest
|
|
715
|
+
&& old.title === item.title && old.description === item.description
|
|
711
716
|
&& old.forkedFromResourceId === (item.forked_from_resource_id ?? undefined)));
|
|
712
717
|
});
|
|
713
718
|
if (
|
|
@@ -948,7 +953,8 @@ export async function syncAgentWorkspaceConfig(
|
|
|
948
953
|
: parentEntry?.declaredId ?? parentEntry?.runtimeId);
|
|
949
954
|
if (runtimeId) forkRegistrations.push({
|
|
950
955
|
type: workspaceType, path: workingPath!, runtimeId,
|
|
951
|
-
title:
|
|
956
|
+
title: item.title ?? parentEntry?.title ?? source?.id,
|
|
957
|
+
description: item.description ?? parentEntry?.description ?? source?.description,
|
|
952
958
|
selectedByHub: true,
|
|
953
959
|
hub: { resourceId: item.resource_id, versionId: item.version_id, workspaceItemId: item.workspace_item_id,
|
|
954
960
|
publisher: 'self', baseSha256: materialized.sourceFiles[0]!.sha256,
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
capabilityWorkspacePath,
|
|
18
18
|
readCapabilityWorkspaceRegistry,
|
|
19
19
|
updateCapabilityHubIdentity,
|
|
20
|
+
updateCapabilityDisplayMetadata,
|
|
20
21
|
type CapabilityWorkspaceEntry,
|
|
21
22
|
type CapabilityWorkspaceType,
|
|
22
23
|
} from './capability-workspace.js';
|
|
@@ -259,6 +260,7 @@ export async function refreshCapabilitiesFromCloud(
|
|
|
259
260
|
}
|
|
260
261
|
const detail = await client.getResource(type, hub.resourceId, workspaceItemId);
|
|
261
262
|
if (detail.versionId === hub.versionId) {
|
|
263
|
+
updateCapabilityDisplayMetadata(workspaceDir, profile, entry.key, detail);
|
|
262
264
|
if (
|
|
263
265
|
hub.observedCloudVersionId
|
|
264
266
|
|| (hub.pendingForkConflict && before === hub.baseSha256)
|
|
@@ -309,6 +311,7 @@ export async function refreshCapabilitiesFromCloud(
|
|
|
309
311
|
}
|
|
310
312
|
const convergence = before === artifact.digest;
|
|
311
313
|
if (!convergence) artifact.apply(path);
|
|
314
|
+
updateCapabilityDisplayMetadata(workspaceDir, profile, entry.key, detail);
|
|
312
315
|
updateCapabilityHubIdentity(workspaceDir, profile, entry.key, {
|
|
313
316
|
...hub,
|
|
314
317
|
versionId: detail.versionId,
|
|
@@ -360,6 +360,9 @@ export async function syncCapabilitiesToCloud(
|
|
|
360
360
|
}
|
|
361
361
|
baseVersionId = latest.versionId;
|
|
362
362
|
versionNumber = nextPatchVersion(latest.versionNumber ?? '1.0.0');
|
|
363
|
+
// A source edit is not a request to overwrite human-facing Hub text.
|
|
364
|
+
entry.title = latest.title?.trim() || entry.title;
|
|
365
|
+
entry.description = latest.description?.trim() || entry.description;
|
|
363
366
|
}
|
|
364
367
|
validateUploadPayload(entry, path, payload);
|
|
365
368
|
const uploadedSource = await client.uploadFiles(sourceFileType(entry.type), payload.source);
|
|
@@ -45,7 +45,7 @@ export function discoverLocalCapabilities(
|
|
|
45
45
|
type: 'behavior',
|
|
46
46
|
path: source.sourcePath,
|
|
47
47
|
runtimeId: source.id,
|
|
48
|
-
title: source.
|
|
48
|
+
title: source.id,
|
|
49
49
|
description: source.description,
|
|
50
50
|
strategyLifecycle: classifyStrategyLifecycle(readFileSync(source.sourcePath, 'utf8')),
|
|
51
51
|
}),
|
|
@@ -58,7 +58,7 @@ export function discoverLocalCapabilities(
|
|
|
58
58
|
type: 'perception',
|
|
59
59
|
path: source.sourcePath,
|
|
60
60
|
runtimeId: source.id,
|
|
61
|
-
title: source.
|
|
61
|
+
title: source.id,
|
|
62
62
|
description: source.description,
|
|
63
63
|
}),
|
|
64
64
|
}));
|
|
@@ -4,11 +4,13 @@ import type { ResolvedClawclawPerceptionSource } from '../runtime/clawclaw/plugi
|
|
|
4
4
|
|
|
5
5
|
export function behaviorOperationName<T extends ResolvedClawclawBehaviorSource>(source: T, entry: CapabilityWorkspaceEntry): T {
|
|
6
6
|
return { ...source, id: entry.runtimeId, declaredId: source.declaredId ?? source.id,
|
|
7
|
+
display: { name: entry.title, description: entry.description },
|
|
7
8
|
workingCopyPath: source.workingCopyPath ?? source.sourcePath };
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export function perceptionOperationName<T extends ResolvedClawclawPerceptionSource>(source: T, entry: CapabilityWorkspaceEntry): T {
|
|
11
12
|
return { ...source, id: entry.runtimeId, declaredId: source.declaredId ?? source.id,
|
|
13
|
+
display: { name: entry.title, description: entry.description },
|
|
12
14
|
workingCopyPath: source.workingCopyPath ?? source.sourcePath,
|
|
13
15
|
manifest: { ...source.manifest, id: entry.runtimeId } };
|
|
14
16
|
}
|
|
@@ -124,6 +124,7 @@ export function registerDiscoveredCapability(
|
|
|
124
124
|
runtimeId: string;
|
|
125
125
|
title?: string;
|
|
126
126
|
description?: string;
|
|
127
|
+
initialDescription?: string;
|
|
127
128
|
strategyLifecycle?: StrategyLifecycle;
|
|
128
129
|
hub?: CapabilityHubIdentity;
|
|
129
130
|
selectedByHub?: boolean;
|
|
@@ -163,8 +164,13 @@ export function registerDiscoveredCapability(
|
|
|
163
164
|
relativePath,
|
|
164
165
|
runtimeId,
|
|
165
166
|
declaredId,
|
|
166
|
-
|
|
167
|
-
|
|
167
|
+
// Only a Hub snapshot may replace existing human-facing text. Rediscovering
|
|
168
|
+
// a script must not overwrite it with Agent-facing documentation.
|
|
169
|
+
title: (input.selectedByHub ? input.title?.trim() : undefined)
|
|
170
|
+
|| previous?.title || Array.from(input.title?.trim() || input.runtimeId).slice(0, 50).join(''),
|
|
171
|
+
description: (input.selectedByHub ? input.description?.trim() : undefined)
|
|
172
|
+
|| previous?.description || Array.from(input.description?.trim() || input.initialDescription?.trim()
|
|
173
|
+
|| `${input.type} ${input.runtimeId}`).slice(0, 600).join(''),
|
|
168
174
|
selection: input.selectedByHub
|
|
169
175
|
? 'equipped'
|
|
170
176
|
: previous?.selection ?? 'pending',
|
|
@@ -223,6 +229,20 @@ export function setCapabilitySelection(
|
|
|
223
229
|
return entry;
|
|
224
230
|
}
|
|
225
231
|
|
|
232
|
+
export function updateCapabilityDisplayMetadata(
|
|
233
|
+
workspaceDir: string,
|
|
234
|
+
profile: Pick<AuthProfile, 'apiKey'>,
|
|
235
|
+
key: string,
|
|
236
|
+
display: { title?: string; description?: string },
|
|
237
|
+
): void {
|
|
238
|
+
const registry = readCapabilityWorkspaceRegistry(workspaceDir, profile);
|
|
239
|
+
const entry = registry.entries[key];
|
|
240
|
+
if (!entry) return;
|
|
241
|
+
if (display.title?.trim()) entry.title = display.title.trim();
|
|
242
|
+
if (display.description?.trim()) entry.description = display.description.trim();
|
|
243
|
+
writeCapabilityWorkspaceRegistry(workspaceDir, profile, registry);
|
|
244
|
+
}
|
|
245
|
+
|
|
226
246
|
export function updateCapabilityHubIdentity(
|
|
227
247
|
workspaceDir: string,
|
|
228
248
|
profile: Pick<AuthProfile, 'apiKey'>,
|
|
@@ -104,6 +104,7 @@ export class ClawclawBehaviorCatalog {
|
|
|
104
104
|
manifest: deepFreezeBehaviorValue(structuredClone(prepared.manifest)),
|
|
105
105
|
input: deepFreezeBehaviorValue(structuredClone(prepared.input)),
|
|
106
106
|
source: prepared.source,
|
|
107
|
+
display: source.display,
|
|
107
108
|
...(prepared.timing === undefined ? {} : { timing: prepared.timing }),
|
|
108
109
|
});
|
|
109
110
|
}
|
|
@@ -119,7 +119,7 @@ export function normalizeClawclawBehaviorManifest(
|
|
|
119
119
|
);
|
|
120
120
|
const id = nonEmpty(manifest.id) ? manifest.id.trim() : '';
|
|
121
121
|
if (!BEHAVIOR_ID.test(id)) throw new Error('behavior_id_invalid');
|
|
122
|
-
if (!nonEmpty(manifest.name)) throw new Error('behavior_name_invalid');
|
|
122
|
+
if (manifest.name !== undefined && !nonEmpty(manifest.name)) throw new Error('behavior_name_invalid');
|
|
123
123
|
if (!nonEmpty(manifest.description)) throw new Error('behavior_description_invalid');
|
|
124
124
|
if (!hasValidClawclawResourceLocalizations(
|
|
125
125
|
manifest.localizations as ClawclawBehaviorManifest['localizations'],
|
|
@@ -164,7 +164,7 @@ export function normalizeClawclawBehaviorManifest(
|
|
|
164
164
|
return deepFreezeBehaviorValue({
|
|
165
165
|
apiVersion: BEHAVIOR_PLUGIN_API_VERSION,
|
|
166
166
|
id,
|
|
167
|
-
name: (manifest.name as string).trim(),
|
|
167
|
+
name: ((manifest.name ?? manifest.id) as string).trim(),
|
|
168
168
|
description: (manifest.description as string).trim(),
|
|
169
169
|
...(localizations === undefined ? {} : { localizations }),
|
|
170
170
|
inputs,
|
|
@@ -13,6 +13,8 @@ const MIN_RUNTIME_MS = 1_000;
|
|
|
13
13
|
const MAX_RUNTIME_MS = 120_000;
|
|
14
14
|
|
|
15
15
|
export interface PreparedClawclawBehavior {
|
|
16
|
+
/** Host-owned display text, separate from the executable manifest. */
|
|
17
|
+
readonly display?: Readonly<{ name: string; description: string }>;
|
|
16
18
|
/** Owner-local instance exists only for explicitly serial trusted execution. */
|
|
17
19
|
readonly module?: ClawclawBehavior;
|
|
18
20
|
readonly createModule?: () => ClawclawBehavior;
|
|
@@ -1374,6 +1374,7 @@ implements RuntimeEpochPlugin<Record<string, any>>, BehaviorReflexActivationDriv
|
|
|
1374
1374
|
id: prepared.manifest.id,
|
|
1375
1375
|
name: prepared.manifest.name,
|
|
1376
1376
|
description: prepared.manifest.description,
|
|
1377
|
+
display: prepared.display,
|
|
1377
1378
|
...(prepared.manifest.localizations === undefined
|
|
1378
1379
|
? {}
|
|
1379
1380
|
: { localizations: prepared.manifest.localizations }),
|
|
@@ -65,6 +65,7 @@ export interface ResolvedClawclawBehaviorSource {
|
|
|
65
65
|
readonly declaredId?: string;
|
|
66
66
|
readonly workingCopyPath?: string;
|
|
67
67
|
readonly name: string;
|
|
68
|
+
readonly display?: Readonly<{ name: string; description: string }>;
|
|
68
69
|
readonly description: string;
|
|
69
70
|
readonly localizations?: ClawclawResourceLocalizations;
|
|
70
71
|
readonly inputs: readonly Readonly<BehaviorInputFieldSpec>[];
|
|
@@ -430,7 +431,7 @@ function sourceCompatibility(
|
|
|
430
431
|
const descriptionProperty = literalProperty(manifest, 'description');
|
|
431
432
|
const name = nameProperty.status === 'valid' && typeof nameProperty.value === 'string'
|
|
432
433
|
? nameProperty.value.trim()
|
|
433
|
-
: '';
|
|
434
|
+
: nameProperty.status === 'missing' ? id : '';
|
|
434
435
|
const description = descriptionProperty.status === 'valid'
|
|
435
436
|
&& typeof descriptionProperty.value === 'string'
|
|
436
437
|
? descriptionProperty.value.trim()
|
|
@@ -288,7 +288,7 @@ export function validatePerceptionManifest(
|
|
|
288
288
|
!manifest
|
|
289
289
|
|| manifest.apiVersion !== PERCEPTION_PLUGIN_API_VERSION
|
|
290
290
|
|| !/^[a-z0-9][a-z0-9._-]*$/.test(manifest.id)
|
|
291
|
-
|| !nonEmpty(manifest.name)
|
|
291
|
+
|| (manifest.name !== undefined && !nonEmpty(manifest.name))
|
|
292
292
|
|| !nonEmpty(manifest.description)
|
|
293
293
|
|| !hasValidClawclawResourceLocalizations(manifest.localizations)
|
|
294
294
|
|| !['others', 'self_and_others', 'visible_pairs', 'corpses'].includes(manifest.subjectScope)
|
|
@@ -823,7 +823,9 @@ export class ClawclawPerceptionPlugin implements RuntimeEpochPlugin<Record<strin
|
|
|
823
823
|
}
|
|
824
824
|
|
|
825
825
|
localizedModuleDescriptors(locale: string): ClawclawResolvedResourceMetadata[] {
|
|
826
|
-
return this.modules.map(({ manifest }) => resolveClawclawResourceMetadata(
|
|
826
|
+
return this.modules.map(({ manifest, source }) => resolveClawclawResourceMetadata({
|
|
827
|
+
...manifest, display: source.display,
|
|
828
|
+
}, locale));
|
|
827
829
|
}
|
|
828
830
|
|
|
829
831
|
localizedModuleDescriptorForEvent(
|
|
@@ -833,7 +835,7 @@ export class ClawclawPerceptionPlugin implements RuntimeEpochPlugin<Record<strin
|
|
|
833
835
|
const module = this.modules.find(({ manifest }) => manifest.produces.includes(type));
|
|
834
836
|
if (!module) return undefined;
|
|
835
837
|
return {
|
|
836
|
-
...resolveClawclawResourceMetadata(module.manifest, locale),
|
|
838
|
+
...resolveClawclawResourceMetadata({ ...module.manifest, display: module.source.display }, locale),
|
|
837
839
|
perceptionId: module.manifest.id,
|
|
838
840
|
};
|
|
839
841
|
}
|
|
@@ -36,6 +36,7 @@ export interface ResolvedClawclawPerceptionSource {
|
|
|
36
36
|
readonly declaredId?: string;
|
|
37
37
|
readonly workingCopyPath?: string;
|
|
38
38
|
readonly name: string;
|
|
39
|
+
readonly display?: Readonly<{ name: string; description: string }>;
|
|
39
40
|
readonly description: string;
|
|
40
41
|
readonly manifest: ClawclawPerceptionManifest;
|
|
41
42
|
readonly sourcePath: string;
|
|
@@ -344,7 +345,7 @@ function parseSource(sourcePath: string, sourceRoot: string): ResolvedClawclawPe
|
|
|
344
345
|
|
|
345
346
|
const apiVersion = literalPluginApiVersion(manifestBlock) ?? null;
|
|
346
347
|
const id = literalProperty(manifestBlock, 'id')?.trim();
|
|
347
|
-
const name = literalProperty(manifestBlock, 'name')?.trim();
|
|
348
|
+
const name = literalProperty(manifestBlock, 'name')?.trim() ?? id;
|
|
348
349
|
const description = literalProperty(manifestBlock, 'description')?.trim();
|
|
349
350
|
const subjectScope = literalProperty(manifestBlock, 'subjectScope')?.trim();
|
|
350
351
|
const produces = literalStringArray(manifestBlock, 'produces');
|
|
@@ -255,7 +255,8 @@ export interface ClawclawBehaviorManifest {
|
|
|
255
255
|
readonly stateMode?: BehaviorStateMode;
|
|
256
256
|
readonly apiVersion: typeof BEHAVIOR_PLUGIN_API_VERSION;
|
|
257
257
|
readonly id: string;
|
|
258
|
-
|
|
258
|
+
/** Legacy modules may provide a name; human-facing text is managed by the host. */
|
|
259
|
+
readonly name?: string;
|
|
259
260
|
readonly description: string;
|
|
260
261
|
readonly localizations?: ClawclawResourceLocalizations;
|
|
261
262
|
readonly inputs: readonly BehaviorInputFieldSpec[];
|
|
@@ -122,7 +122,8 @@ export interface ClawclawPerceptionManifest {
|
|
|
122
122
|
readonly wakeAgent?: boolean;
|
|
123
123
|
readonly apiVersion: typeof PERCEPTION_PLUGIN_API_VERSION;
|
|
124
124
|
readonly id: string;
|
|
125
|
-
|
|
125
|
+
/** Legacy modules may provide a name; human-facing text is managed by the host. */
|
|
126
|
+
readonly name?: string;
|
|
126
127
|
readonly description: string;
|
|
127
128
|
readonly localizations?: ClawclawResourceLocalizations;
|
|
128
129
|
/** Describes Event subjects; every module still receives self as a spatial reference. */
|
|
@@ -9,8 +9,10 @@ export type ClawclawResourceLocalizations = Readonly<
|
|
|
9
9
|
|
|
10
10
|
export interface ClawclawResourceMetadata {
|
|
11
11
|
readonly id: string;
|
|
12
|
-
readonly name
|
|
12
|
+
readonly name?: string;
|
|
13
13
|
readonly description: string;
|
|
14
|
+
/** Host-owned human-facing text; never replaces the script's Agent description. */
|
|
15
|
+
readonly display?: ClawclawLocalizedResourceText;
|
|
14
16
|
readonly localizations?: ClawclawResourceLocalizations;
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -46,6 +48,7 @@ export function resolveClawclawResourceMetadata(
|
|
|
46
48
|
metadata: ClawclawResourceMetadata,
|
|
47
49
|
locale: string,
|
|
48
50
|
): ClawclawResolvedResourceMetadata {
|
|
51
|
+
if (metadata.display) return { id: metadata.id, ...metadata.display };
|
|
49
52
|
const requested = normalizedLocale(locale);
|
|
50
53
|
const entries = Object.entries(metadata.localizations ?? {});
|
|
51
54
|
const exact = entries.find(([key]) => normalizedLocale(key) === requested)?.[1];
|
|
@@ -57,7 +60,7 @@ export function resolveClawclawResourceMetadata(
|
|
|
57
60
|
const localized = exact ?? languageMatch ?? regionalMatch;
|
|
58
61
|
return {
|
|
59
62
|
id: metadata.id,
|
|
60
|
-
name: localized?.name ?? metadata.name,
|
|
63
|
+
name: localized?.name ?? metadata.name ?? metadata.id,
|
|
61
64
|
description: localized?.description ?? metadata.description,
|
|
62
65
|
};
|
|
63
66
|
}
|