@dxos/plugin-daily-summary 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef
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/dist/lib/browser/DailySummaryPlugin-POHY2NUI.mjs +21 -0
- package/dist/lib/browser/DailySummaryPlugin-POHY2NUI.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +6 -32
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +18 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/types/src/DailySummaryPlugin.d.ts +1 -0
- package/dist/types/src/DailySummaryPlugin.d.ts.map +1 -1
- package/dist/types/src/DailySummaryPlugin.test.d.ts +2 -0
- package/dist/types/src/DailySummaryPlugin.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/daily-summary-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/daily-summary-blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/definitions.d.ts +2 -2
- package/dist/types/src/blueprints/functions/definitions.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/generate.d.ts +2 -2
- package/dist/types/src/blueprints/functions/generate.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/index.d.ts +1 -1
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +2 -2
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/containers/DailySummarySettings/DailySummarySettings.d.ts +2 -5
- package/dist/types/src/containers/DailySummarySettings/DailySummarySettings.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +5 -6
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -29
- package/src/DailySummaryPlugin.test.ts +31 -0
- package/src/DailySummaryPlugin.tsx +3 -2
- package/src/blueprints/daily-summary-blueprint.ts +2 -3
- package/src/blueprints/functions/definitions.ts +1 -1
- package/src/blueprints/functions/generate.test.ts +10 -10
- package/src/blueprints/functions/generate.ts +11 -6
- package/src/blueprints/functions/index.ts +1 -1
- package/src/capabilities/app-graph-builder.ts +4 -5
- package/src/capabilities/blueprint-definition.ts +2 -0
- package/src/capabilities/index.ts +2 -0
- package/src/capabilities/react-surface.tsx +1 -2
- package/src/containers/DailySummarySettings/DailySummarySettings.tsx +10 -14
- package/src/index.ts +7 -2
- package/src/meta.test.ts +2 -2
- package/src/meta.ts +1 -1
- package/src/translations.test.ts +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-daily-summary",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.abd8ff62ef",
|
|
4
4
|
"description": "Daily activity summary plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -13,16 +13,24 @@
|
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"type": "module",
|
|
15
15
|
"imports": {
|
|
16
|
+
"#plugin": "./src/DailySummaryPlugin.tsx",
|
|
16
17
|
"#blueprints": "./src/blueprints/index.ts",
|
|
17
18
|
"#capabilities": "./src/capabilities/index.ts",
|
|
18
19
|
"#containers": "./src/containers/index.ts",
|
|
19
|
-
"#meta": "./src/meta.ts"
|
|
20
|
+
"#meta": "./src/meta.ts",
|
|
21
|
+
"#translations": "./src/translations.ts"
|
|
20
22
|
},
|
|
21
23
|
"exports": {
|
|
22
24
|
".": {
|
|
23
25
|
"source": "./src/index.ts",
|
|
24
26
|
"types": "./dist/types/src/index.d.ts",
|
|
25
27
|
"browser": "./dist/lib/browser/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"./translations": {
|
|
30
|
+
"source": "./src/translations.ts",
|
|
31
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
32
|
+
"browser": "./dist/lib/browser/translations.mjs",
|
|
33
|
+
"node": "./dist/lib/node-esm/translations.mjs"
|
|
26
34
|
}
|
|
27
35
|
},
|
|
28
36
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -33,44 +41,43 @@
|
|
|
33
41
|
"dependencies": {
|
|
34
42
|
"@effect/ai": "0.33.2",
|
|
35
43
|
"effect": "3.20.0",
|
|
36
|
-
"@dxos/ai": "0.8.4-main.
|
|
37
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
38
|
-
"@dxos/app-toolkit": "0.8.4-main.
|
|
39
|
-
"@dxos/assistant": "0.8.4-main.
|
|
40
|
-
"@dxos/client": "0.8.4-main.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/echo": "0.8.4-main.
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/plugin-graph": "0.8.4-main.
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/types": "0.8.4-main.9be5663bfe",
|
|
55
|
-
"@dxos/util": "0.8.4-main.9be5663bfe",
|
|
56
|
-
"@dxos/react-ui-form": "0.8.4-main.9be5663bfe"
|
|
44
|
+
"@dxos/ai": "0.8.4-main.abd8ff62ef",
|
|
45
|
+
"@dxos/app-framework": "0.8.4-main.abd8ff62ef",
|
|
46
|
+
"@dxos/app-toolkit": "0.8.4-main.abd8ff62ef",
|
|
47
|
+
"@dxos/assistant": "0.8.4-main.abd8ff62ef",
|
|
48
|
+
"@dxos/client-protocol": "0.8.4-main.abd8ff62ef",
|
|
49
|
+
"@dxos/compute": "0.8.4-main.abd8ff62ef",
|
|
50
|
+
"@dxos/client": "0.8.4-main.abd8ff62ef",
|
|
51
|
+
"@dxos/echo": "0.8.4-main.abd8ff62ef",
|
|
52
|
+
"@dxos/effect": "0.8.4-main.abd8ff62ef",
|
|
53
|
+
"@dxos/invariant": "0.8.4-main.abd8ff62ef",
|
|
54
|
+
"@dxos/keys": "0.8.4-main.abd8ff62ef",
|
|
55
|
+
"@dxos/plugin-graph": "0.8.4-main.abd8ff62ef",
|
|
56
|
+
"@dxos/plugin-space": "0.8.4-main.abd8ff62ef",
|
|
57
|
+
"@dxos/react-client": "0.8.4-main.abd8ff62ef",
|
|
58
|
+
"@dxos/react-ui-form": "0.8.4-main.abd8ff62ef",
|
|
59
|
+
"@dxos/schema": "0.8.4-main.abd8ff62ef",
|
|
60
|
+
"@dxos/types": "0.8.4-main.abd8ff62ef",
|
|
61
|
+
"@dxos/util": "0.8.4-main.abd8ff62ef"
|
|
57
62
|
},
|
|
58
63
|
"devDependencies": {
|
|
59
|
-
"@storybook/react-vite": "^10.
|
|
64
|
+
"@storybook/react-vite": "^10.3.6",
|
|
60
65
|
"@types/react": "~19.2.7",
|
|
61
66
|
"@types/react-dom": "~19.2.3",
|
|
62
67
|
"react": "~19.2.3",
|
|
63
68
|
"react-dom": "~19.2.3",
|
|
64
|
-
"vite": "^
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
69
|
+
"vite": "^8.0.10",
|
|
70
|
+
"@dxos/functions-runtime": "0.8.4-main.abd8ff62ef",
|
|
71
|
+
"@dxos/plugin-testing": "0.8.4-main.abd8ff62ef",
|
|
72
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef",
|
|
73
|
+
"@dxos/storybook-utils": "0.8.4-main.abd8ff62ef",
|
|
74
|
+
"@dxos/echo-db": "0.8.4-main.abd8ff62ef"
|
|
68
75
|
},
|
|
69
76
|
"peerDependencies": {
|
|
70
77
|
"effect": "3.20.0",
|
|
71
78
|
"react": "~19.2.3",
|
|
72
79
|
"react-dom": "~19.2.3",
|
|
73
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
80
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef"
|
|
74
81
|
},
|
|
75
82
|
"publishConfig": {
|
|
76
83
|
"access": "public"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
8
|
+
import { createComposerTestApp } from '@dxos/plugin-testing/harness';
|
|
9
|
+
|
|
10
|
+
import { DailySummaryPlugin } from '#plugin';
|
|
11
|
+
|
|
12
|
+
import { meta } from './meta';
|
|
13
|
+
|
|
14
|
+
const moduleId = (name: string) => `${meta.id}.module.${name}`;
|
|
15
|
+
|
|
16
|
+
describe('DailySummaryPlugin', () => {
|
|
17
|
+
test('modules activate on the expected events', async ({ expect }) => {
|
|
18
|
+
await using harness = await createComposerTestApp({
|
|
19
|
+
plugins: [DailySummaryPlugin()],
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Modules expected to be active after a normal startup.
|
|
23
|
+
expect(harness.manager.getActive()).toEqual(
|
|
24
|
+
expect.arrayContaining([moduleId('AppGraphBuilder'), moduleId('ReactSurface')]),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// SetupArtifactDefinition is fired by AssistantPlugin, which can't be included here due to a workspace cycle.
|
|
28
|
+
await harness.fire(AppActivationEvents.SetupArtifactDefinition);
|
|
29
|
+
expect(harness.manager.getActive()).toContain(moduleId('BlueprintDefinition'));
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -7,8 +7,7 @@ import { AppPlugin } from '@dxos/app-toolkit';
|
|
|
7
7
|
|
|
8
8
|
import { AppGraphBuilder, BlueprintDefinition, ReactSurface } from '#capabilities';
|
|
9
9
|
import { meta } from '#meta';
|
|
10
|
-
|
|
11
|
-
import { translations } from './translations';
|
|
10
|
+
import { translations } from '#translations';
|
|
12
11
|
|
|
13
12
|
export const DailySummaryPlugin = Plugin.define(meta).pipe(
|
|
14
13
|
AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
@@ -17,3 +16,5 @@ export const DailySummaryPlugin = Plugin.define(meta).pipe(
|
|
|
17
16
|
AppPlugin.addTranslationsModule({ translations }),
|
|
18
17
|
Plugin.make,
|
|
19
18
|
);
|
|
19
|
+
|
|
20
|
+
export default DailySummaryPlugin;
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// Copyright 2026 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { Blueprint, Template } from '@dxos/blueprints';
|
|
5
|
+
import { Blueprint, Template } from '@dxos/compute';
|
|
7
6
|
import { trim } from '@dxos/util';
|
|
8
7
|
|
|
9
8
|
import { DailySummaryHandlers, GenerateSummary } from './functions';
|
|
@@ -29,7 +28,7 @@ const make = () =>
|
|
|
29
28
|
}),
|
|
30
29
|
});
|
|
31
30
|
|
|
32
|
-
const blueprint:
|
|
31
|
+
const blueprint: Blueprint.Definition = {
|
|
33
32
|
key: BLUEPRINT_KEY,
|
|
34
33
|
make,
|
|
35
34
|
};
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { AiService } from '@dxos/ai';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
8
9
|
import { Database } from '@dxos/echo';
|
|
9
|
-
import { Operation } from '@dxos/operation';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Generates a daily summary of recently modified objects using AI.
|
|
@@ -6,12 +6,11 @@ import { describe, expect, it } from '@effect/vitest';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import * as Schema from 'effect/Schema';
|
|
8
8
|
|
|
9
|
-
import { AssistantTestLayer } from '@dxos/assistant/testing';
|
|
10
|
-
import { Blueprint } from '@dxos/blueprints';
|
|
11
9
|
import { SpaceProperties } from '@dxos/client-protocol';
|
|
10
|
+
import { Blueprint, Operation } from '@dxos/compute';
|
|
12
11
|
import { Collection, DXN, Database, Obj, Query, Ref, Type } from '@dxos/echo';
|
|
13
12
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
14
|
-
import {
|
|
13
|
+
import { AssistantTestLayer } from '@dxos/functions-runtime/testing';
|
|
15
14
|
import { ObjectId } from '@dxos/keys';
|
|
16
15
|
import { Text } from '@dxos/schema';
|
|
17
16
|
import { HasSubject } from '@dxos/types';
|
|
@@ -44,12 +43,13 @@ const TestLayer = AssistantTestLayer({
|
|
|
44
43
|
tracing: 'pretty',
|
|
45
44
|
});
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
// TODO: Requires a live ECHO database — not available in CI.
|
|
47
|
+
describe.skip('GenerateSummary', () => {
|
|
48
48
|
it.effect(
|
|
49
49
|
'creates a Markdown document with summary content',
|
|
50
50
|
Effect.fnUntraced(
|
|
51
51
|
function* (_) {
|
|
52
|
-
const result = yield*
|
|
52
|
+
const result = yield* Operation.invoke(GenerateSummary, {
|
|
53
53
|
lookbackHours: 24,
|
|
54
54
|
});
|
|
55
55
|
|
|
@@ -73,7 +73,7 @@ describe('GenerateSummary', () => {
|
|
|
73
73
|
'creates a "Summaries" collection if none exists',
|
|
74
74
|
Effect.fnUntraced(
|
|
75
75
|
function* (_) {
|
|
76
|
-
yield*
|
|
76
|
+
yield* Operation.invoke(GenerateSummary, {});
|
|
77
77
|
|
|
78
78
|
const collections = yield* Database.runQuery(Query.type(Collection.Collection, { name: 'Summaries' }));
|
|
79
79
|
expect(collections.length).toBe(1);
|
|
@@ -89,8 +89,8 @@ describe('GenerateSummary', () => {
|
|
|
89
89
|
'reuses existing "Summaries" collection on subsequent calls',
|
|
90
90
|
Effect.fnUntraced(
|
|
91
91
|
function* (_) {
|
|
92
|
-
yield*
|
|
93
|
-
yield*
|
|
92
|
+
yield* Operation.invoke(GenerateSummary, {});
|
|
93
|
+
yield* Operation.invoke(GenerateSummary, {});
|
|
94
94
|
|
|
95
95
|
const collections = yield* Database.runQuery(Query.type(Collection.Collection, { name: 'Summaries' }));
|
|
96
96
|
expect(collections.length).toBe(1);
|
|
@@ -107,7 +107,7 @@ describe('GenerateSummary', () => {
|
|
|
107
107
|
Effect.fnUntraced(
|
|
108
108
|
function* (_) {
|
|
109
109
|
const previousSummary = 'Yesterday was productive. 10 objects edited.';
|
|
110
|
-
const result = yield*
|
|
110
|
+
const result = yield* Operation.invoke(GenerateSummary, {
|
|
111
111
|
previousSummary,
|
|
112
112
|
lookbackHours: 24,
|
|
113
113
|
});
|
|
@@ -127,7 +127,7 @@ describe('GenerateSummary', () => {
|
|
|
127
127
|
'names document with today date',
|
|
128
128
|
Effect.fnUntraced(
|
|
129
129
|
function* (_) {
|
|
130
|
-
const result = yield*
|
|
130
|
+
const result = yield* Operation.invoke(GenerateSummary, {});
|
|
131
131
|
const today = new Date().toISOString().slice(0, 10);
|
|
132
132
|
expect(result.date).toBe(today);
|
|
133
133
|
|
|
@@ -9,9 +9,8 @@ import * as Layer from 'effect/Layer';
|
|
|
9
9
|
import * as Schema from 'effect/Schema';
|
|
10
10
|
|
|
11
11
|
import { AiService, ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
12
|
+
import { Trace, Operation, OperationRegistry } from '@dxos/compute';
|
|
12
13
|
import { Collection, Database, Filter, Obj, Query, Ref, Type } from '@dxos/echo';
|
|
13
|
-
import { FunctionInvocationService, TracingService } from '@dxos/functions';
|
|
14
|
-
import { Operation } from '@dxos/operation';
|
|
15
14
|
import { Text } from '@dxos/schema';
|
|
16
15
|
import { CollectionModel } from '@dxos/schema';
|
|
17
16
|
import { trim } from '@dxos/util';
|
|
@@ -109,8 +108,14 @@ export default GenerateSummary.pipe(
|
|
|
109
108
|
AiService.model('@anthropic/claude-haiku-4-5'),
|
|
110
109
|
ToolResolverService.layerEmpty,
|
|
111
110
|
ToolExecutionService.layerEmpty,
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
Database.notAvailable,
|
|
112
|
+
Layer.succeed(Operation.Service, {
|
|
113
|
+
invoke: () => Effect.die('Not available.'),
|
|
114
|
+
schedule: () => Effect.die('Not available.'),
|
|
115
|
+
invokePromise: async () => ({ error: new Error('Not available.') }),
|
|
116
|
+
} as any),
|
|
117
|
+
Layer.succeed(OperationRegistry.Service, { resolve: () => Effect.succeed(undefined) } as any),
|
|
118
|
+
Trace.writerLayerNoop,
|
|
114
119
|
),
|
|
115
120
|
),
|
|
116
121
|
),
|
|
@@ -158,13 +163,13 @@ const updateDocContent = Effect.fn(function* (doc: MarkdownDoc, newContent: stri
|
|
|
158
163
|
if (Ref.isRef(textRef)) {
|
|
159
164
|
const text: Text.Text | undefined = yield* Effect.promise(() => textRef.load());
|
|
160
165
|
if (text) {
|
|
161
|
-
Obj.
|
|
166
|
+
Obj.update(text, (text) => {
|
|
162
167
|
text.content = newContent;
|
|
163
168
|
});
|
|
164
169
|
return;
|
|
165
170
|
}
|
|
166
171
|
}
|
|
167
|
-
Obj.
|
|
172
|
+
Obj.update(doc, (doc) => {
|
|
168
173
|
doc.content = Ref.make(Text.make(newContent));
|
|
169
174
|
});
|
|
170
175
|
});
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
|
-
import { AppCapabilities, AppNode } from '@dxos/app-toolkit';
|
|
9
|
-
import { GraphBuilder
|
|
10
|
-
import { meta as spaceMeta } from '@dxos/plugin-space/meta';
|
|
8
|
+
import { AppCapabilities, AppNode, AppNodeMatcher } from '@dxos/app-toolkit';
|
|
9
|
+
import { GraphBuilder } from '@dxos/plugin-graph';
|
|
11
10
|
|
|
12
11
|
import { meta } from '#meta';
|
|
13
12
|
|
|
@@ -16,8 +15,8 @@ export default Capability.makeModule(
|
|
|
16
15
|
const extensions = yield* Effect.all([
|
|
17
16
|
GraphBuilder.createExtension({
|
|
18
17
|
id: 'space-settings-daily-summary',
|
|
19
|
-
match:
|
|
20
|
-
connector: (
|
|
18
|
+
match: AppNodeMatcher.whenSpace,
|
|
19
|
+
connector: () =>
|
|
21
20
|
Effect.succeed([
|
|
22
21
|
AppNode.makeSettingsPanel({
|
|
23
22
|
id: 'daily-summary',
|
|
@@ -6,6 +6,8 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
|
|
7
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
8
|
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
10
|
+
import type { Blueprint } from '@dxos/compute';
|
|
9
11
|
|
|
10
12
|
import { DailySummaryBlueprint } from '#blueprints';
|
|
11
13
|
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Capability } from '@dxos/app-framework';
|
|
6
|
+
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
7
|
+
import type { Blueprint } from '@dxos/compute';
|
|
6
8
|
|
|
7
9
|
export const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));
|
|
8
10
|
export const BlueprintDefinition = Capability.lazy('BlueprintDefinition', () => import('./blueprint-definition'));
|
|
@@ -17,8 +17,7 @@ export default Capability.makeModule(() =>
|
|
|
17
17
|
Capability.contributes(Capabilities.ReactSurface, [
|
|
18
18
|
Surface.create({
|
|
19
19
|
id: 'space-settings-daily-summary',
|
|
20
|
-
|
|
21
|
-
filter: AppSurface.literalSection(`${meta.id}.space-settings-daily-summary`),
|
|
20
|
+
filter: AppSurface.literal(AppSurface.Article, `${meta.id}.space-settings-daily-summary`),
|
|
22
21
|
component: () => {
|
|
23
22
|
const space = useActiveSpace();
|
|
24
23
|
if (!space) {
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { Trigger } from '@dxos/compute';
|
|
9
|
+
import { Operation } from '@dxos/compute';
|
|
10
|
+
import { Filter, Query, Ref } from '@dxos/echo';
|
|
11
11
|
import { useQuery } from '@dxos/react-client/echo';
|
|
12
12
|
import { IconButton, useTranslation } from '@dxos/react-ui';
|
|
13
13
|
import { Settings } from '@dxos/react-ui-form';
|
|
@@ -15,14 +15,13 @@ import { Settings } from '@dxos/react-ui-form';
|
|
|
15
15
|
import { GenerateSummary } from '#blueprints';
|
|
16
16
|
import { meta } from '#meta';
|
|
17
17
|
|
|
18
|
-
export
|
|
19
|
-
space: Space;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const DailySummarySettings = ({ space }: DailySummarySettingsProps) => {
|
|
18
|
+
export const DailySummarySettings = ({ space }: AppSurface.SpaceArticleProps) => {
|
|
23
19
|
const { t } = useTranslation(meta.id);
|
|
24
20
|
|
|
25
|
-
const triggers = useQuery(
|
|
21
|
+
const triggers = useQuery(
|
|
22
|
+
space.db,
|
|
23
|
+
Query.select(Filter.type(Trigger.Trigger)).debugLabel('plugin-daily-summary.DailySummarySettings'),
|
|
24
|
+
);
|
|
26
25
|
const existingTrigger = useMemo(
|
|
27
26
|
() =>
|
|
28
27
|
triggers.find((trigger) => {
|
|
@@ -43,10 +42,7 @@ export const DailySummarySettings = ({ space }: DailySummarySettingsProps) => {
|
|
|
43
42
|
}
|
|
44
43
|
const trigger = Trigger.make({
|
|
45
44
|
enabled: true,
|
|
46
|
-
spec:
|
|
47
|
-
kind: 'timer',
|
|
48
|
-
cron: '0 21 * * *',
|
|
49
|
-
},
|
|
45
|
+
spec: Trigger.specTimer('0 21 * * *'),
|
|
50
46
|
function: Ref.make(Operation.serialize(GenerateSummary)),
|
|
51
47
|
});
|
|
52
48
|
space.db.add(trigger);
|
package/src/index.ts
CHANGED
|
@@ -2,5 +2,10 @@
|
|
|
2
2
|
// Copyright 2026 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const DailySummaryPlugin = Plugin.lazy(meta, () => import('./DailySummaryPlugin'));
|
|
10
|
+
|
|
11
|
+
export * from './meta';
|
package/src/meta.test.ts
CHANGED
|
@@ -8,14 +8,14 @@ import { meta } from '#meta';
|
|
|
8
8
|
|
|
9
9
|
describe('plugin meta', () => {
|
|
10
10
|
test('has correct id', () => {
|
|
11
|
-
expect(meta.id).toBe('org.dxos.plugin.
|
|
11
|
+
expect(meta.id).toBe('org.dxos.plugin.dailySummary');
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
test('has required fields', () => {
|
|
15
15
|
expect(meta.name).toBe('Daily Summary');
|
|
16
16
|
expect(meta.description).toBeTruthy();
|
|
17
17
|
expect(meta.icon).toBe('ph--calendar-check--regular');
|
|
18
|
-
expect(meta.iconHue).toBe('
|
|
18
|
+
expect(meta.iconHue).toBe('sky');
|
|
19
19
|
expect(meta.source).toContain('plugin-daily-summary');
|
|
20
20
|
});
|
|
21
21
|
});
|
package/src/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
|
-
id: 'org.dxos.plugin.
|
|
9
|
+
id: 'org.dxos.plugin.dailySummary',
|
|
10
10
|
name: 'Daily Summary',
|
|
11
11
|
description: trim`
|
|
12
12
|
Generates a daily summary of your activity by querying objects edited in the last day
|
package/src/translations.test.ts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { meta } from '#meta';
|
|
8
|
-
|
|
9
|
-
import { translations } from './translations';
|
|
8
|
+
import { translations } from '#translations';
|
|
10
9
|
|
|
11
10
|
describe('translations', () => {
|
|
12
11
|
const enUS = translations[0]['en-US'];
|