create-windy 0.2.16 → 0.2.18

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 (69) hide show
  1. package/README.md +4 -3
  2. package/dist/cli.js +71 -22
  3. package/package.json +1 -1
  4. package/template/.dockerignore +5 -0
  5. package/template/.windy-template.json +2 -2
  6. package/template/AGENTS.md +11 -1
  7. package/template/README.md +8 -5
  8. package/template/_gitignore +5 -0
  9. package/template/apps/server/Dockerfile +4 -5
  10. package/template/apps/server/src/index.ts +8 -14
  11. package/template/apps/server/src/settings/drizzle-watermark-repository.integration.test.ts +57 -0
  12. package/template/apps/server/src/settings/drizzle-watermark-repository.ts +62 -0
  13. package/template/apps/server/src/settings/runtime.ts +30 -3
  14. package/template/apps/server/src/settings/watermark-repository.ts +32 -0
  15. package/template/apps/server/src/settings/watermark-routes.test.ts +203 -0
  16. package/template/apps/server/src/settings/watermark-routes.ts +134 -0
  17. package/template/apps/web/Dockerfile +1 -2
  18. package/template/apps/web/runtime-server.test.ts +4 -4
  19. package/template/apps/web/src/composables/useWatermarkSettings.ts +75 -33
  20. package/template/apps/web/src/composables/useWatermarkSettings.webtest.ts +86 -0
  21. package/template/apps/web/src/composables/watermark-settings.ts +9 -35
  22. package/template/apps/web/src/composables/watermark-settings.webtest.ts +8 -32
  23. package/template/apps/web/src/layout/GlobalWatermark.layering.webtest.ts +81 -0
  24. package/template/apps/web/src/layout/GlobalWatermark.vue +34 -31
  25. package/template/apps/web/src/layout/GlobalWatermark.webtest.ts +58 -7
  26. package/template/apps/web/src/pages/settings/GlobalSettingsPage.vue +1 -1
  27. package/template/apps/web/src/pages/settings/WatermarkSettingsSection.vue +40 -18
  28. package/template/apps/web/src/services/platform-settings-api.ts +25 -2
  29. package/template/apps/web/vite.config.ts +3 -1
  30. package/template/docker-compose.yml +19 -6
  31. package/template/docs/platform/platform-shell-settings.md +24 -3
  32. package/template/docs/platform/web-system-crud.md +2 -2
  33. package/template/drizzle.config.ts +1 -1
  34. package/template/package.json +6 -2
  35. package/template/packages/ai-client/index.ts +1 -0
  36. package/template/packages/{agent-client → ai-client}/package.json +4 -5
  37. package/template/packages/{agent-client/src → ai-client/src/agent/client}/client.test.ts +3 -3
  38. package/template/packages/{agent-client/src → ai-client/src/agent/client}/client.ts +2 -2
  39. package/template/packages/{agent-client/src → ai-client/src/agent/client}/error.ts +1 -4
  40. package/template/packages/ai-client/src/agent/client/index.ts +3 -0
  41. package/template/packages/{agent-client/src → ai-client/src/agent/client}/run-protocol.test.ts +2 -2
  42. package/template/packages/{agent-client/src → ai-client/src/agent/client}/run.ts +1 -1
  43. package/template/packages/{agent-client/src → ai-client/src/agent/client}/types.ts +1 -1
  44. package/template/packages/{agent-contracts/src → ai-client/src/agent/contracts}/contracts.test.ts +1 -1
  45. package/template/packages/ai-client/src/agent/contracts/index.ts +7 -0
  46. package/template/packages/ai-client/src/agent/index.ts +14 -0
  47. package/template/packages/{agent-client → ai-client}/tsconfig.json +3 -2
  48. package/template/packages/database/drizzle/0031_panoramic_typhoid_mary.sql +12 -0
  49. package/template/packages/database/drizzle/meta/0031_snapshot.json +7387 -0
  50. package/template/packages/database/drizzle/meta/_journal.json +8 -1
  51. package/template/packages/database/src/schema/platform-settings.ts +16 -1
  52. package/template/packages/modules/src/system-api-permissions.ts +4 -0
  53. package/template/packages/modules/src/system-api-watermark.ts +26 -0
  54. package/template/packages/modules/src/system-features.ts +1 -1
  55. package/template/packages/modules/src/system-watermark-policy.test.ts +31 -0
  56. package/template/packages/shared/src/platform-settings.ts +13 -0
  57. package/template/packages/agent-client/index.ts +0 -3
  58. package/template/packages/agent-contracts/index.ts +0 -7
  59. package/template/packages/agent-contracts/package.json +0 -24
  60. package/template/packages/agent-contracts/tsconfig.json +0 -16
  61. /package/template/packages/{agent-client/src → ai-client/src/agent/client}/event-queue.ts +0 -0
  62. /package/template/packages/{agent-client/src → ai-client/src/agent/client}/http.ts +0 -0
  63. /package/template/packages/{agent-contracts/src → ai-client/src/agent/contracts}/errors.ts +0 -0
  64. /package/template/packages/{agent-contracts/src → ai-client/src/agent/contracts}/events.ts +0 -0
  65. /package/template/packages/{agent-contracts/src → ai-client/src/agent/contracts}/operation.ts +0 -0
  66. /package/template/packages/{agent-contracts/src → ai-client/src/agent/contracts}/runs.ts +0 -0
  67. /package/template/packages/{agent-contracts/src → ai-client/src/agent/contracts}/sse.ts +0 -0
  68. /package/template/packages/{agent-contracts/src → ai-client/src/agent/contracts}/usage.ts +0 -0
  69. /package/template/packages/{agent-contracts/src → ai-client/src/agent/contracts}/validation.ts +0 -0
@@ -218,6 +218,13 @@
218
218
  "when": 1784160403893,
219
219
  "tag": "0030_governed_export_constraints",
220
220
  "breakpoints": true
221
+ },
222
+ {
223
+ "idx": 31,
224
+ "version": "7",
225
+ "when": 1784837513572,
226
+ "tag": "0031_panoramic_typhoid_mary",
227
+ "breakpoints": true
221
228
  }
222
229
  ]
223
- }
230
+ }
@@ -2,7 +2,10 @@
2
2
  export {};
3
3
 
4
4
  // @windy-module system.configuration begin
5
- import type { ModuleConfigDiffEntry, ModuleConfigValues } from "@southwind-ai/shared";
5
+ import type {
6
+ ModuleConfigDiffEntry,
7
+ ModuleConfigValues,
8
+ } from "@southwind-ai/shared";
6
9
  import {
7
10
  index,
8
11
  integer,
@@ -15,6 +18,7 @@ import {
15
18
  // @windy-module system.configuration end
16
19
  // @windy-module system.settings begin
17
20
  import {
21
+ boolean,
18
22
  pgTable as settingsTable,
19
23
  text,
20
24
  varchar as settingsVarchar,
@@ -33,6 +37,17 @@ export const platformBrandingSettings = settingsTable(
33
37
  ...auditColumns,
34
38
  },
35
39
  );
40
+
41
+ export const platformWatermarkPolicies = settingsTable(
42
+ "platform_watermark_policies",
43
+ {
44
+ id: settingsVarchar("id", { length: 64 }).primaryKey(),
45
+ enabled: boolean("enabled").notNull(),
46
+ businessPagesEnabled: boolean("business_pages_enabled").notNull(),
47
+ customContent: settingsVarchar("custom_content", { length: 80 }).notNull(),
48
+ ...auditColumns,
49
+ },
50
+ );
36
51
  // @windy-module system.settings end
37
52
 
38
53
  // @windy-module system.configuration begin
@@ -1,5 +1,8 @@
1
1
  import type { ApiPermissionBinding } from "@southwind-ai/shared";
2
2
  import { binding, resourceBindings } from "./system-api-binding.js";
3
+ // @windy-module system.settings begin
4
+ import { watermarkApiPermissionBindings } from "./system-api-watermark.js";
5
+ // @windy-module system.settings end
3
6
  // @windy-module system.data-governance begin
4
7
  import { dataGovernanceApiPermissionBindings } from "./system-api-data-governance.js";
5
8
  // @windy-module system.data-governance end
@@ -109,6 +112,7 @@ export function systemApiPermissionBindings(): ApiPermissionBinding[] {
109
112
  "system.settings.manage",
110
113
  "system.settings",
111
114
  ),
115
+ ...watermarkApiPermissionBindings(),
112
116
  // @windy-module system.settings end
113
117
  // @windy-module system.configuration begin
114
118
  binding(
@@ -0,0 +1,26 @@
1
+ import type { ApiPermissionBinding } from "@southwind-ai/shared";
2
+ import { binding } from "./system-api-binding.js";
3
+
4
+ export function watermarkApiPermissionBindings(): ApiPermissionBinding[] {
5
+ return [
6
+ binding(
7
+ "GET",
8
+ "/api/platform/watermark-policy",
9
+ "system.watermark.read",
10
+ undefined,
11
+ true,
12
+ ),
13
+ binding(
14
+ "GET",
15
+ "/api/system/settings/watermark",
16
+ "system.watermark.read",
17
+ "system.watermark",
18
+ ),
19
+ binding(
20
+ "PUT",
21
+ "/api/system/settings/watermark",
22
+ "system.watermark.manage",
23
+ "system.watermark",
24
+ ),
25
+ ];
26
+ }
@@ -43,7 +43,7 @@ export const systemFeatures: ModuleManifest["features"] = [
43
43
  feature(
44
44
  "system.watermark",
45
45
  "页面水印",
46
- "带身份信息的页面水印与用户显示偏好。",
46
+ "由平台统一管理并覆盖 Admin 与业务页面的身份水印策略。",
47
47
  ),
48
48
  // @windy-module system.settings end
49
49
  // @windy-module system.license begin
@@ -0,0 +1,31 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { systemFoundationModule } from "./system-modules.js";
3
+
4
+ describe("水印策略能力注册", () => {
5
+ test("注册公开只读入口和受控管理接口", () => {
6
+ const bindings = systemFoundationModule().apiPermissions;
7
+
8
+ expect(bindings).toEqual(
9
+ expect.arrayContaining([
10
+ expect.objectContaining({
11
+ method: "GET",
12
+ path: "/api/platform/watermark-policy",
13
+ permissionKey: "system.watermark.read",
14
+ anonymous: true,
15
+ }),
16
+ expect.objectContaining({
17
+ method: "GET",
18
+ path: "/api/system/settings/watermark",
19
+ permissionKey: "system.watermark.read",
20
+ featureKey: "system.watermark",
21
+ }),
22
+ expect.objectContaining({
23
+ method: "PUT",
24
+ path: "/api/system/settings/watermark",
25
+ permissionKey: "system.watermark.manage",
26
+ featureKey: "system.watermark",
27
+ }),
28
+ ]),
29
+ );
30
+ });
31
+ });
@@ -3,3 +3,16 @@ export interface PlatformBrandingSettings {
3
3
  logoUrl?: string;
4
4
  description?: string;
5
5
  }
6
+
7
+ export interface PlatformWatermarkPolicy {
8
+ enabled: boolean;
9
+ businessPagesEnabled: boolean;
10
+ customContent: string;
11
+ }
12
+
13
+ export const DEFAULT_PLATFORM_WATERMARK_POLICY: Readonly<PlatformWatermarkPolicy> =
14
+ {
15
+ enabled: true,
16
+ businessPagesEnabled: false,
17
+ customContent: "",
18
+ };
@@ -1,3 +0,0 @@
1
- export * from "./src/client.js";
2
- export * from "./src/error.js";
3
- export type * from "./src/types.js";
@@ -1,7 +0,0 @@
1
- export * from "./src/errors.js";
2
- export * from "./src/events.js";
3
- export * from "./src/operation.js";
4
- export * from "./src/runs.js";
5
- export * from "./src/sse.js";
6
- export * from "./src/usage.js";
7
- export { AgentContractParseError } from "./src/validation.js";
@@ -1,24 +0,0 @@
1
- {
2
- "name": "@southwind-ai/agent-contracts",
3
- "version": "0.1.0",
4
- "license": "UNLICENSED",
5
- "type": "module",
6
- "engines": {
7
- "bun": ">=1.3.0"
8
- },
9
- "files": [
10
- "index.ts",
11
- "src/**/*.ts",
12
- "!src/**/*.test.ts"
13
- ],
14
- "scripts": {
15
- "test": "bun test",
16
- "typecheck": "tsc --noEmit --project tsconfig.json"
17
- },
18
- "exports": {
19
- ".": "./index.ts"
20
- },
21
- "publishConfig": {
22
- "access": "public"
23
- }
24
- }
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "esnext",
4
- "module": "esnext",
5
- "lib": ["esnext", "dom"],
6
- "moduleResolution": "bundler",
7
- "strict": true,
8
- "noImplicitAny": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "outDir": "dist",
12
- "types": ["bun"]
13
- },
14
- "include": ["src/**/*", "index.ts"],
15
- "exclude": ["node_modules", "dist"]
16
- }