@dxos/plugin-daily-summary 0.8.3 → 0.8.4-main.51f1e5ca51
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/index.mjs +20 -31
- 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/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 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- 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/containers/DailySummarySettings/index.d.ts +1 -2
- package/dist/types/src/containers/DailySummarySettings/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +5 -5
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -27
- package/src/DailySummaryPlugin.tsx +3 -3
- 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 -11
- package/src/blueprints/functions/generate.ts +14 -8
- package/src/blueprints/functions/index.ts +1 -1
- package/src/capabilities/app-graph-builder.ts +33 -0
- package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts} +1 -1
- package/src/capabilities/index.ts +6 -4
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +5 -6
- package/src/containers/DailySummarySettings/DailySummarySettings.tsx +25 -28
- package/src/containers/DailySummarySettings/index.ts +1 -3
- package/src/meta.test.ts +2 -2
- package/src/meta.ts +1 -1
- package/src/translations.test.ts +5 -5
- package/src/translations.ts +5 -4
- package/dist/lib/browser/DailySummarySettings-RF6P6R5M.mjs +0 -63
- package/dist/lib/browser/DailySummarySettings-RF6P6R5M.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-RHJEYETQ.mjs +0 -39
- package/dist/lib/browser/app-graph-builder-RHJEYETQ.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-XOEDPUVU.mjs +0 -53
- package/dist/lib/browser/blueprint-definition-XOEDPUVU.mjs.map +0 -7
- package/dist/lib/browser/chunk-2TNDFGQB.mjs +0 -21
- package/dist/lib/browser/chunk-2TNDFGQB.mjs.map +0 -7
- package/dist/lib/browser/chunk-UYXGTD3T.mjs +0 -40
- package/dist/lib/browser/chunk-UYXGTD3T.mjs.map +0 -7
- package/dist/lib/browser/generate-FSSCIHAO.mjs +0 -172
- package/dist/lib/browser/generate-FSSCIHAO.mjs.map +0 -7
- package/dist/lib/browser/react-surface-WCGJVZCQ.mjs +0 -36
- package/dist/lib/browser/react-surface-WCGJVZCQ.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -37
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/react-surface/index.ts +0 -7
- /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-daily-summary",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4-main.51f1e5ca51",
|
|
4
4
|
"description": "Daily activity summary plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -12,11 +12,24 @@
|
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#blueprints": "./src/blueprints/index.ts",
|
|
17
|
+
"#capabilities": "./src/capabilities/index.ts",
|
|
18
|
+
"#containers": "./src/containers/index.ts",
|
|
19
|
+
"#meta": "./src/meta.ts",
|
|
20
|
+
"#translations": "./src/translations.ts"
|
|
21
|
+
},
|
|
15
22
|
"exports": {
|
|
16
23
|
".": {
|
|
17
24
|
"source": "./src/index.ts",
|
|
18
25
|
"types": "./dist/types/src/index.d.ts",
|
|
19
26
|
"browser": "./dist/lib/browser/index.mjs"
|
|
27
|
+
},
|
|
28
|
+
"./translations": {
|
|
29
|
+
"source": "./src/translations.ts",
|
|
30
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
31
|
+
"browser": "./dist/lib/browser/translations.mjs",
|
|
32
|
+
"node": "./dist/lib/node-esm/translations.mjs"
|
|
20
33
|
}
|
|
21
34
|
},
|
|
22
35
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -27,43 +40,42 @@
|
|
|
27
40
|
"dependencies": {
|
|
28
41
|
"@effect/ai": "0.33.2",
|
|
29
42
|
"effect": "3.20.0",
|
|
30
|
-
"@dxos/ai": "0.8.
|
|
31
|
-
"@dxos/app-toolkit": "0.8.
|
|
32
|
-
"@dxos/app-framework": "0.8.
|
|
33
|
-
"@dxos/client": "0.8.
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/effect": "0.8.
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/react-client": "0.8.
|
|
46
|
-
"@dxos/types": "0.8.
|
|
47
|
-
"@dxos/util": "0.8.
|
|
48
|
-
"@dxos/plugin-graph": "0.8.3",
|
|
49
|
-
"@dxos/schema": "0.8.3"
|
|
43
|
+
"@dxos/ai": "0.8.4-main.51f1e5ca51",
|
|
44
|
+
"@dxos/app-toolkit": "0.8.4-main.51f1e5ca51",
|
|
45
|
+
"@dxos/app-framework": "0.8.4-main.51f1e5ca51",
|
|
46
|
+
"@dxos/client": "0.8.4-main.51f1e5ca51",
|
|
47
|
+
"@dxos/client-protocol": "0.8.4-main.51f1e5ca51",
|
|
48
|
+
"@dxos/assistant": "0.8.4-main.51f1e5ca51",
|
|
49
|
+
"@dxos/compute": "0.8.4-main.51f1e5ca51",
|
|
50
|
+
"@dxos/echo": "0.8.4-main.51f1e5ca51",
|
|
51
|
+
"@dxos/effect": "0.8.4-main.51f1e5ca51",
|
|
52
|
+
"@dxos/invariant": "0.8.4-main.51f1e5ca51",
|
|
53
|
+
"@dxos/keys": "0.8.4-main.51f1e5ca51",
|
|
54
|
+
"@dxos/plugin-space": "0.8.4-main.51f1e5ca51",
|
|
55
|
+
"@dxos/plugin-graph": "0.8.4-main.51f1e5ca51",
|
|
56
|
+
"@dxos/react-ui-form": "0.8.4-main.51f1e5ca51",
|
|
57
|
+
"@dxos/schema": "0.8.4-main.51f1e5ca51",
|
|
58
|
+
"@dxos/react-client": "0.8.4-main.51f1e5ca51",
|
|
59
|
+
"@dxos/types": "0.8.4-main.51f1e5ca51",
|
|
60
|
+
"@dxos/util": "0.8.4-main.51f1e5ca51"
|
|
50
61
|
},
|
|
51
62
|
"devDependencies": {
|
|
52
|
-
"@storybook/react-vite": "^10.
|
|
63
|
+
"@storybook/react-vite": "^10.3.6",
|
|
53
64
|
"@types/react": "~19.2.7",
|
|
54
65
|
"@types/react-dom": "~19.2.3",
|
|
55
66
|
"react": "~19.2.3",
|
|
56
67
|
"react-dom": "~19.2.3",
|
|
57
|
-
"vite": "^
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
68
|
+
"vite": "^8.0.10",
|
|
69
|
+
"@dxos/echo-db": "0.8.4-main.51f1e5ca51",
|
|
70
|
+
"@dxos/functions-runtime": "0.8.4-main.51f1e5ca51",
|
|
71
|
+
"@dxos/react-ui": "0.8.4-main.51f1e5ca51",
|
|
72
|
+
"@dxos/storybook-utils": "0.8.4-main.51f1e5ca51"
|
|
61
73
|
},
|
|
62
74
|
"peerDependencies": {
|
|
63
75
|
"effect": "3.20.0",
|
|
64
76
|
"react": "~19.2.3",
|
|
65
77
|
"react-dom": "~19.2.3",
|
|
66
|
-
"@dxos/react-ui": "0.8.
|
|
78
|
+
"@dxos/react-ui": "0.8.4-main.51f1e5ca51"
|
|
67
79
|
},
|
|
68
80
|
"publishConfig": {
|
|
69
81
|
"access": "public"
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import { Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { AppPlugin } from '@dxos/app-toolkit';
|
|
7
7
|
|
|
8
|
-
import { AppGraphBuilder, BlueprintDefinition, ReactSurface } from '
|
|
9
|
-
import { meta } from '
|
|
10
|
-
import { translations } from '
|
|
8
|
+
import { AppGraphBuilder, BlueprintDefinition, ReactSurface } from '#capabilities';
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
import { translations } from '#translations';
|
|
11
11
|
|
|
12
12
|
export const DailySummaryPlugin = Plugin.define(meta).pipe(
|
|
13
13
|
AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
@@ -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.
|
|
@@ -3,21 +3,20 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { describe, expect, it } from '@effect/vitest';
|
|
6
|
-
import * as Schema from 'effect/Schema';
|
|
7
6
|
import * as Effect from 'effect/Effect';
|
|
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 } from '@dxos/compute';
|
|
11
|
+
import { Operation } from '@dxos/compute';
|
|
12
12
|
import { Collection, DXN, Database, Obj, Query, Ref, Type } from '@dxos/echo';
|
|
13
13
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
14
|
-
import {
|
|
14
|
+
import { AssistantTestLayer } from '@dxos/functions-runtime/testing';
|
|
15
15
|
import { ObjectId } from '@dxos/keys';
|
|
16
16
|
import { Text } from '@dxos/schema';
|
|
17
17
|
import { HasSubject } from '@dxos/types';
|
|
18
18
|
|
|
19
19
|
import { DailySummaryHandlers } from '../daily-summary-blueprint';
|
|
20
|
-
|
|
21
20
|
import { GenerateSummary } from './definitions';
|
|
22
21
|
|
|
23
22
|
ObjectId.dangerouslyDisableRandomness();
|
|
@@ -50,7 +49,7 @@ describe('GenerateSummary', () => {
|
|
|
50
49
|
'creates a Markdown document with summary content',
|
|
51
50
|
Effect.fnUntraced(
|
|
52
51
|
function* (_) {
|
|
53
|
-
const result = yield*
|
|
52
|
+
const result = yield* Operation.invoke(GenerateSummary, {
|
|
54
53
|
lookbackHours: 24,
|
|
55
54
|
});
|
|
56
55
|
|
|
@@ -74,7 +73,7 @@ describe('GenerateSummary', () => {
|
|
|
74
73
|
'creates a "Summaries" collection if none exists',
|
|
75
74
|
Effect.fnUntraced(
|
|
76
75
|
function* (_) {
|
|
77
|
-
yield*
|
|
76
|
+
yield* Operation.invoke(GenerateSummary, {});
|
|
78
77
|
|
|
79
78
|
const collections = yield* Database.runQuery(Query.type(Collection.Collection, { name: 'Summaries' }));
|
|
80
79
|
expect(collections.length).toBe(1);
|
|
@@ -90,8 +89,8 @@ describe('GenerateSummary', () => {
|
|
|
90
89
|
'reuses existing "Summaries" collection on subsequent calls',
|
|
91
90
|
Effect.fnUntraced(
|
|
92
91
|
function* (_) {
|
|
93
|
-
yield*
|
|
94
|
-
yield*
|
|
92
|
+
yield* Operation.invoke(GenerateSummary, {});
|
|
93
|
+
yield* Operation.invoke(GenerateSummary, {});
|
|
95
94
|
|
|
96
95
|
const collections = yield* Database.runQuery(Query.type(Collection.Collection, { name: 'Summaries' }));
|
|
97
96
|
expect(collections.length).toBe(1);
|
|
@@ -108,7 +107,7 @@ describe('GenerateSummary', () => {
|
|
|
108
107
|
Effect.fnUntraced(
|
|
109
108
|
function* (_) {
|
|
110
109
|
const previousSummary = 'Yesterday was productive. 10 objects edited.';
|
|
111
|
-
const result = yield*
|
|
110
|
+
const result = yield* Operation.invoke(GenerateSummary, {
|
|
112
111
|
previousSummary,
|
|
113
112
|
lookbackHours: 24,
|
|
114
113
|
});
|
|
@@ -128,7 +127,7 @@ describe('GenerateSummary', () => {
|
|
|
128
127
|
'names document with today date',
|
|
129
128
|
Effect.fnUntraced(
|
|
130
129
|
function* (_) {
|
|
131
|
-
const result = yield*
|
|
130
|
+
const result = yield* Operation.invoke(GenerateSummary, {});
|
|
132
131
|
const today = new Date().toISOString().slice(0, 10);
|
|
133
132
|
expect(result.date).toBe(today);
|
|
134
133
|
|
|
@@ -9,9 +9,9 @@ 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 } from '@dxos/compute';
|
|
13
|
+
import { Operation, OperationRegistry } from '@dxos/compute';
|
|
12
14
|
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
15
|
import { Text } from '@dxos/schema';
|
|
16
16
|
import { CollectionModel } from '@dxos/schema';
|
|
17
17
|
import { trim } from '@dxos/util';
|
|
@@ -109,8 +109,14 @@ export default GenerateSummary.pipe(
|
|
|
109
109
|
AiService.model('@anthropic/claude-haiku-4-5'),
|
|
110
110
|
ToolResolverService.layerEmpty,
|
|
111
111
|
ToolExecutionService.layerEmpty,
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
Database.notAvailable,
|
|
113
|
+
Layer.succeed(Operation.Service, {
|
|
114
|
+
invoke: () => Effect.die('Not available.'),
|
|
115
|
+
schedule: () => Effect.die('Not available.'),
|
|
116
|
+
invokePromise: async () => ({ error: new Error('Not available.') }),
|
|
117
|
+
} as any),
|
|
118
|
+
Layer.succeed(OperationRegistry.Service, { resolve: () => Effect.succeed(undefined) } as any),
|
|
119
|
+
Trace.writerLayerNoop,
|
|
114
120
|
),
|
|
115
121
|
),
|
|
116
122
|
),
|
|
@@ -158,14 +164,14 @@ const updateDocContent = Effect.fn(function* (doc: MarkdownDoc, newContent: stri
|
|
|
158
164
|
if (Ref.isRef(textRef)) {
|
|
159
165
|
const text: Text.Text | undefined = yield* Effect.promise(() => textRef.load());
|
|
160
166
|
if (text) {
|
|
161
|
-
Obj.
|
|
162
|
-
|
|
167
|
+
Obj.update(text, (text) => {
|
|
168
|
+
text.content = newContent;
|
|
163
169
|
});
|
|
164
170
|
return;
|
|
165
171
|
}
|
|
166
172
|
}
|
|
167
|
-
Obj.
|
|
168
|
-
|
|
173
|
+
Obj.update(doc, (doc) => {
|
|
174
|
+
doc.content = Ref.make(Text.make(newContent));
|
|
169
175
|
});
|
|
170
176
|
});
|
|
171
177
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities, AppNode, AppNodeMatcher } from '@dxos/app-toolkit';
|
|
9
|
+
import { GraphBuilder } from '@dxos/plugin-graph';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
export default Capability.makeModule(
|
|
14
|
+
Effect.fnUntraced(function* () {
|
|
15
|
+
const extensions = yield* Effect.all([
|
|
16
|
+
GraphBuilder.createExtension({
|
|
17
|
+
id: 'space-settings-daily-summary',
|
|
18
|
+
match: AppNodeMatcher.whenSpace,
|
|
19
|
+
connector: () =>
|
|
20
|
+
Effect.succeed([
|
|
21
|
+
AppNode.makeSettingsPanel({
|
|
22
|
+
id: 'daily-summary',
|
|
23
|
+
type: `${meta.id}.space-settings-daily-summary`,
|
|
24
|
+
label: ['plugin.name', { ns: meta.id }],
|
|
25
|
+
icon: 'ph--calendar-check--regular',
|
|
26
|
+
}),
|
|
27
|
+
]),
|
|
28
|
+
}),
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
32
|
+
}),
|
|
33
|
+
);
|
package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts}
RENAMED
|
@@ -7,7 +7,7 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
8
|
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
9
|
|
|
10
|
-
import { DailySummaryBlueprint } from '
|
|
10
|
+
import { DailySummaryBlueprint } from '#blueprints';
|
|
11
11
|
|
|
12
12
|
const blueprintDefinition = Capability.makeModule<
|
|
13
13
|
[],
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
export const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));
|
|
8
|
+
export const BlueprintDefinition = Capability.lazy('BlueprintDefinition', () => import('./blueprint-definition'));
|
|
9
|
+
export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
|
|
@@ -7,18 +7,17 @@ import React from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
9
|
import { Surface } from '@dxos/app-framework/ui';
|
|
10
|
-
import { useActiveSpace } from '@dxos/
|
|
10
|
+
import { AppSurface, useActiveSpace } from '@dxos/app-toolkit/ui';
|
|
11
11
|
|
|
12
|
-
import { DailySummarySettings } from '
|
|
13
|
-
import { meta } from '
|
|
12
|
+
import { DailySummarySettings } from '#containers';
|
|
13
|
+
import { meta } from '#meta';
|
|
14
14
|
|
|
15
15
|
export default Capability.makeModule(() =>
|
|
16
16
|
Effect.succeed(
|
|
17
17
|
Capability.contributes(Capabilities.ReactSurface, [
|
|
18
18
|
Surface.create({
|
|
19
|
-
id:
|
|
20
|
-
|
|
21
|
-
filter: (data): data is { subject: string } => data.subject === `${meta.id}.space-settings-daily-summary`,
|
|
19
|
+
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,24 +4,24 @@
|
|
|
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
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
13
14
|
|
|
14
|
-
import { GenerateSummary } from '
|
|
15
|
-
import { meta } from '
|
|
15
|
+
import { GenerateSummary } from '#blueprints';
|
|
16
|
+
import { meta } from '#meta';
|
|
16
17
|
|
|
17
|
-
export
|
|
18
|
-
space: Space;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const DailySummarySettings = ({ space }: DailySummarySettingsProps) => {
|
|
18
|
+
export const DailySummarySettings = ({ space }: AppSurface.SpaceArticleProps) => {
|
|
22
19
|
const { t } = useTranslation(meta.id);
|
|
23
20
|
|
|
24
|
-
const triggers = useQuery(
|
|
21
|
+
const triggers = useQuery(
|
|
22
|
+
space.db,
|
|
23
|
+
Query.select(Filter.type(Trigger.Trigger)).debugLabel('plugin-daily-summary.DailySummarySettings'),
|
|
24
|
+
);
|
|
25
25
|
const existingTrigger = useMemo(
|
|
26
26
|
() =>
|
|
27
27
|
triggers.find((trigger) => {
|
|
@@ -42,27 +42,24 @@ export const DailySummarySettings = ({ space }: DailySummarySettingsProps) => {
|
|
|
42
42
|
}
|
|
43
43
|
const trigger = Trigger.make({
|
|
44
44
|
enabled: true,
|
|
45
|
-
spec:
|
|
46
|
-
kind: 'timer',
|
|
47
|
-
cron: '0 21 * * *',
|
|
48
|
-
},
|
|
45
|
+
spec: Trigger.specTimer('0 21 * * *'),
|
|
49
46
|
function: Ref.make(Operation.serialize(GenerateSummary)),
|
|
50
47
|
});
|
|
51
48
|
space.db.add(trigger);
|
|
52
49
|
}, [space, existingTrigger]);
|
|
53
50
|
|
|
54
51
|
return (
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
</
|
|
66
|
-
</
|
|
52
|
+
<Settings.Viewport>
|
|
53
|
+
<Settings.Section title={t('settings.summary.label')}>
|
|
54
|
+
<Settings.Panel>
|
|
55
|
+
<IconButton
|
|
56
|
+
icon={existingTrigger ? 'ph--check--regular' : 'ph--plus--regular'}
|
|
57
|
+
label={t('create-trigger.label')}
|
|
58
|
+
onClick={handleCreateTrigger}
|
|
59
|
+
disabled={!!existingTrigger}
|
|
60
|
+
/>
|
|
61
|
+
</Settings.Panel>
|
|
62
|
+
</Settings.Section>
|
|
63
|
+
</Settings.Viewport>
|
|
67
64
|
);
|
|
68
65
|
};
|
package/src/meta.test.ts
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
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', () => {
|
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
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
8
|
-
import { translations } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
|
+
import { translations } from '#translations';
|
|
9
9
|
|
|
10
10
|
describe('translations', () => {
|
|
11
11
|
const enUS = translations[0]['en-US'];
|
|
@@ -13,8 +13,8 @@ describe('translations', () => {
|
|
|
13
13
|
test('has plugin translations', () => {
|
|
14
14
|
const pluginTranslations = enUS[meta.id];
|
|
15
15
|
expect(pluginTranslations).toBeDefined();
|
|
16
|
-
expect(pluginTranslations['plugin
|
|
17
|
-
expect(pluginTranslations['create
|
|
18
|
-
expect(pluginTranslations['create
|
|
16
|
+
expect(pluginTranslations['plugin.name']).toBe('Daily Summary');
|
|
17
|
+
expect(pluginTranslations['create-trigger.label']).toBeTruthy();
|
|
18
|
+
expect(pluginTranslations['create-trigger.description']).toBeTruthy();
|
|
19
19
|
});
|
|
20
20
|
});
|
package/src/translations.ts
CHANGED
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
|
-
'plugin
|
|
14
|
-
'
|
|
15
|
-
'create
|
|
13
|
+
'plugin.name': 'Daily Summary',
|
|
14
|
+
'settings.summary.label': 'Manage Daily Summary',
|
|
15
|
+
'create-trigger.label': 'Create daily summary trigger',
|
|
16
|
+
'create-trigger.description':
|
|
16
17
|
'Create a timer trigger that generates an AI-powered daily summary. After creation, edit the schedule in the Automation panel.',
|
|
17
18
|
},
|
|
18
19
|
},
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GenerateSummary
|
|
3
|
-
} from "./chunk-UYXGTD3T.mjs";
|
|
4
|
-
import {
|
|
5
|
-
meta
|
|
6
|
-
} from "./chunk-2TNDFGQB.mjs";
|
|
7
|
-
|
|
8
|
-
// src/containers/DailySummarySettings/DailySummarySettings.tsx
|
|
9
|
-
import React, { useCallback, useMemo } from "react";
|
|
10
|
-
import { Filter, Ref } from "@dxos/echo";
|
|
11
|
-
import { Trigger } from "@dxos/functions";
|
|
12
|
-
import { Operation } from "@dxos/operation";
|
|
13
|
-
import { useQuery } from "@dxos/react-client/echo";
|
|
14
|
-
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
15
|
-
var DailySummarySettings = ({ space }) => {
|
|
16
|
-
const { t } = useTranslation(meta.id);
|
|
17
|
-
const triggers = useQuery(space.db, Filter.type(Trigger.Trigger));
|
|
18
|
-
const existingTrigger = useMemo(() => triggers.find((trigger) => {
|
|
19
|
-
if (trigger.spec?.kind !== "timer") {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
const target = trigger.function?.target;
|
|
23
|
-
return target != null && "key" in target && target.key === GenerateSummary.meta.key;
|
|
24
|
-
}), [
|
|
25
|
-
triggers
|
|
26
|
-
]);
|
|
27
|
-
const handleCreateTrigger = useCallback(() => {
|
|
28
|
-
if (existingTrigger) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const trigger = Trigger.make({
|
|
32
|
-
enabled: true,
|
|
33
|
-
spec: {
|
|
34
|
-
kind: "timer",
|
|
35
|
-
cron: "0 21 * * *"
|
|
36
|
-
},
|
|
37
|
-
function: Ref.make(Operation.serialize(GenerateSummary))
|
|
38
|
-
});
|
|
39
|
-
space.db.add(trigger);
|
|
40
|
-
}, [
|
|
41
|
-
space,
|
|
42
|
-
existingTrigger
|
|
43
|
-
]);
|
|
44
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
45
|
-
className: "flex flex-col gap-4 p-4"
|
|
46
|
-
}, /* @__PURE__ */ React.createElement("h2", {
|
|
47
|
-
className: "text-lg font-medium"
|
|
48
|
-
}, t("plugin name")), /* @__PURE__ */ React.createElement("p", {
|
|
49
|
-
className: "text-sm text-description"
|
|
50
|
-
}, t("create trigger description")), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(IconButton, {
|
|
51
|
-
icon: existingTrigger ? "ph--check--regular" : "ph--plus--regular",
|
|
52
|
-
label: t("create trigger label"),
|
|
53
|
-
onClick: handleCreateTrigger,
|
|
54
|
-
disabled: !!existingTrigger
|
|
55
|
-
})));
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
// src/containers/DailySummarySettings/index.ts
|
|
59
|
-
var DailySummarySettings_default = DailySummarySettings;
|
|
60
|
-
export {
|
|
61
|
-
DailySummarySettings_default as default
|
|
62
|
-
};
|
|
63
|
-
//# sourceMappingURL=DailySummarySettings-RF6P6R5M.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/containers/DailySummarySettings/DailySummarySettings.tsx", "../../../src/containers/DailySummarySettings/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport type { Space } from '@dxos/client/echo';\nimport { Filter, Ref } from '@dxos/echo';\nimport { Trigger } from '@dxos/functions';\nimport { Operation } from '@dxos/operation';\nimport { useQuery } from '@dxos/react-client/echo';\nimport { IconButton, useTranslation } from '@dxos/react-ui';\n\nimport { GenerateSummary } from '../../blueprints/functions/definitions';\nimport { meta } from '../../meta';\n\nexport type DailySummarySettingsProps = {\n space: Space;\n};\n\nexport const DailySummarySettings = ({ space }: DailySummarySettingsProps) => {\n const { t } = useTranslation(meta.id);\n\n const triggers = useQuery(space.db, Filter.type(Trigger.Trigger));\n const existingTrigger = useMemo(\n () =>\n triggers.find((trigger) => {\n if (trigger.spec?.kind !== 'timer') {\n return false;\n }\n const target = trigger.function?.target;\n return (\n target != null && 'key' in target && (target as Record<string, unknown>).key === GenerateSummary.meta.key\n );\n }),\n [triggers],\n );\n\n const handleCreateTrigger = useCallback(() => {\n if (existingTrigger) {\n return;\n }\n const trigger = Trigger.make({\n enabled: true,\n spec: {\n kind: 'timer',\n cron: '0 21 * * *',\n },\n function: Ref.make(Operation.serialize(GenerateSummary)),\n });\n space.db.add(trigger);\n }, [space, existingTrigger]);\n\n return (\n <div className='flex flex-col gap-4 p-4'>\n <h2 className='text-lg font-medium'>{t('plugin name')}</h2>\n <p className='text-sm text-description'>{t('create trigger description')}</p>\n <div>\n <IconButton\n icon={existingTrigger ? 'ph--check--regular' : 'ph--plus--regular'}\n label={t('create trigger label')}\n onClick={handleCreateTrigger}\n disabled={!!existingTrigger}\n />\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { DailySummarySettings } from './DailySummarySettings';\n\nexport default DailySummarySettings;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAIA,OAAOA,SAASC,aAAaC,eAAe;AAG5C,SAASC,QAAQC,WAAW;AAC5B,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;AACzB,SAASC,YAAYC,sBAAsB;AASpC,IAAMC,uBAAuB,CAAC,EAAEC,MAAK,MAA6B;AACvE,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AAEpC,QAAMC,WAAWC,SAASN,MAAMO,IAAIC,OAAOC,KAAKC,QAAQA,OAAO,CAAA;AAC/D,QAAMC,kBAAkBC,QACtB,MACEP,SAASQ,KAAK,CAACC,YAAAA;AACb,QAAIA,QAAQC,MAAMC,SAAS,SAAS;AAClC,aAAO;IACT;AACA,UAAMC,SAASH,QAAQI,UAAUD;AACjC,WACEA,UAAU,QAAQ,SAASA,UAAWA,OAAmCE,QAAQC,gBAAgBjB,KAAKgB;EAE1G,CAAA,GACF;IAACd;GAAS;AAGZ,QAAMgB,sBAAsBC,YAAY,MAAA;AACtC,QAAIX,iBAAiB;AACnB;IACF;AACA,UAAMG,UAAUJ,QAAQa,KAAK;MAC3BC,SAAS;MACTT,MAAM;QACJC,MAAM;QACNS,MAAM;MACR;MACAP,UAAUQ,IAAIH,KAAKI,UAAUC,UAAUR,eAAAA,CAAAA;IACzC,CAAA;AACApB,UAAMO,GAAGsB,IAAIf,OAAAA;EACf,GAAG;IAACd;IAAOW;GAAgB;AAE3B,SACE,sBAAA,cAACmB,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAACC,MAAAA;IAAGD,WAAU;KAAuB9B,EAAE,aAAA,CAAA,GACvC,sBAAA,cAACgC,KAAAA;IAAEF,WAAU;KAA4B9B,EAAE,4BAAA,CAAA,GAC3C,sBAAA,cAAC6B,OAAAA,MACC,sBAAA,cAACI,YAAAA;IACCC,MAAMxB,kBAAkB,uBAAuB;IAC/CyB,OAAOnC,EAAE,sBAAA;IACToC,SAAShB;IACTiB,UAAU,CAAC,CAAC3B;;AAKtB;;;AC7DA,IAAA,+BAAe4B;",
|
|
6
|
-
"names": ["React", "useCallback", "useMemo", "Filter", "Ref", "Trigger", "Operation", "useQuery", "IconButton", "useTranslation", "DailySummarySettings", "space", "t", "useTranslation", "meta", "id", "triggers", "useQuery", "db", "Filter", "type", "Trigger", "existingTrigger", "useMemo", "find", "trigger", "spec", "kind", "target", "function", "key", "GenerateSummary", "handleCreateTrigger", "useCallback", "make", "enabled", "cron", "Ref", "Operation", "serialize", "add", "div", "className", "h2", "p", "IconButton", "icon", "label", "onClick", "disabled", "DailySummarySettings"]
|
|
7
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
meta
|
|
3
|
-
} from "./chunk-2TNDFGQB.mjs";
|
|
4
|
-
|
|
5
|
-
// src/capabilities/app-graph-builder/app-graph-builder.ts
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
-
import { Capability } from "@dxos/app-framework";
|
|
8
|
-
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
9
|
-
import { GraphBuilder, NodeMatcher } from "@dxos/plugin-graph";
|
|
10
|
-
import { meta as spaceMeta } from "@dxos/plugin-space";
|
|
11
|
-
var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
12
|
-
const extensions = yield* Effect.all([
|
|
13
|
-
GraphBuilder.createExtension({
|
|
14
|
-
id: `${meta.id}.space-settings-daily-summary`,
|
|
15
|
-
match: NodeMatcher.whenNodeType(`${spaceMeta.id}.settings`),
|
|
16
|
-
connector: (node) => Effect.succeed([
|
|
17
|
-
{
|
|
18
|
-
id: `${meta.id}.daily-summary`,
|
|
19
|
-
type: `${meta.id}.space-settings-daily-summary`,
|
|
20
|
-
data: `${meta.id}.space-settings-daily-summary`,
|
|
21
|
-
properties: {
|
|
22
|
-
label: [
|
|
23
|
-
"plugin name",
|
|
24
|
-
{
|
|
25
|
-
ns: meta.id
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
icon: "ph--calendar-check--regular"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
])
|
|
32
|
-
})
|
|
33
|
-
]);
|
|
34
|
-
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
35
|
-
}));
|
|
36
|
-
export {
|
|
37
|
-
app_graph_builder_default as default
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=app-graph-builder-RHJEYETQ.mjs.map
|