Skip to content

Commit b20bc6b

Browse files
os-zhuangCopilot
andcommitted
fix(docs): hero version, sidebar i18n, polished hero + rescue Build/ from gitignore
Hero badge was showing v6.0.0 from the stale apps/objectos package version. Switched lib/version.ts to derive OBJECTOS_VERSION from apps/objectos-one/package.json (the version sync-version keeps in lockstep with @objectstack/cli and what actually ships in releases), so the badge now matches the real current release (v7.1.0). Sidebar group titles (Configure / Deploy / Build / Operate / Reference / Resources / Permissions) had no Chinese translation — added per-locale meta.cn.json files using Fumadocs' sibling-locale convention. Page titles inside each group continue to come from the .cn.mdx frontmatter (already translated). Polished the hero: layered radial glow backdrop (primary + blue/purple accents), ArrowRight icon on primary CTA with shimmer/scale on hover, Terminal icon on secondary CTA, glow halo around the quick-start terminal, and a new 'trust strip' under the CTAs (MIT licensed · Self-hosted · v7.1.0 · Docker · Kubernetes · Air-gapped) — bilingual. Discovered while adding content/docs/build/meta.cn.json that the top-level 'build/' .gitignore rule was also matching content/docs/build/, silently making the entire Build documentation section untracked and staged the rescued files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ba6f158 commit b20bc6b

35 files changed

Lines changed: 3624 additions & 18 deletions

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
node_modules/
22
dist/
33
build/
4+
!content/docs/build/
45
.next/
56
.turbo/
67
.source/

‎apps/docs/app/[lang]/page.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export default async function HomePage({
125125
subtitle={t.hero.subtitle}
126126
cta={t.hero.cta}
127127
quickStart={t.hero.quickStart}
128+
trustStrip={t.hero.trustStrip}
128129
/>
129130
<CodePreview t={t.agentPreview} />
130131
</section>

‎apps/docs/components/hero-section.tsx‎

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Link from 'next/link';
2+
import { ArrowRight, Terminal, ShieldCheck, Server, Tag, Boxes } from 'lucide-react';
23
import { cn } from '@/lib/utils';
34

45
interface HeroSectionProps {
@@ -24,12 +25,25 @@ interface HeroSectionProps {
2425
label: string;
2526
commands: string[];
2627
};
28+
trustStrip?: {
29+
license: string;
30+
selfHosted: string;
31+
version: string;
32+
runtime: string;
33+
};
2734
className?: string;
2835
}
2936

30-
export function HeroSection({ badge, title, subtitle, cta, quickStart, className }: HeroSectionProps) {
37+
export function HeroSection({ badge, title, subtitle, cta, quickStart, trustStrip, className }: HeroSectionProps) {
3138
return (
3239
<div className={cn("relative z-10 max-w-5xl space-y-8 animate-fade-in-up", className)}>
40+
{/* Layered radial glow backdrop — gives the hero depth without an image */}
41+
<div className="pointer-events-none absolute inset-x-0 -top-32 -z-10 flex justify-center" aria-hidden="true">
42+
<div className="h-[36rem] w-[36rem] rounded-full bg-primary/20 blur-[120px] opacity-60" />
43+
</div>
44+
<div className="pointer-events-none absolute -top-10 left-1/4 -z-10 h-72 w-72 rounded-full bg-blue-500/10 blur-[100px]" aria-hidden="true" />
45+
<div className="pointer-events-none absolute -top-20 right-1/4 -z-10 h-72 w-72 rounded-full bg-purple-500/10 blur-[100px]" aria-hidden="true" />
46+
3347
{/* Badge */}
3448
<div className="inline-flex items-center rounded-full border border-primary/20 bg-primary/5 px-4 py-1.5 text-sm text-primary backdrop-blur-sm transition-all duration-300 hover:bg-primary/10 hover:border-primary/30 hover:scale-105">
3549
<span className="flex h-2 w-2 rounded-full bg-primary mr-2 animate-pulse"></span>
@@ -54,10 +68,11 @@ export function HeroSection({ badge, title, subtitle, cta, quickStart, className
5468
</span>
5569
</p>
5670

57-
{/* Quick Start Terminal */}
71+
{/* Quick Start Terminal — with glow halo */}
5872
{quickStart && (
59-
<div className="mx-auto max-w-lg">
60-
<div className="rounded-lg border border-border bg-card/80 backdrop-blur-sm overflow-hidden shadow-lg">
73+
<div className="relative mx-auto max-w-lg">
74+
<div className="absolute -inset-1 rounded-xl bg-gradient-to-r from-primary/30 via-blue-500/20 to-purple-500/30 blur-lg opacity-50 group-hover:opacity-70 transition-opacity" aria-hidden="true" />
75+
<div className="relative rounded-lg border border-border bg-card/80 backdrop-blur-sm overflow-hidden shadow-lg">
6176
<div className="flex items-center gap-2 border-b border-border bg-muted/50 px-4 py-2">
6277
<div className="h-2.5 w-2.5 rounded-full bg-red-500/60" />
6378
<div className="h-2.5 w-2.5 rounded-full bg-yellow-500/60" />
@@ -80,17 +95,44 @@ export function HeroSection({ badge, title, subtitle, cta, quickStart, className
8095
<div className="flex flex-col sm:flex-row items-center justify-center gap-4 pt-4">
8196
<Link
8297
href={cta.primaryHref}
83-
className="inline-flex h-12 items-center justify-center rounded-lg bg-primary px-8 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"
98+
className="group relative inline-flex h-12 items-center justify-center gap-2 rounded-lg bg-primary px-8 text-sm font-medium text-primary-foreground shadow-lg shadow-primary/20 transition-all hover:bg-primary/90 hover:shadow-xl hover:shadow-primary/30 hover:scale-[1.03] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50"
8499
>
85100
{cta.primary}
101+
<ArrowRight className="h-4 w-4 transition-transform group-hover:translate-x-0.5" />
86102
</Link>
87103
<Link
88104
href={cta.secondaryHref}
89-
className="inline-flex h-12 items-center justify-center rounded-lg border border-border bg-card/50 px-8 text-sm font-medium shadow-sm transition-all hover:bg-accent hover:text-accent-foreground backdrop-blur-sm hover:scale-105 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"
105+
className="inline-flex h-12 items-center justify-center gap-2 rounded-lg border border-border bg-card/50 px-8 text-sm font-medium shadow-sm transition-all hover:bg-accent hover:text-accent-foreground backdrop-blur-sm hover:scale-[1.03] hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
90106
>
107+
<Terminal className="h-4 w-4" />
91108
{cta.secondary}
92109
</Link>
93110
</div>
111+
112+
{/* Trust strip — small chips that anchor the hero in real facts */}
113+
{trustStrip && (
114+
<div className="flex flex-wrap items-center justify-center gap-x-6 gap-y-2 pt-6 text-xs text-foreground/60">
115+
<span className="inline-flex items-center gap-1.5">
116+
<ShieldCheck className="h-3.5 w-3.5 text-primary/70" />
117+
{trustStrip.license}
118+
</span>
119+
<span className="text-foreground/20">•</span>
120+
<span className="inline-flex items-center gap-1.5">
121+
<Server className="h-3.5 w-3.5 text-primary/70" />
122+
{trustStrip.selfHosted}
123+
</span>
124+
<span className="text-foreground/20">•</span>
125+
<span className="inline-flex items-center gap-1.5 font-mono">
126+
<Tag className="h-3.5 w-3.5 text-primary/70" />
127+
{trustStrip.version}
128+
</span>
129+
<span className="text-foreground/20 hidden sm:inline">•</span>
130+
<span className="inline-flex items-center gap-1.5">
131+
<Boxes className="h-3.5 w-3.5 text-primary/70" />
132+
{trustStrip.runtime}
133+
</span>
134+
</div>
135+
)}
94136
</div>
95137
);
96138
}

‎apps/docs/lib/homepage-i18n.ts‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Supports: en (English), cn (Chinese / 中文)
1111
*/
1212

13-
import { SPEC_VERSION } from './version';
13+
import { SPEC_VERSION, OBJECTOS_VERSION } from './version';
1414

1515
export interface HomepageTranslations {
1616
// Hero Section
@@ -37,6 +37,12 @@ export interface HomepageTranslations {
3737
label: string;
3838
commands: string[];
3939
};
40+
trustStrip: {
41+
license: string;
42+
selfHosted: string;
43+
version: string;
44+
runtime: string;
45+
};
4046
};
4147

4248
// Features Section
@@ -200,6 +206,12 @@ export const en: HomepageTranslations = {
200206
'os start',
201207
],
202208
},
209+
trustStrip: {
210+
license: 'MIT licensed',
211+
selfHosted: 'Self-hosted',
212+
version: OBJECTOS_VERSION,
213+
runtime: 'Docker · Kubernetes · Air-gapped',
214+
},
203215
},
204216
features: {
205217
selfHosted: {
@@ -349,6 +361,12 @@ export const cn: HomepageTranslations = {
349361
'os start',
350362
],
351363
},
364+
trustStrip: {
365+
license: 'MIT 开源',
366+
selfHosted: '私有部署',
367+
version: OBJECTOS_VERSION,
368+
runtime: 'Docker · Kubernetes · 离线',
369+
},
352370
},
353371
features: {
354372
selfHosted: {

‎apps/docs/lib/version.ts‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
/**
22
* Version utilities
33
*
4-
* Reads the version of the ObjectOS runtime distribution
5-
* (apps/objectos), which is what users actually deploy —
6-
* not the docs site's own package.json.
4+
* Single source of truth for the user-visible "current ObjectOS version".
5+
*
6+
* We pull from `apps/objectos-one/package.json` because:
7+
* - `release-one` workflow keeps this in lockstep with the resolved
8+
* `@objectstack/cli` version (via scripts/sync-version),
9+
* - it's what actually gets shipped to GitHub Releases under
10+
* `one-v<X.Y.Z>` and is what users download.
11+
*
12+
* The legacy `apps/objectos/package.json` version is stale and
13+
* intentionally not surfaced anywhere in the UI.
714
*/
815

9-
import pkg from '../../objectos/package.json';
1016
import onePkg from '../../objectos-one/package.json';
1117

12-
export const OBJECTOS_VERSION = `v${pkg.version}`;
13-
14-
/**
15-
* Version of the ObjectOS One desktop bundle (Tauri shell + runtime).
16-
* This is what gets shipped to GitHub Releases under tag `one-v<X.Y.Z>`,
17-
* so all desktop download URLs need to embed this — not OBJECTOS_VERSION.
18-
*/
18+
/** Bare semver, e.g. "7.1.0". */
1919
export const ONE_VERSION = onePkg.version;
20+
21+
/** Display form used in headers/badges, e.g. "v7.1.0". */
22+
export const OBJECTOS_VERSION = `v${onePkg.version}`;
23+
24+
/** GitHub release tag matching one.yml output, e.g. "one-v7.1.0". */
2025
export const ONE_RELEASE_TAG = `one-v${onePkg.version}`;
2126

2227
/** @deprecated Use OBJECTOS_VERSION instead. */

‎content/docs/build/actions.cn.mdx‎

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
---
2+
title: Actions
3+
description: 平台以 REST 端点、Console 按钮、流程步骤和 AI 工具的形式暴露的命名操作 —— 一处声明即可。
4+
---
5+
6+
# Actions
7+
8+
**Action** 是对象上的一个命名操作。声明一次,它就会作为:
9+
10+
- 一个 **REST 端点** `/api/v1/data/<object>/actions/<action>`
11+
- Console 记录详情页上的一个 **按钮**
12+
- 一个 **流程步骤**(`type: 'action'`)用于自动化
13+
- 一个 **AI 工具**(`action_<name>`)供 Agent 和 AI Builder 调用
14+
15+
你不必在四种表面之间重复自己。一处声明;四种调用方式。
16+
17+
## 声明一个 Action
18+
19+
```ts
20+
// src/actions/approve_invoice.action.ts
21+
import { defineAction, Field } from '@objectstack/spec';
22+
23+
export const approveInvoice = defineAction({
24+
name: 'approve_invoice',
25+
label: 'Approve Invoice',
26+
object: 'invoice',
27+
description: 'Mark the invoice approved and stamp the approver.',
28+
icon: 'check',
29+
30+
inputs: {
31+
note: Field.textarea({ label: 'Approval note' }),
32+
},
33+
34+
// 谁能调用
35+
permissions: {
36+
requires: ['allowEdit'], // 对象级
37+
condition: 'record.status == "pending"',
38+
},
39+
40+
// 它做什么 —— 声明式,不需要 JS
41+
steps: [
42+
{
43+
type: 'update',
44+
record: '{!record.id}',
45+
fields: {
46+
status: 'approved',
47+
approved_by: '{!user.id}',
48+
approved_at: '{!now()}',
49+
approval_note: '{!inputs.note}',
50+
},
51+
},
52+
],
53+
});
54+
```
55+
56+
整个文件就这些。`os dev` 重编译之后:
57+
58+
- `POST /api/v1/data/invoice/actions/approve_invoice` 可用
59+
- Console 里 Invoice 记录页出现一个 **Approve Invoice** 按钮
60+
- 流程可以包含 `{ type: 'action', action: 'approve_invoice', inputs: { note: '…' } }`
61+
- 若 Skill 允许,AI 助手可以调用 `action_approve_invoice`
62+
63+
## 三种风味
64+
65+
| 风味 | 跑什么 | 用于 |
66+
|---|---|---|
67+
| **声明式**(`steps:`) | DSL —— update/create/delete/query/action/condition/foreach | 多数场景 —— 可审计 + AI 可调 |
68+
| **脚本**(`script:`) | TypeScript 函数,服务端执行 | 跨系统逻辑、复杂变换 |
69+
| **外部**(`webhook:`) | HTTP POST 到你的端点 | 委托给你自己的服务 |
70+
71+
```ts
72+
// 脚本风味
73+
defineAction({
74+
name: 'archive_old_orders',
75+
object: 'order',
76+
script: async ({ ctx, record, inputs }) => {
77+
await ctx.data.update('order', record.id, { archived_at: new Date() });
78+
return { ok: true };
79+
},
80+
});
81+
```
82+
83+
不论哪种风味,Action 在所有表面都是同样的一等公民。
84+
85+
## 调用一个 Action
86+
87+
### REST
88+
89+
```bash
90+
curl -X POST https://app.example.com/api/v1/data/invoice/actions/approve_invoice \
91+
-H 'Authorization: Bearer <token>' \
92+
-H 'Content-Type: application/json' \
93+
-d '{"recordId": "inv_123", "inputs": {"note": "LGTM"}}'
94+
```
95+
96+
返回更新后的记录(声明式 Action)或你的处理函数的返回值(脚本 Action)。
97+
98+
### Console
99+
100+
默认情况下,Console 把 Action 显示为记录详情页上的按钮,按 Action 的 `permissions.condition` 过滤。在视图配置中覆盖位置:
101+
102+
```ts
103+
defineView({
104+
name: 'invoice_detail',
105+
object: 'invoice',
106+
actions: ['approve_invoice', 'reject_invoice', 'send_to_customer'],
107+
});
108+
```
109+
110+
### 从流程
111+
112+
```ts
113+
{
114+
type: 'action',
115+
action: 'approve_invoice',
116+
inputs: { note: 'Auto-approved by SLA flow' },
117+
record: '{!trigger.record.id}',
118+
}
119+
```
120+
121+
### 从 AI Agent
122+
123+
如果 `approve_invoice` 在 Agent 的某个 Skill 里,LLM 就能调它。输入来自对话;权限照样按用户本人直接调用来执行。
124+
125+
> *"批准发票 INV-2042,备注 'verified by phone.'"*
126+
127+
## 权限
128+
129+
每个 Action 以发起调用的用户身份运行 —— 永远不是服务账号。平台检查:
130+
131+
1. **对象权限** —— 用户权限集上的 `requires:` 标志(`allowEdit`、`allowCreate`…)。
132+
2. **Action 闸门** —— Action 的 `permissions.condition`(针对记录、用户、输入求值的 CEL 表达式)。
133+
3. **字段权限** —— Action 写入的任何字段,用户必须有写权限。
134+
135+
校验失败返回 `403 Forbidden` 及结构化错误,说明哪个检查失败。
136+
137+
## 内置 Action
138+
139+
每个对象天生就有:
140+
141+
| Action | 作用 |
142+
|---|---|
143+
| `create` | 插入一条记录 |
144+
| `update` | 更新一条记录 |
145+
| `delete` | 删除(或软删除)一条记录 |
146+
| `restore` | 恢复软删除 |
147+
| `clone` | 深拷贝一条记录 |
148+
| `share` | 直接与用户/角色分享 |
149+
150+
不要重复声明这些 —— 通过 [Hook](/docs/build/data-model#field-types) 扩展行为。
151+
152+
## 审计
153+
154+
每次 Action 调用都落到 `sys_audit_log`,含:
155+
156+
- 发起用户
157+
- Action 名称 + 输入(敏感字段脱敏)
158+
- 记录 id(如有)
159+
- 成功 / 失败 + 错误
160+
- 时序
161+
- 发起表面(`rest` / `studio` / `flow` / `ai`)
162+
163+
这是"谁按了按钮?"这类问题的首要查询入口。
164+
165+
## 用 AI Builder 生成 Action
166+
167+
> *"在 `support_ticket` 上创建一个 `escalate_ticket` Action,把优先级设为紧急,并指派给值班工程师。"*
168+
169+
AI 会调 `create_action`(元数据工具)并把变更入审批队列。批准后,该 Action 可从 REST、Console、流程,以及——递归地——AI 自己调用。
170+
171+
## 下一步
172+
173+
- [Flows](/docs/build/flows) —— 把多个 Action 组合为业务逻辑
174+
- [Agents](/docs/build/agents) —— 把 Action 作为 AI 工具暴露
175+
- [API Access](/docs/configure/api-access) —— 从外部系统调用 Action
176+
- [Permissions](/docs/configure/permissions) —— 控制谁能调用什么

0 commit comments

Comments
 (0)