Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### 新增

- Organization Phase 3(反思切片):宿主内 Reflections。Dashboard `/organization/reflections` 使用共享 `dashboard/src/org-ui` 的 `ReflectionsPage`。列表/创建/删除走 `/api/org-module/reflections*`,SQLite 在 `{FREEOS_HOME}/org/reflections.sqlite`。可选 `employee_id` / `task_id` 指向同一租户的目录员工与组织任务。这是组织复盘,不是 Chat,也不是第二套技能运行时。`freeos org export-standalone` 同时列出 Reflections。未迁:Chat、边车技能统计、边车部署铁律样例、其余 Open-12。
- Organization Phase 3(任务切片):宿主内 Tasks。Dashboard `/organization/tasks` 与 `/organization/tasks/:id` 使用共享 `dashboard/src/org-ui` 的 `TasksPage` / `TaskDetailPage`。CRUD、状态流转、子任务与人工评论走 `/api/org-module/tasks*`,SQLite 在 `{FREEOS_HOME}/org/tasks.sqlite`。这是组织待办,不是 Octop cron,也不是项目/Chat 对话。`freeos org export-standalone` 同时列出 Tasks。未迁:Chat、附件上传、边车任务库、其余 Open-12。
- Organization Phase 3(知识切片):宿主内 Knowledge。Dashboard `/organization/knowledge` 使用共享 `dashboard/src/org-ui` 的 `KnowledgePage`。列表/详情/笔记走 `/api/org-module/knowledge*`,包装已有 `KnowledgeService`(Octop `knowledge_bases` / `knowledge_documents`),与 Chat 检索同一套行。不克隆 openXYOS sidecar notes/files DB。上传、文件夹、嵌入模型仍在 `/knowledge-bases`。`freeos org export-standalone` 同时列出 Knowledge。未迁:Chat、边车知识库、其余 Open-12。
- Organization Phase 3(技能切片):宿主内 Skills。Dashboard `/organization/skills` 使用共享 `dashboard/src/org-ui` 的 `SkillsPage`。列表/详情走 `GET /api/org-module/skills` 与 `GET /api/org-module/skills/{slug}`,生成/发布仍是已有 `POST …/generate|publish`(`{FREEOS_HOME}/org-skills`,`skill_bridge`)。宿主 skill packages 只读列出,编辑仍在「个性化 → 技能包」。这不是第二套技能运行时。`freeos org export-standalone` 同时列出 Skills。未迁:Chat、边车市场/插件中心、其余 Open-12。
Expand Down
6 changes: 5 additions & 1 deletion dashboard/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"navGovernance": "Governance",
"navKnowledge": "Knowledge",
"navTasks": "Tasks",
"navReflections": "Reflections",
"announcementsTitle": "Announcements",
"announcementsBody": "Publish notices and track who has read them. This page lives in the host — no sidecar or second port.",
"openAnnouncements": "Open announcements",
Expand All @@ -209,7 +210,10 @@
"openKnowledge": "Open knowledge",
"tasksTitle": "Tasks",
"tasksBody": "Organization work items on the host org store (FREEOS_HOME/org). Not Octop cron, not project chat, and not a sidecar.",
"openTasks": "Open tasks"
"openTasks": "Open tasks",
"reflectionsTitle": "Reflections",
"reflectionsBody": "Capture lessons and reusable experience on the host org store (FREEOS_HOME/org). Not a sidecar and not Chat.",
"openReflections": "Open reflections"
},
"systemSettings": {
"subtitle": "Workbench, remote desktop, and host administration in one place."
Expand Down
6 changes: 5 additions & 1 deletion dashboard/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"navGovernance": "治理",
"navKnowledge": "知识",
"navTasks": "任务",
"navReflections": "反思",
"announcementsTitle": "通知公告",
"announcementsBody": "发布公告并跟踪已读。此页跑在宿主内,不需要边车或第二端口。",
"openAnnouncements": "打开通知公告",
Expand All @@ -209,7 +210,10 @@
"openKnowledge": "打开知识",
"tasksTitle": "任务",
"tasksBody": "宿主组织库里的待办(FREEOS_HOME/org)。不是 Octop 定时任务,也不是项目对话或边车。",
"openTasks": "打开任务"
"openTasks": "打开任务",
"reflectionsTitle": "反思引擎",
"reflectionsBody": "在宿主组织库里整理复盘与经验(FREEOS_HOME/org)。不是边车,也不是对话。",
"openReflections": "打开反思"
},
"systemSettings": {
"subtitle": "工作台、远程桌面与主机管理集中在这里。"
Expand Down
15 changes: 15 additions & 0 deletions dashboard/src/org-ui/api/createClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ describe("createOrgApiClient", () => {
data: [{ id: 3, title: "Ship Tasks slice", status: "todo" }],
};
}
if (path === "/org-module/reflections") {
return {
success: true,
data: [
{
id: 2,
reflection_type: "error_learning",
failure_reasons: "const dead zone",
},
],
};
}
throw new Error(`unexpected ${path}`);
});
const client = createOrgApiClient({ fetchJson });
Expand All @@ -86,6 +98,9 @@ describe("createOrgApiClient", () => {
expect((await client.skills.list()).skills[0]?.slug).toBe("org-employees");
expect((await client.knowledge.list()).bases[0]?.name).toBe("Policies");
expect((await client.tasks.list())[0]?.title).toBe("Ship Tasks slice");
expect((await client.reflections.list())[0]?.failure_reasons).toBe(
"const dead zone",
);
expect(fetchJson).toHaveBeenCalled();
});

Expand Down
107 changes: 107 additions & 0 deletions dashboard/src/org-ui/api/createClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,62 @@ export interface OrgTasksClient {
addComment(id: number, content: string): Promise<OrgTaskComment>;
}

export type OrgReflectionType =
| "task_completion"
| "error_learning"
| "knowledge_capture"
| "improvement";

export interface OrgReflection {
id: number;
employee_id: number;
task_id?: number | null;
reflection_type: string;
success_factors?: string | null;
failure_reasons?: string | null;
knowledge_gaps?: string | null;
improvement_plans?: string | null;
extracted_skills?: string | null;
learned_knowledge?: string | null;
importance_score: number;
created_at?: string;
}

export interface OrgReflectionStats {
total: number;
task_completion: number;
error_learning: number;
knowledge_capture: number;
improvement: number;
}

export interface OrgReflectionWrite {
employee_id?: number | null;
task_id?: number | null;
reflection_type?: string;
success_factors?: string;
failure_reasons?: string;
knowledge_gaps?: string;
improvement_plans?: string;
extracted_skills?: string;
learned_knowledge?: string;
importance_score?: number;
}

export interface OrgReflectionListParams {
employee_id?: number;
type?: string;
search?: string;
}

export interface OrgReflectionsClient {
list(params?: OrgReflectionListParams): Promise<OrgReflection[]>;
stats(): Promise<OrgReflectionStats>;
get(id: number): Promise<OrgReflection>;
create(body: OrgReflectionWrite): Promise<OrgReflection>;
remove(id: number): Promise<void>;
}

export interface OrgApiClient {
announcements: OrgAnnouncementsClient;
org: OrgChartClient;
Expand All @@ -453,6 +509,7 @@ export interface OrgApiClient {
skills: OrgSkillsClient;
knowledge: OrgKnowledgeClient;
tasks: OrgTasksClient;
reflections: OrgReflectionsClient;
}

async function unwrap<T>(payload: OrgEnvelope<T>): Promise<T> {
Expand All @@ -474,13 +531,15 @@ export function createOrgApiClient(opts: {
skillsPrefix?: string;
knowledgePrefix?: string;
tasksPrefix?: string;
reflectionsPrefix?: string;
}): OrgApiClient {
const prefix = opts.announcementsPrefix ?? "/org-module/announcements";
const orgPrefix = opts.orgPrefix ?? "/org-module/org";
const governancePrefix = opts.governancePrefix ?? "/org-module/governance";
const skillsPrefix = opts.skillsPrefix ?? "/org-module/skills";
const knowledgePrefix = opts.knowledgePrefix ?? "/org-module/knowledge";
const tasksPrefix = opts.tasksPrefix ?? "/org-module/tasks";
const reflectionsPrefix = opts.reflectionsPrefix ?? "/org-module/reflections";
const fetchJson = opts.fetchJson;

const announcements: OrgAnnouncementsClient = {
Expand Down Expand Up @@ -879,6 +938,53 @@ export function createOrgApiClient(opts: {
},
};

const reflections: OrgReflectionsClient = {
async list(params = {}) {
const query = new URLSearchParams();
if (params.employee_id != null) {
query.set("employee_id", String(params.employee_id));
}
if (params.type) query.set("type", params.type);
if (params.search) query.set("search", params.search);
const suffix = query.toString() ? `?${query.toString()}` : "";
return unwrap(
await fetchJson<OrgEnvelope<OrgReflection[]>>(
`${reflectionsPrefix}${suffix}`,
),
);
},
async stats() {
return unwrap(
await fetchJson<OrgEnvelope<OrgReflectionStats>>(
`${reflectionsPrefix}/stats`,
),
);
},
async get(id) {
return unwrap(
await fetchJson<OrgEnvelope<OrgReflection>>(
`${reflectionsPrefix}/${id}`,
),
);
},
async create(body) {
return unwrap(
await fetchJson<OrgEnvelope<OrgReflection>>(reflectionsPrefix, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
}),
);
},
async remove(id) {
await unwrap(
await fetchJson<OrgEnvelope<undefined>>(`${reflectionsPrefix}/${id}`, {
method: "DELETE",
}),
);
},
};

return {
announcements,
org,
Expand All @@ -887,5 +993,6 @@ export function createOrgApiClient(opts: {
skills,
knowledge,
tasks,
reflections,
};
}
1 change: 1 addition & 0 deletions dashboard/src/org-ui/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const SHARED_ORG_UI_MODULES = [
"governance",
"knowledge",
"tasks",
"reflections",
] as const;

export type SharedOrgUiModule = (typeof SHARED_ORG_UI_MODULES)[number];
8 changes: 8 additions & 0 deletions dashboard/src/org-ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ export type {
OrgTaskSubtask,
OrgTaskWrite,
OrgTasksClient,
OrgReflection,
OrgReflectionListParams,
OrgReflectionStats,
OrgReflectionType,
OrgReflectionWrite,
OrgReflectionsClient,
OrgSkill,
OrgSkillCatalogRow,
OrgSkillGenerateResult,
Expand All @@ -67,6 +73,8 @@ export { TasksPage } from "./pages/tasks/TasksPage";
export type { TasksPageProps } from "./pages/tasks/TasksPage";
export { TaskDetailPage } from "./pages/tasks/TaskDetailPage";
export type { TaskDetailPageProps } from "./pages/tasks/TaskDetailPage";
export { ReflectionsPage } from "./pages/reflections/ReflectionsPage";
export type { ReflectionsPageProps } from "./pages/reflections/ReflectionsPage";
export type {
IdentityBridge,
OrgFetcher,
Expand Down
Loading
Loading