@dxos/plugin-daily-summary 0.8.4-main.bcb3aa67d6 → 0.8.4-main.dfabb4ec29
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/neutral/DailySummaryPlugin.mjs +21 -0
- package/dist/lib/neutral/DailySummaryPlugin.mjs.map +7 -0
- package/dist/lib/neutral/DailySummarySettings-RO4ZS7HJ.mjs +49 -0
- package/dist/lib/neutral/DailySummarySettings-RO4ZS7HJ.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-BTDLYMIG.mjs +32 -0
- package/dist/lib/neutral/app-graph-builder-BTDLYMIG.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-QLGURVVR.mjs +13 -0
- package/dist/lib/neutral/blueprint-definition-QLGURVVR.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +15 -0
- package/dist/lib/neutral/blueprints/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +11 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-7Q6EW2T4.mjs +45 -0
- package/dist/lib/neutral/chunk-7Q6EW2T4.mjs.map +7 -0
- package/dist/lib/neutral/chunk-N62WIXKJ.mjs +40 -0
- package/dist/lib/neutral/chunk-N62WIXKJ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-PDAIPXYM.mjs +21 -0
- package/dist/lib/neutral/chunk-PDAIPXYM.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +7 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/generate-GMQ2UTV4.mjs +183 -0
- package/dist/lib/neutral/generate-GMQ2UTV4.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +19 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +7 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +11 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-2Y7H4PUA.mjs +27 -0
- package/dist/lib/neutral/react-surface-2Y7H4PUA.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +18 -0
- package/dist/lib/neutral/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/containers/DailySummarySettings/index.d.ts +1 -2
- package/dist/types/src/containers/DailySummarySettings/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- 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 +68 -33
- package/src/DailySummaryPlugin.test.ts +31 -0
- package/src/DailySummaryPlugin.tsx +4 -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 +11 -12
- package/src/blueprints/functions/generate.ts +14 -9
- package/src/blueprints/functions/index.ts +1 -1
- package/src/capabilities/app-graph-builder.ts +6 -7
- package/src/capabilities/blueprint-definition.ts +2 -0
- package/src/capabilities/index.ts +2 -0
- package/src/capabilities/react-surface.tsx +3 -4
- package/src/containers/DailySummarySettings/DailySummarySettings.tsx +10 -14
- package/src/containers/DailySummarySettings/index.ts +1 -3
- package/src/index.ts +2 -2
- package/src/meta.test.ts +2 -2
- package/src/meta.ts +1 -1
- package/src/plugin.ts +9 -0
- package/src/translations.test.ts +1 -1
- package/dist/lib/browser/index.mjs +0 -53
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/DailySummaryPlugin.tsx
|
|
2
|
+
import { Plugin } from "@dxos/app-framework";
|
|
3
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
4
|
+
import { AppGraphBuilder, BlueprintDefinition, ReactSurface } from "#capabilities";
|
|
5
|
+
import { meta } from "#meta";
|
|
6
|
+
import { translations } from "#translations";
|
|
7
|
+
var DailySummaryPlugin = Plugin.define(meta).pipe(AppPlugin.addAppGraphModule({
|
|
8
|
+
activate: AppGraphBuilder
|
|
9
|
+
}), AppPlugin.addBlueprintDefinitionModule({
|
|
10
|
+
activate: BlueprintDefinition
|
|
11
|
+
}), AppPlugin.addSurfaceModule({
|
|
12
|
+
activate: ReactSurface
|
|
13
|
+
}), AppPlugin.addTranslationsModule({
|
|
14
|
+
translations
|
|
15
|
+
}), Plugin.make);
|
|
16
|
+
var DailySummaryPlugin_default = DailySummaryPlugin;
|
|
17
|
+
export {
|
|
18
|
+
DailySummaryPlugin,
|
|
19
|
+
DailySummaryPlugin_default as default
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=DailySummaryPlugin.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/DailySummaryPlugin.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { AppGraphBuilder, BlueprintDefinition, ReactSurface } from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\n\nexport const DailySummaryPlugin = Plugin.define(meta).pipe(\n AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),\n AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.make,\n);\n\nexport default DailySummaryPlugin;\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAE1B,SAASC,iBAAiBC,qBAAqBC,oBAAoB;AACnE,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAEtB,IAAMC,qBAAqBP,OAAOQ,OAAOH,IAAAA,EAAMI,KACpDR,UAAUS,kBAAkB;EAAEC,UAAUT;AAAgB,CAAA,GACxDD,UAAUW,6BAA6B;EAAED,UAAUR;AAAoB,CAAA,GACvEF,UAAUY,iBAAiB;EAAEF,UAAUP;AAAa,CAAA,GACpDH,UAAUa,sBAAsB;EAAER;AAAa,CAAA,GAC/CN,OAAOe,IAAI;AAGb,IAAA,6BAAeR;",
|
|
6
|
+
"names": ["Plugin", "AppPlugin", "AppGraphBuilder", "BlueprintDefinition", "ReactSurface", "meta", "translations", "DailySummaryPlugin", "define", "pipe", "addAppGraphModule", "activate", "addBlueprintDefinitionModule", "addSurfaceModule", "addTranslationsModule", "make"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/containers/DailySummarySettings/DailySummarySettings.tsx
|
|
2
|
+
import React, { useCallback, useMemo } from "react";
|
|
3
|
+
import { Trigger } from "@dxos/compute";
|
|
4
|
+
import { Operation } from "@dxos/compute";
|
|
5
|
+
import { Filter, Query, Ref } from "@dxos/echo";
|
|
6
|
+
import { useQuery } from "@dxos/react-client/echo";
|
|
7
|
+
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
8
|
+
import { Settings } from "@dxos/react-ui-form";
|
|
9
|
+
import { GenerateSummary } from "#blueprints";
|
|
10
|
+
import { meta } from "#meta";
|
|
11
|
+
var DailySummarySettings = ({ space }) => {
|
|
12
|
+
const { t } = useTranslation(meta.id);
|
|
13
|
+
const triggers = useQuery(space.db, Query.select(Filter.type(Trigger.Trigger)).debugLabel("plugin-daily-summary.DailySummarySettings"));
|
|
14
|
+
const existingTrigger = useMemo(() => triggers.find((trigger) => {
|
|
15
|
+
if (trigger.spec?.kind !== "timer") {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const target = trigger.function?.target;
|
|
19
|
+
return target != null && "key" in target && target.key === GenerateSummary.meta.key;
|
|
20
|
+
}), [
|
|
21
|
+
triggers
|
|
22
|
+
]);
|
|
23
|
+
const handleCreateTrigger = useCallback(() => {
|
|
24
|
+
if (existingTrigger) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const trigger = Trigger.make({
|
|
28
|
+
enabled: true,
|
|
29
|
+
spec: Trigger.specTimer("0 21 * * *"),
|
|
30
|
+
function: Ref.make(Operation.serialize(GenerateSummary))
|
|
31
|
+
});
|
|
32
|
+
space.db.add(trigger);
|
|
33
|
+
}, [
|
|
34
|
+
space,
|
|
35
|
+
existingTrigger
|
|
36
|
+
]);
|
|
37
|
+
return /* @__PURE__ */ React.createElement(Settings.Viewport, null, /* @__PURE__ */ React.createElement(Settings.Section, {
|
|
38
|
+
title: t("settings.summary.label")
|
|
39
|
+
}, /* @__PURE__ */ React.createElement(Settings.Panel, null, /* @__PURE__ */ React.createElement(IconButton, {
|
|
40
|
+
icon: existingTrigger ? "ph--check--regular" : "ph--plus--regular",
|
|
41
|
+
label: t("create-trigger.label"),
|
|
42
|
+
onClick: handleCreateTrigger,
|
|
43
|
+
disabled: !!existingTrigger
|
|
44
|
+
}))));
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
DailySummarySettings as default
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=DailySummarySettings-RO4ZS7HJ.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/DailySummarySettings/DailySummarySettings.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { Trigger } from '@dxos/compute';\nimport { Operation } from '@dxos/compute';\nimport { Filter, Query, Ref } from '@dxos/echo';\nimport { useQuery } from '@dxos/react-client/echo';\nimport { IconButton, useTranslation } from '@dxos/react-ui';\nimport { Settings } from '@dxos/react-ui-form';\n\nimport { GenerateSummary } from '#blueprints';\nimport { meta } from '#meta';\n\nexport const DailySummarySettings = ({ space }: AppSurface.SpaceArticleProps) => {\n const { t } = useTranslation(meta.id);\n\n const triggers = useQuery(\n space.db,\n Query.select(Filter.type(Trigger.Trigger)).debugLabel('plugin-daily-summary.DailySummarySettings'),\n );\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: Trigger.specTimer('0 21 * * *'),\n function: Ref.make(Operation.serialize(GenerateSummary)),\n });\n space.db.add(trigger);\n }, [space, existingTrigger]);\n\n return (\n <Settings.Viewport>\n <Settings.Section title={t('settings.summary.label')}>\n <Settings.Panel>\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 </Settings.Panel>\n </Settings.Section>\n </Settings.Viewport>\n );\n};\n"],
|
|
5
|
+
"mappings": ";AAIA,OAAOA,SAASC,aAAaC,eAAe;AAG5C,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,QAAQC,OAAOC,WAAW;AACnC,SAASC,gBAAgB;AACzB,SAASC,YAAYC,sBAAsB;AAC3C,SAASC,gBAAgB;AAEzB,SAASC,uBAAuB;AAChC,SAASC,YAAY;AAEd,IAAMC,uBAAuB,CAAC,EAAEC,MAAK,MAAgC;AAC1E,QAAM,EAAEC,EAAC,IAAKN,eAAeG,KAAKI,EAAE;AAEpC,QAAMC,WAAWV,SACfO,MAAMI,IACNb,MAAMc,OAAOf,OAAOgB,KAAKlB,QAAQA,OAAO,CAAA,EAAGmB,WAAW,2CAAA,CAAA;AAExD,QAAMC,kBAAkBrB,QACtB,MACEgB,SAASM,KAAK,CAACC,YAAAA;AACb,QAAIA,QAAQC,MAAMC,SAAS,SAAS;AAClC,aAAO;IACT;AACA,UAAMC,SAASH,QAAQI,UAAUD;AACjC,WACEA,UAAU,QAAQ,SAASA,UAAWA,OAAmCE,QAAQlB,gBAAgBC,KAAKiB;EAE1G,CAAA,GACF;IAACZ;GAAS;AAGZ,QAAMa,sBAAsB9B,YAAY,MAAA;AACtC,QAAIsB,iBAAiB;AACnB;IACF;AACA,UAAME,UAAUtB,QAAQ6B,KAAK;MAC3BC,SAAS;MACTP,MAAMvB,QAAQ+B,UAAU,YAAA;MACxBL,UAAUtB,IAAIyB,KAAK5B,UAAU+B,UAAUvB,eAAAA,CAAAA;IACzC,CAAA;AACAG,UAAMI,GAAGiB,IAAIX,OAAAA;EACf,GAAG;IAACV;IAAOQ;GAAgB;AAE3B,SACE,sBAAA,cAACZ,SAAS0B,UAAQ,MAChB,sBAAA,cAAC1B,SAAS2B,SAAO;IAACC,OAAOvB,EAAE,wBAAA;KACzB,sBAAA,cAACL,SAAS6B,OAAK,MACb,sBAAA,cAAC/B,YAAAA;IACCgC,MAAMlB,kBAAkB,uBAAuB;IAC/CmB,OAAO1B,EAAE,sBAAA;IACT2B,SAASZ;IACTa,UAAU,CAAC,CAACrB;;AAMxB;",
|
|
6
|
+
"names": ["React", "useCallback", "useMemo", "Trigger", "Operation", "Filter", "Query", "Ref", "useQuery", "IconButton", "useTranslation", "Settings", "GenerateSummary", "meta", "DailySummarySettings", "space", "t", "id", "triggers", "db", "select", "type", "debugLabel", "existingTrigger", "find", "trigger", "spec", "kind", "target", "function", "key", "handleCreateTrigger", "make", "enabled", "specTimer", "serialize", "add", "Viewport", "Section", "title", "Panel", "icon", "label", "onClick", "disabled"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/capabilities/app-graph-builder.ts
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { Capability } from "@dxos/app-framework";
|
|
4
|
+
import { AppCapabilities, AppNode, AppNodeMatcher } from "@dxos/app-toolkit";
|
|
5
|
+
import { GraphBuilder } from "@dxos/plugin-graph";
|
|
6
|
+
import { meta } from "#meta";
|
|
7
|
+
var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
8
|
+
const extensions = yield* Effect.all([
|
|
9
|
+
GraphBuilder.createExtension({
|
|
10
|
+
id: "space-settings-daily-summary",
|
|
11
|
+
match: AppNodeMatcher.whenSpace,
|
|
12
|
+
connector: () => Effect.succeed([
|
|
13
|
+
AppNode.makeSettingsPanel({
|
|
14
|
+
id: "daily-summary",
|
|
15
|
+
type: `${meta.id}.space-settings-daily-summary`,
|
|
16
|
+
label: [
|
|
17
|
+
"plugin.name",
|
|
18
|
+
{
|
|
19
|
+
ns: meta.id
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
icon: "ph--calendar-check--regular"
|
|
23
|
+
})
|
|
24
|
+
])
|
|
25
|
+
})
|
|
26
|
+
]);
|
|
27
|
+
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
28
|
+
}));
|
|
29
|
+
export {
|
|
30
|
+
app_graph_builder_default as default
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=app-graph-builder-BTDLYMIG.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities, AppNode, AppNodeMatcher } from '@dxos/app-toolkit';\nimport { GraphBuilder } from '@dxos/plugin-graph';\n\nimport { meta } from '#meta';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const extensions = yield* Effect.all([\n GraphBuilder.createExtension({\n id: 'space-settings-daily-summary',\n match: AppNodeMatcher.whenSpace,\n connector: () =>\n Effect.succeed([\n AppNode.makeSettingsPanel({\n id: 'daily-summary',\n type: `${meta.id}.space-settings-daily-summary`,\n label: ['plugin.name', { ns: meta.id }],\n icon: 'ph--calendar-check--regular',\n }),\n ]),\n }),\n ]);\n\n return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);\n }),\n);\n"],
|
|
5
|
+
"mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiBC,SAASC,sBAAsB;AACzD,SAASC,oBAAoB;AAE7B,SAASC,YAAY;AAErB,IAAA,4BAAeL,WAAWM,WACjBC,kBAAW,aAAA;AAChB,QAAMC,aAAa,OAAcC,WAAI;IACnCL,aAAaM,gBAAgB;MAC3BC,IAAI;MACJC,OAAOT,eAAeU;MACtBC,WAAW,MACFC,eAAQ;QACbb,QAAQc,kBAAkB;UACxBL,IAAI;UACJM,MAAM,GAAGZ,KAAKM,EAAE;UAChBO,OAAO;YAAC;YAAe;cAAEC,IAAId,KAAKM;YAAG;;UACrCS,MAAM;QACR,CAAA;OACD;IACL,CAAA;GACD;AAED,SAAOpB,WAAWqB,YAAYpB,gBAAgBqB,iBAAiBd,UAAAA;AACjE,CAAA,CAAA;",
|
|
6
|
+
"names": ["Effect", "Capability", "AppCapabilities", "AppNode", "AppNodeMatcher", "GraphBuilder", "meta", "makeModule", "fnUntraced", "extensions", "all", "createExtension", "id", "match", "whenSpace", "connector", "succeed", "makeSettingsPanel", "type", "label", "ns", "icon", "contributes", "AppGraphBuilder"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/capabilities/blueprint-definition.ts
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { Capability } from "@dxos/app-framework";
|
|
4
|
+
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
5
|
+
import { DailySummaryBlueprint } from "#blueprints";
|
|
6
|
+
var blueprintDefinition = Capability.makeModule(() => Effect.succeed([
|
|
7
|
+
Capability.contributes(AppCapabilities.BlueprintDefinition, DailySummaryBlueprint)
|
|
8
|
+
]));
|
|
9
|
+
var blueprint_definition_default = blueprintDefinition;
|
|
10
|
+
export {
|
|
11
|
+
blueprint_definition_default as default
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=blueprint-definition-QLGURVVR.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/blueprint-definition.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport type { Blueprint } from '@dxos/compute';\n\nimport { DailySummaryBlueprint } from '#blueprints';\n\nconst blueprintDefinition = Capability.makeModule<\n [],\n Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]\n>(() => Effect.succeed([Capability.contributes(AppCapabilities.BlueprintDefinition, DailySummaryBlueprint)]));\n\nexport default blueprintDefinition;\n"],
|
|
5
|
+
"mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,uBAAuB;AAIhC,SAASC,6BAA6B;AAEtC,IAAMC,sBAAsBH,WAAWI,WAGrC,MAAaC,eAAQ;EAACL,WAAWM,YAAYL,gBAAgBM,qBAAqBL,qBAAAA;CAAuB,CAAA;AAE3G,IAAA,+BAAeC;",
|
|
6
|
+
"names": ["Effect", "Capability", "AppCapabilities", "DailySummaryBlueprint", "blueprintDefinition", "makeModule", "succeed", "contributes", "BlueprintDefinition"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BLUEPRINT_KEY,
|
|
3
|
+
DailySummaryHandlers,
|
|
4
|
+
daily_summary_blueprint_default
|
|
5
|
+
} from "../chunk-7Q6EW2T4.mjs";
|
|
6
|
+
import {
|
|
7
|
+
GenerateSummary
|
|
8
|
+
} from "../chunk-N62WIXKJ.mjs";
|
|
9
|
+
export {
|
|
10
|
+
BLUEPRINT_KEY,
|
|
11
|
+
daily_summary_blueprint_default as DailySummaryBlueprint,
|
|
12
|
+
DailySummaryHandlers,
|
|
13
|
+
GenerateSummary
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/capabilities/index.ts
|
|
2
|
+
import { Capability } from "@dxos/app-framework";
|
|
3
|
+
var AppGraphBuilder = Capability.lazy("AppGraphBuilder", () => import("../app-graph-builder-BTDLYMIG.mjs"));
|
|
4
|
+
var BlueprintDefinition = Capability.lazy("BlueprintDefinition", () => import("../blueprint-definition-QLGURVVR.mjs"));
|
|
5
|
+
var ReactSurface = Capability.lazy("ReactSurface", () => import("../react-surface-2Y7H4PUA.mjs"));
|
|
6
|
+
export {
|
|
7
|
+
AppGraphBuilder,
|
|
8
|
+
BlueprintDefinition,
|
|
9
|
+
ReactSurface
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/capabilities/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport type { Blueprint } from '@dxos/compute';\n\nexport const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));\nexport const BlueprintDefinition = Capability.lazy('BlueprintDefinition', () => import('./blueprint-definition'));\nexport const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,kBAAkB;AAIpB,IAAMC,kBAAkBD,WAAWE,KAAK,mBAAmB,MAAM,OAAO,mCAAA,CAAA;AACxE,IAAMC,sBAAsBH,WAAWE,KAAK,uBAAuB,MAAM,OAAO,sCAAA,CAAA;AAChF,IAAME,eAAeJ,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;",
|
|
6
|
+
"names": ["Capability", "AppGraphBuilder", "lazy", "BlueprintDefinition", "ReactSurface"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GenerateSummary
|
|
3
|
+
} from "./chunk-N62WIXKJ.mjs";
|
|
4
|
+
|
|
5
|
+
// src/blueprints/daily-summary-blueprint.ts
|
|
6
|
+
import { Blueprint, Template } from "@dxos/compute";
|
|
7
|
+
import { trim } from "@dxos/util";
|
|
8
|
+
|
|
9
|
+
// src/blueprints/functions/index.ts
|
|
10
|
+
import { OperationHandlerSet } from "@dxos/compute";
|
|
11
|
+
var DailySummaryHandlers = OperationHandlerSet.lazy(() => import("./generate-GMQ2UTV4.mjs"));
|
|
12
|
+
|
|
13
|
+
// src/blueprints/daily-summary-blueprint.ts
|
|
14
|
+
var BLUEPRINT_KEY = "org.dxos.blueprint.daily-summary";
|
|
15
|
+
var make = () => Blueprint.make({
|
|
16
|
+
key: BLUEPRINT_KEY,
|
|
17
|
+
name: "Daily Summary",
|
|
18
|
+
tools: Blueprint.toolDefinitions({
|
|
19
|
+
operations: [
|
|
20
|
+
GenerateSummary
|
|
21
|
+
]
|
|
22
|
+
}),
|
|
23
|
+
instructions: Template.make({
|
|
24
|
+
source: trim`
|
|
25
|
+
{{! Daily Summary }}
|
|
26
|
+
|
|
27
|
+
You generate concise daily activity summaries as Markdown documents.
|
|
28
|
+
When asked to summarize, use the generate tool to query recent objects and produce a summary.
|
|
29
|
+
The tool creates a Markdown document in a "Summaries" collection.
|
|
30
|
+
If a summary for today already exists, it updates the existing document.
|
|
31
|
+
`
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
var blueprint = {
|
|
35
|
+
key: BLUEPRINT_KEY,
|
|
36
|
+
make
|
|
37
|
+
};
|
|
38
|
+
var daily_summary_blueprint_default = blueprint;
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
DailySummaryHandlers,
|
|
42
|
+
BLUEPRINT_KEY,
|
|
43
|
+
daily_summary_blueprint_default
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=chunk-7Q6EW2T4.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/blueprints/daily-summary-blueprint.ts", "../../../src/blueprints/functions/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Blueprint, Template } from '@dxos/compute';\nimport { trim } from '@dxos/util';\n\nimport { DailySummaryHandlers, GenerateSummary } from './functions';\n\nexport const BLUEPRINT_KEY = 'org.dxos.blueprint.daily-summary';\n\nexport { DailySummaryHandlers };\n\nconst make = () =>\n Blueprint.make({\n key: BLUEPRINT_KEY,\n name: 'Daily Summary',\n tools: Blueprint.toolDefinitions({ operations: [GenerateSummary] }),\n instructions: Template.make({\n source: trim`\n {{! Daily Summary }}\n\n You generate concise daily activity summaries as Markdown documents.\n When asked to summarize, use the generate tool to query recent objects and produce a summary.\n The tool creates a Markdown document in a \"Summaries\" collection.\n If a summary for today already exists, it updates the existing document.\n `,\n }),\n });\n\nconst blueprint: Blueprint.Definition = {\n key: BLUEPRINT_KEY,\n make,\n};\n\nexport default blueprint;\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { OperationHandlerSet } from '@dxos/compute';\n\nexport * from './definitions';\n\nexport const DailySummaryHandlers = OperationHandlerSet.lazy(() => import('./generate'));\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,SAASA,WAAWC,gBAAgB;AACpC,SAASC,YAAY;;;ACDrB,SAASC,2BAA2B;AAI7B,IAAMC,uBAAuBD,oBAAoBE,KAAK,MAAM,OAAO,yBAAA,CAAA;;;ADCnE,IAAMC,gBAAgB;AAI7B,IAAMC,OAAO,MACXC,UAAUD,KAAK;EACbE,KAAKC;EACLC,MAAM;EACNC,OAAOJ,UAAUK,gBAAgB;IAAEC,YAAY;MAACC;;EAAiB,CAAA;EACjEC,cAAcC,SAASV,KAAK;IAC1BW,QAAQC;;;;;;;;EAQV,CAAA;AACF,CAAA;AAEF,IAAMC,YAAkC;EACtCX,KAAKC;EACLH;AACF;AAEA,IAAA,kCAAea;",
|
|
6
|
+
"names": ["Blueprint", "Template", "trim", "OperationHandlerSet", "DailySummaryHandlers", "lazy", "BLUEPRINT_KEY", "make", "Blueprint", "key", "BLUEPRINT_KEY", "name", "tools", "toolDefinitions", "operations", "GenerateSummary", "instructions", "Template", "source", "trim", "blueprint"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/blueprints/functions/definitions.ts
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import { AiService } from "@dxos/ai";
|
|
4
|
+
import { Operation } from "@dxos/compute";
|
|
5
|
+
import { Database } from "@dxos/echo";
|
|
6
|
+
var GenerateSummary = Operation.make({
|
|
7
|
+
meta: {
|
|
8
|
+
key: "org.dxos.function.daily-summary.generate",
|
|
9
|
+
name: "Generate Daily Summary",
|
|
10
|
+
description: "Queries objects modified in the last day and generates an AI-summarized markdown document."
|
|
11
|
+
},
|
|
12
|
+
input: Schema.Struct({
|
|
13
|
+
previousSummary: Schema.optional(Schema.String).annotations({
|
|
14
|
+
description: "The previous day summary text for context continuity."
|
|
15
|
+
}),
|
|
16
|
+
lookbackHours: Schema.optional(Schema.Number).annotations({
|
|
17
|
+
description: "Number of hours to look back for modified objects. Defaults to 24."
|
|
18
|
+
})
|
|
19
|
+
}),
|
|
20
|
+
output: Schema.Struct({
|
|
21
|
+
id: Schema.String.annotations({
|
|
22
|
+
description: "DXN of the created or updated markdown document."
|
|
23
|
+
}),
|
|
24
|
+
objectCount: Schema.Number.annotations({
|
|
25
|
+
description: "Number of objects included in the summary."
|
|
26
|
+
}),
|
|
27
|
+
date: Schema.String.annotations({
|
|
28
|
+
description: 'Date label for the summary (e.g., "March 20").'
|
|
29
|
+
})
|
|
30
|
+
}),
|
|
31
|
+
services: [
|
|
32
|
+
Database.Service,
|
|
33
|
+
AiService.AiService
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
GenerateSummary
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=chunk-N62WIXKJ.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/blueprints/functions/definitions.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { AiService } from '@dxos/ai';\nimport { Operation } from '@dxos/compute';\nimport { Database } from '@dxos/echo';\n\n/**\n * Generates a daily summary of recently modified objects using AI.\n * Queries the database for objects updated within a time window,\n * sends them to an LLM for summarization, and creates/updates\n * a Markdown document in a \"Summaries\" collection.\n */\nexport const GenerateSummary = Operation.make({\n meta: {\n key: 'org.dxos.function.daily-summary.generate',\n name: 'Generate Daily Summary',\n description: 'Queries objects modified in the last day and generates an AI-summarized markdown document.',\n },\n input: Schema.Struct({\n previousSummary: Schema.optional(Schema.String).annotations({\n description: 'The previous day summary text for context continuity.',\n }),\n lookbackHours: Schema.optional(Schema.Number).annotations({\n description: 'Number of hours to look back for modified objects. Defaults to 24.',\n }),\n }),\n output: Schema.Struct({\n id: Schema.String.annotations({\n description: 'DXN of the created or updated markdown document.',\n }),\n objectCount: Schema.Number.annotations({\n description: 'Number of objects included in the summary.',\n }),\n date: Schema.String.annotations({\n description: 'Date label for the summary (e.g., \"March 20\").',\n }),\n }),\n services: [Database.Service, AiService.AiService],\n});\n"],
|
|
5
|
+
"mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;AAQlB,IAAMC,kBAAkBF,UAAUG,KAAK;EAC5CC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBC,iBAAwBC,gBAAgBC,aAAM,EAAEC,YAAY;MAC1DN,aAAa;IACf,CAAA;IACAO,eAAsBH,gBAAgBI,aAAM,EAAEF,YAAY;MACxDN,aAAa;IACf,CAAA;EACF,CAAA;EACAS,QAAeP,cAAO;IACpBQ,IAAWL,cAAOC,YAAY;MAC5BN,aAAa;IACf,CAAA;IACAW,aAAoBH,cAAOF,YAAY;MACrCN,aAAa;IACf,CAAA;IACAY,MAAaP,cAAOC,YAAY;MAC9BN,aAAa;IACf,CAAA;EACF,CAAA;EACAa,UAAU;IAACnB,SAASoB;IAAStB,UAAUA;;AACzC,CAAA;",
|
|
6
|
+
"names": ["Schema", "AiService", "Operation", "Database", "GenerateSummary", "make", "meta", "key", "name", "description", "input", "Struct", "previousSummary", "optional", "String", "annotations", "lookbackHours", "Number", "output", "id", "objectCount", "date", "services", "Service"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/meta.ts
|
|
2
|
+
import { trim } from "@dxos/util";
|
|
3
|
+
var meta = {
|
|
4
|
+
id: "org.dxos.plugin.dailySummary",
|
|
5
|
+
name: "Daily Summary",
|
|
6
|
+
description: trim`
|
|
7
|
+
Generates a daily summary of your activity by querying objects edited in the last day
|
|
8
|
+
and feeding them to an AI agent. Runs on a configurable schedule (default 9 PM).
|
|
9
|
+
`,
|
|
10
|
+
icon: "ph--calendar-check--regular",
|
|
11
|
+
iconHue: "sky",
|
|
12
|
+
tags: [
|
|
13
|
+
"labs"
|
|
14
|
+
],
|
|
15
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-daily-summary"
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
meta
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=chunk-PDAIPXYM.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.dailySummary',\n name: 'Daily Summary',\n description: trim`\n Generates a daily summary of your activity by querying objects edited in the last day\n and feeding them to an AI agent. Runs on a configurable schedule (default 9 PM).\n `,\n icon: 'ph--calendar-check--regular',\n iconHue: 'sky',\n tags: ['labs'],\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-daily-summary',\n};\n"],
|
|
5
|
+
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaJ;;;;EAIbK,MAAM;EACNC,SAAS;EACTC,MAAM;IAAC;;EACPC,QAAQ;AACV;",
|
|
6
|
+
"names": ["trim", "meta", "id", "name", "description", "icon", "iconHue", "tags", "source"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/containers/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { type ComponentType, lazy } from 'react';\n\nexport const DailySummarySettings: ComponentType<any> = lazy(() => import('./DailySummarySettings'));\n"],
|
|
5
|
+
"mappings": ";AAIA,SAA6BA,YAAY;AAElC,IAAMC,uBAA2CD,KAAK,MAAM,OAAO,sCAAA,CAAA;",
|
|
6
|
+
"names": ["lazy", "DailySummarySettings"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GenerateSummary
|
|
3
|
+
} from "./chunk-N62WIXKJ.mjs";
|
|
4
|
+
|
|
5
|
+
// src/blueprints/functions/generate.ts
|
|
6
|
+
import * as LanguageModel from "@effect/ai/LanguageModel";
|
|
7
|
+
import * as Prompt from "@effect/ai/Prompt";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import * as Layer from "effect/Layer";
|
|
10
|
+
import * as Schema from "effect/Schema";
|
|
11
|
+
import { AiService, ToolExecutionService, ToolResolverService } from "@dxos/ai";
|
|
12
|
+
import { Trace, Operation, OperationRegistry } from "@dxos/compute";
|
|
13
|
+
import { Collection, Database, Filter, Obj, Query, Ref, Type } from "@dxos/echo";
|
|
14
|
+
import { Text } from "@dxos/schema";
|
|
15
|
+
import { CollectionModel } from "@dxos/schema";
|
|
16
|
+
import { trim } from "@dxos/util";
|
|
17
|
+
var DEFAULT_LOOKBACK_HOURS = 24;
|
|
18
|
+
var SUMMARIES_COLLECTION_NAME = "Summaries";
|
|
19
|
+
var SUMMARY_TITLE_PREFIX = "Daily Summary \u2014";
|
|
20
|
+
var SUMMARY_STRUCTURE = trim`
|
|
21
|
+
Given a list of recently modified objects,
|
|
22
|
+
generate a concise daily summary in markdown,
|
|
23
|
+
try to pull insights from the changes and the context of the changes.
|
|
24
|
+
Focus on the meaningful changes and try to avoid changes in the system objects.
|
|
25
|
+
|
|
26
|
+
Follow this exact structure:
|
|
27
|
+
|
|
28
|
+
## Highlights
|
|
29
|
+
Bullet points capturing the most significant changes or accomplishments.
|
|
30
|
+
|
|
31
|
+
## TODOs
|
|
32
|
+
List of TODOs that is inferred from the changes and the content of the changes.
|
|
33
|
+
Make it short, do not force it, only strong call to action data should be included.
|
|
34
|
+
Use - [ ] syntax for the TODOs.
|
|
35
|
+
|
|
36
|
+
Rules:
|
|
37
|
+
- Do NOT include the heading "Daily Summary" — the document already has a title.
|
|
38
|
+
- Be concise. Each bullet should be one sentence.
|
|
39
|
+
- If a previous summary is provided, note what changed since then.
|
|
40
|
+
- Try to pull actionable points from the changes and the context of the changes.
|
|
41
|
+
- Output raw markdown only, no wrapping code fences.
|
|
42
|
+
`;
|
|
43
|
+
var MarkdownDocument = Schema.Struct({
|
|
44
|
+
name: Schema.optional(Schema.String),
|
|
45
|
+
content: Ref.Ref(Text.Text)
|
|
46
|
+
}).pipe(Type.object({
|
|
47
|
+
typename: "org.dxos.type.document",
|
|
48
|
+
version: "0.1.0"
|
|
49
|
+
}));
|
|
50
|
+
var makeMarkdownDoc = ({ name, content }) => {
|
|
51
|
+
const doc = Obj.make(MarkdownDocument, {
|
|
52
|
+
name,
|
|
53
|
+
content: Ref.make(Text.make({
|
|
54
|
+
content
|
|
55
|
+
}))
|
|
56
|
+
});
|
|
57
|
+
Obj.setParent(doc.content.target, doc);
|
|
58
|
+
return doc;
|
|
59
|
+
};
|
|
60
|
+
var generate_default = GenerateSummary.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ previousSummary, lookbackHours }) {
|
|
61
|
+
const hours = lookbackHours ?? DEFAULT_LOOKBACK_HOURS;
|
|
62
|
+
const cutoff = Date.now() - hours * 60 * 60 * 1e3;
|
|
63
|
+
const now = /* @__PURE__ */ new Date();
|
|
64
|
+
const dateLabel = now.toLocaleDateString("en-US", {
|
|
65
|
+
month: "long",
|
|
66
|
+
day: "numeric"
|
|
67
|
+
});
|
|
68
|
+
const docName = `${SUMMARY_TITLE_PREFIX} ${dateLabel}`;
|
|
69
|
+
const recentObjects = yield* Database.runQuery(Filter.updated({
|
|
70
|
+
after: cutoff
|
|
71
|
+
}));
|
|
72
|
+
const objectDescriptions = recentObjects.map((obj) => {
|
|
73
|
+
return JSON.stringify(Obj.toJSON(obj));
|
|
74
|
+
});
|
|
75
|
+
const content = yield* summarizeWithAi({
|
|
76
|
+
dateLabel,
|
|
77
|
+
objectDescriptions,
|
|
78
|
+
previousSummary,
|
|
79
|
+
hours
|
|
80
|
+
});
|
|
81
|
+
const existingDoc = yield* findExistingDaySummary(docName);
|
|
82
|
+
let doc;
|
|
83
|
+
if (existingDoc) {
|
|
84
|
+
yield* updateDocContent(existingDoc, content);
|
|
85
|
+
doc = existingDoc;
|
|
86
|
+
} else {
|
|
87
|
+
doc = makeMarkdownDoc({
|
|
88
|
+
name: docName,
|
|
89
|
+
content
|
|
90
|
+
});
|
|
91
|
+
const summariesCollection = yield* findOrCreateSummariesCollection();
|
|
92
|
+
yield* CollectionModel.add({
|
|
93
|
+
object: doc,
|
|
94
|
+
target: summariesCollection
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
id: Obj.getDXN(doc).toString(),
|
|
99
|
+
objectCount: recentObjects.length,
|
|
100
|
+
date: dateLabel
|
|
101
|
+
};
|
|
102
|
+
}, Effect.provide(Layer.mergeAll(AiService.model("@anthropic/claude-haiku-4-5"), ToolResolverService.layerEmpty, ToolExecutionService.layerEmpty, Database.notAvailable, Layer.succeed(Operation.Service, {
|
|
103
|
+
invoke: () => Effect.die("Not available."),
|
|
104
|
+
schedule: () => Effect.die("Not available."),
|
|
105
|
+
invokePromise: async () => ({
|
|
106
|
+
error: new Error("Not available.")
|
|
107
|
+
})
|
|
108
|
+
}), Layer.succeed(OperationRegistry.Service, {
|
|
109
|
+
resolve: () => Effect.succeed(void 0)
|
|
110
|
+
}), Trace.writerLayerNoop)))));
|
|
111
|
+
var summarizeWithAi = Effect.fn(function* ({ dateLabel, objectDescriptions, previousSummary, hours }) {
|
|
112
|
+
const userContent = [
|
|
113
|
+
`Date: ${dateLabel}`,
|
|
114
|
+
`Time window: last ${hours} hours`,
|
|
115
|
+
`Total objects modified: ${objectDescriptions.length}`,
|
|
116
|
+
"",
|
|
117
|
+
"Modified objects:",
|
|
118
|
+
...objectDescriptions,
|
|
119
|
+
...previousSummary ? [
|
|
120
|
+
"",
|
|
121
|
+
"Previous summary for context:",
|
|
122
|
+
previousSummary
|
|
123
|
+
] : []
|
|
124
|
+
].join("\n");
|
|
125
|
+
const { text } = yield* LanguageModel.generateText({
|
|
126
|
+
prompt: Prompt.fromMessages([
|
|
127
|
+
Prompt.systemMessage({
|
|
128
|
+
content: SUMMARY_STRUCTURE
|
|
129
|
+
}),
|
|
130
|
+
Prompt.userMessage({
|
|
131
|
+
content: [
|
|
132
|
+
Prompt.makePart("text", {
|
|
133
|
+
text: userContent
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
})
|
|
137
|
+
])
|
|
138
|
+
});
|
|
139
|
+
return text;
|
|
140
|
+
});
|
|
141
|
+
var findExistingDaySummary = Effect.fn(function* (docName) {
|
|
142
|
+
const docs = yield* Database.runQuery(Query.type(MarkdownDocument, {
|
|
143
|
+
name: docName
|
|
144
|
+
}));
|
|
145
|
+
return docs.length > 0 ? docs[0] : null;
|
|
146
|
+
});
|
|
147
|
+
var updateDocContent = Effect.fn(function* (doc, newContent) {
|
|
148
|
+
const textRef = doc.content;
|
|
149
|
+
if (Ref.isRef(textRef)) {
|
|
150
|
+
const text = yield* Effect.promise(() => textRef.load());
|
|
151
|
+
if (text) {
|
|
152
|
+
Obj.update(text, (text2) => {
|
|
153
|
+
text2.content = newContent;
|
|
154
|
+
});
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
Obj.update(doc, (doc2) => {
|
|
159
|
+
doc2.content = Ref.make(Text.make({
|
|
160
|
+
content: newContent
|
|
161
|
+
}));
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
var findOrCreateSummariesCollection = Effect.fn(function* () {
|
|
165
|
+
const collections = yield* Database.runQuery(Query.type(Collection.Collection, {
|
|
166
|
+
name: SUMMARIES_COLLECTION_NAME
|
|
167
|
+
}));
|
|
168
|
+
if (collections.length > 0) {
|
|
169
|
+
return collections[0];
|
|
170
|
+
}
|
|
171
|
+
const collection = Collection.make({
|
|
172
|
+
name: SUMMARIES_COLLECTION_NAME
|
|
173
|
+
});
|
|
174
|
+
yield* CollectionModel.add({
|
|
175
|
+
object: collection
|
|
176
|
+
});
|
|
177
|
+
return collection;
|
|
178
|
+
});
|
|
179
|
+
export {
|
|
180
|
+
SUMMARY_STRUCTURE,
|
|
181
|
+
generate_default as default
|
|
182
|
+
};
|
|
183
|
+
//# sourceMappingURL=generate-GMQ2UTV4.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/blueprints/functions/generate.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as LanguageModel from '@effect/ai/LanguageModel';\nimport * as Prompt from '@effect/ai/Prompt';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Schema from 'effect/Schema';\n\nimport { AiService, ToolExecutionService, ToolResolverService } from '@dxos/ai';\nimport { Trace, Operation, OperationRegistry } from '@dxos/compute';\nimport { Collection, Database, Filter, Obj, Query, Ref, Type } from '@dxos/echo';\nimport { Text } from '@dxos/schema';\nimport { CollectionModel } from '@dxos/schema';\nimport { trim } from '@dxos/util';\n\nimport { GenerateSummary } from './definitions';\n\nconst DEFAULT_LOOKBACK_HOURS = 24;\nconst SUMMARIES_COLLECTION_NAME = 'Summaries';\nconst SUMMARY_TITLE_PREFIX = 'Daily Summary —';\n\n/**\n * Predefined structure for the AI-generated daily summary.\n * Used as the system prompt for the summarization model.\n */\nexport const SUMMARY_STRUCTURE = trim`\n Given a list of recently modified objects,\n generate a concise daily summary in markdown, \n try to pull insights from the changes and the context of the changes.\n Focus on the meaningful changes and try to avoid changes in the system objects.\n\n Follow this exact structure:\n\n ## Highlights\n Bullet points capturing the most significant changes or accomplishments.\n\n ## TODOs\n List of TODOs that is inferred from the changes and the content of the changes.\n Make it short, do not force it, only strong call to action data should be included.\n Use - [ ] syntax for the TODOs.\n\n Rules:\n - Do NOT include the heading \"Daily Summary\" — the document already has a title.\n - Be concise. Each bullet should be one sentence.\n - If a previous summary is provided, note what changed since then.\n - Try to pull actionable points from the changes and the context of the changes.\n - Output raw markdown only, no wrapping code fences.\n`;\n\nconst MarkdownDocument = Schema.Struct({\n name: Schema.optional(Schema.String),\n content: Ref.Ref(Text.Text),\n}).pipe(Type.object({ typename: 'org.dxos.type.document', version: '0.1.0' }));\n\ntype MarkdownDoc = Schema.Schema.Type<typeof MarkdownDocument>;\n\nconst makeMarkdownDoc = ({ name, content }: { name: string; content: string }) => {\n const doc = Obj.make(MarkdownDocument, { name, content: Ref.make(Text.make({ content })) });\n Obj.setParent(doc.content.target!, doc);\n return doc;\n};\n\nexport default GenerateSummary.pipe(\n Operation.withHandler(\n Effect.fnUntraced(\n function* ({ previousSummary, lookbackHours }) {\n const hours = lookbackHours ?? DEFAULT_LOOKBACK_HOURS;\n const cutoff = Date.now() - hours * 60 * 60 * 1000;\n const now = new Date();\n const dateLabel = now.toLocaleDateString('en-US', { month: 'long', day: 'numeric' });\n const docName = `${SUMMARY_TITLE_PREFIX} ${dateLabel}`;\n\n const recentObjects = yield* Database.runQuery(Filter.updated({ after: cutoff }));\n\n const objectDescriptions = recentObjects.map((obj) => {\n return JSON.stringify(Obj.toJSON(obj));\n });\n\n const content = yield* summarizeWithAi({\n dateLabel,\n objectDescriptions,\n previousSummary,\n hours,\n });\n\n const existingDoc = yield* findExistingDaySummary(docName);\n\n let doc;\n if (existingDoc) {\n yield* updateDocContent(existingDoc, content);\n doc = existingDoc;\n } else {\n doc = makeMarkdownDoc({ name: docName, content });\n const summariesCollection = yield* findOrCreateSummariesCollection();\n yield* CollectionModel.add({ object: doc, target: summariesCollection });\n }\n\n return {\n id: Obj.getDXN(doc).toString(),\n objectCount: recentObjects.length,\n date: dateLabel,\n };\n },\n Effect.provide(\n Layer.mergeAll(\n AiService.model('@anthropic/claude-haiku-4-5'),\n ToolResolverService.layerEmpty,\n ToolExecutionService.layerEmpty,\n Database.notAvailable,\n Layer.succeed(Operation.Service, {\n invoke: () => Effect.die('Not available.'),\n schedule: () => Effect.die('Not available.'),\n invokePromise: async () => ({ error: new Error('Not available.') }),\n } as any),\n Layer.succeed(OperationRegistry.Service, { resolve: () => Effect.succeed(undefined) } as any),\n Trace.writerLayerNoop,\n ),\n ),\n ),\n ),\n);\n\nconst summarizeWithAi = Effect.fn(function* ({\n dateLabel,\n objectDescriptions,\n previousSummary,\n hours,\n}: {\n dateLabel: string;\n objectDescriptions: string[];\n previousSummary?: string;\n hours: number;\n}) {\n const userContent = [\n `Date: ${dateLabel}`,\n `Time window: last ${hours} hours`,\n `Total objects modified: ${objectDescriptions.length}`,\n '',\n 'Modified objects:',\n ...objectDescriptions,\n ...(previousSummary ? ['', 'Previous summary for context:', previousSummary] : []),\n ].join('\\n');\n\n const { text } = yield* LanguageModel.generateText({\n prompt: Prompt.fromMessages([\n Prompt.systemMessage({ content: SUMMARY_STRUCTURE }),\n Prompt.userMessage({ content: [Prompt.makePart('text', { text: userContent })] }),\n ]),\n });\n\n return text;\n});\n\nconst findExistingDaySummary = Effect.fn(function* (docName: string) {\n const docs = yield* Database.runQuery(Query.type(MarkdownDocument, { name: docName }));\n return docs.length > 0 ? docs[0] : null;\n});\n\nconst updateDocContent = Effect.fn(function* (doc: MarkdownDoc, newContent: string) {\n const textRef = doc.content;\n if (Ref.isRef(textRef)) {\n const text: Text.Text | undefined = yield* Effect.promise(() => textRef.load());\n if (text) {\n Obj.update(text, (text) => {\n text.content = newContent;\n });\n return;\n }\n }\n Obj.update(doc, (doc) => {\n doc.content = Ref.make(Text.make({ content: newContent }));\n });\n});\n\nconst findOrCreateSummariesCollection = Effect.fn(function* () {\n const collections = yield* Database.runQuery(Query.type(Collection.Collection, { name: SUMMARIES_COLLECTION_NAME }));\n\n if (collections.length > 0) {\n return collections[0];\n }\n\n const collection = Collection.make({ name: SUMMARIES_COLLECTION_NAME });\n yield* CollectionModel.add({ object: collection });\n return collection;\n});\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["LanguageModel", "Prompt", "Effect", "Layer", "Schema", "AiService", "ToolExecutionService", "ToolResolverService", "Trace", "Operation", "OperationRegistry", "Collection", "Database", "Filter", "Obj", "Query", "Ref", "Type", "Text", "CollectionModel", "trim", "DEFAULT_LOOKBACK_HOURS", "SUMMARIES_COLLECTION_NAME", "SUMMARY_TITLE_PREFIX", "SUMMARY_STRUCTURE", "trim", "MarkdownDocument", "Struct", "name", "optional", "String", "content", "Ref", "Text", "pipe", "Type", "object", "typename", "version", "makeMarkdownDoc", "doc", "Obj", "make", "setParent", "target", "GenerateSummary", "Operation", "withHandler", "fnUntraced", "previousSummary", "lookbackHours", "hours", "cutoff", "Date", "now", "dateLabel", "toLocaleDateString", "month", "day", "docName", "recentObjects", "Database", "runQuery", "Filter", "updated", "after", "objectDescriptions", "map", "obj", "JSON", "stringify", "toJSON", "summarizeWithAi", "existingDoc", "findExistingDaySummary", "updateDocContent", "summariesCollection", "findOrCreateSummariesCollection", "CollectionModel", "add", "id", "getDXN", "toString", "objectCount", "length", "date", "provide", "mergeAll", "AiService", "model", "ToolResolverService", "layerEmpty", "ToolExecutionService", "notAvailable", "succeed", "Service", "invoke", "die", "schedule", "invokePromise", "error", "Error", "OperationRegistry", "resolve", "undefined", "Trace", "writerLayerNoop", "fn", "userContent", "join", "text", "generateText", "prompt", "fromMessages", "systemMessage", "userMessage", "makePart", "docs", "Query", "type", "newContent", "textRef", "isRef", "promise", "load", "update", "collections", "Collection", "collection"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BLUEPRINT_KEY,
|
|
3
|
+
DailySummaryHandlers,
|
|
4
|
+
daily_summary_blueprint_default
|
|
5
|
+
} from "./chunk-7Q6EW2T4.mjs";
|
|
6
|
+
import {
|
|
7
|
+
GenerateSummary
|
|
8
|
+
} from "./chunk-N62WIXKJ.mjs";
|
|
9
|
+
import {
|
|
10
|
+
meta
|
|
11
|
+
} from "./chunk-PDAIPXYM.mjs";
|
|
12
|
+
export {
|
|
13
|
+
BLUEPRINT_KEY,
|
|
14
|
+
daily_summary_blueprint_default as DailySummaryBlueprint,
|
|
15
|
+
DailySummaryHandlers,
|
|
16
|
+
GenerateSummary,
|
|
17
|
+
meta
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.mjs.map
|