@datalayer/decks-plugin-ai-agents 1.0.1
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/README.md +60 -0
- package/lib/DecksAgent.d.ts +22 -0
- package/lib/DecksAgent.d.ts.map +1 -0
- package/lib/DecksAgent.js +43 -0
- package/lib/DecksAgent.js.map +1 -0
- package/lib/index.d.ts +36 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +51 -0
- package/lib/index.js.map +1 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
[](https://datalayer.io)
|
|
2
|
+
|
|
3
|
+
# ☰ 🃏 Datalayer Decks Plugin AI Agents
|
|
4
|
+
|
|
5
|
+
An AI agent beside the decks: a frontend plugin for a Reactor host that
|
|
6
|
+
already mounts `@datalayer/decks/plugin`. It puts a floating chat in the
|
|
7
|
+
host's root slot with the **Decks agent** in it — the `example-decks`
|
|
8
|
+
agentspec from [agentspecs](https://github.com/datalayer/agentspecs), the
|
|
9
|
+
reference deck agent. (`worker-pitcher`, the landing's deck editor agent, is
|
|
10
|
+
its pitch-deck sibling: the same frontend toolset, a different trade.)
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
datalayer decks serve talk.yaml --reactor-plugins ai-agents
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## What it does, and does not, declare
|
|
17
|
+
|
|
18
|
+
The plugin declares **no tools**. The decks plugin contributes its commands
|
|
19
|
+
to the reactor's `AgentTools` point — list, read, create, replace, edit a
|
|
20
|
+
slide, open, move through, present, print — and this plugin reads that point
|
|
21
|
+
and hands the agent every one of them, run on the page through the reactor's
|
|
22
|
+
command registry (`useAgentCommandTools` from agent-runtimes). Switch the
|
|
23
|
+
decks plugin off and the agent has no tools; that is the point of reading
|
|
24
|
+
rather than declaring.
|
|
25
|
+
|
|
26
|
+
## The agent
|
|
27
|
+
|
|
28
|
+
- **Spec**: `example-decks` — its prompt (the deck data model, the tools,
|
|
29
|
+
how to draft and change a deck), model, name, icon, welcome and
|
|
30
|
+
suggestions. Both it and `worker-pitcher` name the `decks` frontend toolset
|
|
31
|
+
(`agentspecs/frontend-tools/decks.yaml`), so either can be named through
|
|
32
|
+
the plugin's `agentId` configuration.
|
|
33
|
+
- **Harness**: agent-runtimes' browser harness — the loop runs in the page,
|
|
34
|
+
no runtime is started.
|
|
35
|
+
- **Key**: a **temporary key** — an anonymous session the Datalayer inference
|
|
36
|
+
service grants a visitor for a while, shown counting down in the chat's
|
|
37
|
+
header — or the signed-in person's own token when there is one
|
|
38
|
+
(`useBrowserInference`). Which service: `DATALAYER_AI_INFERENCE_URL` on the
|
|
39
|
+
host, passed to the interface through `GET /config`; the harness's default
|
|
40
|
+
otherwise.
|
|
41
|
+
|
|
42
|
+
The same shape as the reactor's `examples/cms-astro/ai-agents`, as a plugin
|
|
43
|
+
rather than a mount hook: the host names it and the reactor does the rest.
|
|
44
|
+
|
|
45
|
+
## How a host activates it
|
|
46
|
+
|
|
47
|
+
The `datalayer decks` app bundles the plugin but leaves it off. The server
|
|
48
|
+
answers `GET /config` with the plugins it was started with
|
|
49
|
+
(`--reactor-plugins`, repeatable or comma-separated), and `app/src/App.tsx`
|
|
50
|
+
builds the named ones into the reactor (`OPTIONAL_PLUGINS`). A name this
|
|
51
|
+
build does not know is logged and skipped.
|
|
52
|
+
|
|
53
|
+
## Layout
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
plugins/ai-agents/
|
|
57
|
+
├── src/index.tsx the plugin: definePlugin, a root-slot component, lazy runtime
|
|
58
|
+
├── src/DecksAgent.tsx the chat: spec, tools from the reactor, temporary key, ChatFloating
|
|
59
|
+
└── package.json @datalayer/decks-plugin-ai-agents
|
|
60
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chat, with the deck agent in it.
|
|
3
|
+
*
|
|
4
|
+
* Loaded lazily by the plugin entry: this is where agent-runtimes' chat and
|
|
5
|
+
* browser harness come in. What it needs from the page it asks the reactor
|
|
6
|
+
* for — the decks plugin's `AgentTools` bundle, as frontend tools bound to
|
|
7
|
+
* the command registry — and what it needs from the network it gets from
|
|
8
|
+
* `useBrowserInference`: a temporary key when nobody is signed in, the
|
|
9
|
+
* person's own token when somebody is.
|
|
10
|
+
*
|
|
11
|
+
* @module DecksAgent
|
|
12
|
+
*/
|
|
13
|
+
import type { JSX } from 'react';
|
|
14
|
+
export type DecksAgentProps = {
|
|
15
|
+
/** The agentspec to build the chat from. */
|
|
16
|
+
agentId: string;
|
|
17
|
+
/** The host's addendum to the spec's prompt, if it has one. */
|
|
18
|
+
instructions?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function DecksAgent({ agentId, instructions }: DecksAgentProps): JSX.Element;
|
|
21
|
+
export default DecksAgent;
|
|
22
|
+
//# sourceMappingURL=DecksAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DecksAgent.d.ts","sourceRoot":"","sources":["../src/DecksAgent.tsx"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAWjC,MAAM,MAAM,eAAe,GAAG;IAC5B,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAmFlF;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { Flash } from '@primer/react';
|
|
4
|
+
import { useThemeStore } from '@datalayer/primer-addons';
|
|
5
|
+
import { AnonymousKeyTimer } from '@datalayer/core/lib/components/anonymous/AnonymousKeyTimer';
|
|
6
|
+
import { ChatFloating } from '@datalayer/agent-runtimes/lib/chat/ChatFloating.js';
|
|
7
|
+
import { useBrowserInference } from '@datalayer/agent-runtimes/lib/hooks/useBrowserInference.js';
|
|
8
|
+
import { browserProtocolConfig } from '@datalayer/agent-runtimes/lib/runtimes/browser/protocol.js';
|
|
9
|
+
import { getAgentspecs } from '@datalayer/agent-runtimes/lib/specs/agents/index.js';
|
|
10
|
+
import { useAgentCommandTools } from '@datalayer/agent-runtimes/lib/tools/adapters/commands/frontendCommandTools.js';
|
|
11
|
+
export function DecksAgent({ agentId, instructions }) {
|
|
12
|
+
const spec = useMemo(() => getAgentspecs(agentId), [agentId]);
|
|
13
|
+
const { inference, anonymous, needsSignIn } = useBrowserInference(true);
|
|
14
|
+
// Every command the plugins on this page offer an agent — the decks
|
|
15
|
+
// plugin's bundle, on this host — run through the reactor.
|
|
16
|
+
const tools = useAgentCommandTools();
|
|
17
|
+
const { colorMode, theme } = useThemeStore();
|
|
18
|
+
const protocol = useMemo(() => spec
|
|
19
|
+
? browserProtocolConfig({
|
|
20
|
+
agentId: spec.id,
|
|
21
|
+
instructions: [spec.systemPrompt, instructions].filter(Boolean).join('\n\n'),
|
|
22
|
+
model: spec.model,
|
|
23
|
+
frontendTools: tools,
|
|
24
|
+
inference,
|
|
25
|
+
})
|
|
26
|
+
: undefined, [inference, instructions, spec, tools]);
|
|
27
|
+
const suggestions = useMemo(() => (spec?.suggestions ?? []).map((item) => ({
|
|
28
|
+
title: item.summary || item.text,
|
|
29
|
+
message: item.text,
|
|
30
|
+
})), [spec]);
|
|
31
|
+
if (!spec) {
|
|
32
|
+
return (_jsxs(Flash, { variant: "danger", sx: { position: 'fixed', right: 20, bottom: 20, zIndex: 1001 }, children: ["The agentspec \u201C", agentId, "\u201D is not in this build of agent-runtimes."] }));
|
|
33
|
+
}
|
|
34
|
+
// `useBrowserInference` is backed by the visitor's temporary key or by a
|
|
35
|
+
// signed-in member's token; `needsSignIn` covers both, where reading the
|
|
36
|
+
// anonymous token alone would leave a signed-in person stuck launching.
|
|
37
|
+
const inferenceReady = !needsSignIn;
|
|
38
|
+
const inferenceFailed = anonymous.status === 'failed';
|
|
39
|
+
const timer = anonymous.expiresAt ? (_jsx(AnonymousKeyTimer, { expiresAt: anonymous.expiresAt, grantedMs: anonymous.grantedMs, label: "AI key" })) : null;
|
|
40
|
+
return (_jsxs(_Fragment, { children: [inferenceFailed && (_jsxs(Flash, { variant: "danger", sx: { position: 'fixed', right: 20, bottom: 88, zIndex: 1001, maxWidth: 460 }, children: ["The ", spec.name, " could not obtain a temporary AI key."] })), _jsx(ChatFloating, { protocol: protocol, useStore: false, themeVariant: theme, colorMode: colorMode, title: spec.name, description: spec.welcomeMessage ?? spec.description, suggestions: suggestions, position: "bottom-right", defaultViewMode: "floating-small", width: 440, height: 620, showModelSelector: false, showToolsMenu: tools.length > 0, showSkillsMenu: false, showTokenUsage: true, enableEphemeralNotebook: false, launching: !inferenceReady, launchingMessage: inferenceFailed ? 'Temporary AI access is unavailable.' : 'Preparing secure AI access…', panelProps: { headerContent: timer }, buttonTooltip: `${spec.name}: write and drive a deck with AI` })] }));
|
|
41
|
+
}
|
|
42
|
+
export default DecksAgent;
|
|
43
|
+
//# sourceMappingURL=DecksAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DecksAgent.js","sourceRoot":"","sources":["../src/DecksAgent.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4D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AgB,EAChC,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,GAAG,EACX,iBAAiB,EAAE,KAAK,EACxB,aAAa,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,EAC/B,cAAc,EAAE,KAAK,EACrB,cAAc,QACd,uBAAuB,EAAE,KAAK,EAC9B,SAAS,EAAE,CAAC,cAAc,EAC1B,gBAAgB,EACd,eAAe,CAAC,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC,6BAA6B,EAEzF,UAAU,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,EACpC,aAAa,EAAE,GAAG,IAAI,CAAC,IAAI,kCAAkC,GAC7D,IACD,CACJ,CAAC;AACJ,CAAC;AAED,eAAe,UAAU,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReactorReactOutput } from '@datalayer/reactor/react';
|
|
2
|
+
export declare const DECKS_AI_AGENTS_PLUGIN_NAME = "@datalayer/decks-plugin-ai-agents";
|
|
3
|
+
/**
|
|
4
|
+
* The agentspec the chat is built from, unless the host names another:
|
|
5
|
+
* the reference deck agent. `worker-pitcher` is its pitch-deck sibling and
|
|
6
|
+
* names the same frontend toolset (`frontend-tools/decks.yaml`).
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_AGENT_ID = "example-decks";
|
|
9
|
+
/**
|
|
10
|
+
* Where the model is reached when the host names no service: the Datalayer
|
|
11
|
+
* cloud, which is where a temporary key comes from. Named here, as the
|
|
12
|
+
* reactor's cms-astro/ai-agents example names it, rather than left to
|
|
13
|
+
* whatever the core store held before this plugin was built — a value that
|
|
14
|
+
* may have been set by another application on the same origin.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_INFERENCE_URL = "https://r1.datalayer.run";
|
|
17
|
+
export type DecksAiAgentsPluginConfig = {
|
|
18
|
+
/** Where the chat renders; a slot the host renders once, at the root. */
|
|
19
|
+
slot: string;
|
|
20
|
+
/** The agentspec: its prompt, model, name, icon, suggestions. */
|
|
21
|
+
agentId: string;
|
|
22
|
+
/**
|
|
23
|
+
* The inference service to reach the model at. Unset, the harness's own
|
|
24
|
+
* default — the Datalayer cloud — which is where a temporary key comes from.
|
|
25
|
+
*/
|
|
26
|
+
inferenceUrl?: string;
|
|
27
|
+
/**
|
|
28
|
+
* What the host adds to the agentspec's prompt: the page it is on, and what
|
|
29
|
+
* is different there — one deck already open, a save that is explicit. The
|
|
30
|
+
* spec says what the agent is; this says where it is.
|
|
31
|
+
*/
|
|
32
|
+
instructions?: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const DecksAiAgentsPlugin: import("@datalayer/reactor").ReactorPlugin<DecksAiAgentsPluginConfig, unknown, ReactorReactOutput>;
|
|
35
|
+
export default DecksAiAgentsPlugin;
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAOnE,eAAO,MAAM,2BAA2B,sCAAsC,CAAC;AAE/E;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAEhE,MAAM,MAAM,yBAAyB,GAAG;IACtC,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,oGAmC9B,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { lazy, Suspense } from 'react';
|
|
3
|
+
import { definePlugin } from '@datalayer/reactor';
|
|
4
|
+
import { coreStore } from '@datalayer/agent-runtimes/lib/state/index.js';
|
|
5
|
+
// The chat and the harness are the heavy half of the page; they arrive when
|
|
6
|
+
// the plugin is on, not with the host's first bytes.
|
|
7
|
+
const DecksAgent = lazy(() => import('./DecksAgent'));
|
|
8
|
+
export const DECKS_AI_AGENTS_PLUGIN_NAME = '@datalayer/decks-plugin-ai-agents';
|
|
9
|
+
/**
|
|
10
|
+
* The agentspec the chat is built from, unless the host names another:
|
|
11
|
+
* the reference deck agent. `worker-pitcher` is its pitch-deck sibling and
|
|
12
|
+
* names the same frontend toolset (`frontend-tools/decks.yaml`).
|
|
13
|
+
*/
|
|
14
|
+
export const DEFAULT_AGENT_ID = 'example-decks';
|
|
15
|
+
/**
|
|
16
|
+
* Where the model is reached when the host names no service: the Datalayer
|
|
17
|
+
* cloud, which is where a temporary key comes from. Named here, as the
|
|
18
|
+
* reactor's cms-astro/ai-agents example names it, rather than left to
|
|
19
|
+
* whatever the core store held before this plugin was built — a value that
|
|
20
|
+
* may have been set by another application on the same origin.
|
|
21
|
+
*/
|
|
22
|
+
export const DEFAULT_INFERENCE_URL = 'https://r1.datalayer.run';
|
|
23
|
+
export const DecksAiAgentsPlugin = definePlugin({
|
|
24
|
+
name: DECKS_AI_AGENTS_PLUGIN_NAME,
|
|
25
|
+
version: '1.0.0',
|
|
26
|
+
displayName: 'AI Agents',
|
|
27
|
+
description: 'An agent beside the decks: writes and drives a deck through the decks commands, on a temporary AI key.',
|
|
28
|
+
octicon: 'project',
|
|
29
|
+
emoji: '\u{1F5BC}\uFE0F',
|
|
30
|
+
config: {
|
|
31
|
+
slot: 'root',
|
|
32
|
+
agentId: DEFAULT_AGENT_ID,
|
|
33
|
+
inferenceUrl: undefined,
|
|
34
|
+
instructions: undefined,
|
|
35
|
+
},
|
|
36
|
+
build: ({ config }) => {
|
|
37
|
+
// Always, and before the first render: the harness's hook reads the store
|
|
38
|
+
// when the chat mounts, and the store is shared by everything on the
|
|
39
|
+
// page — so the service this plugin was told about (or its default) is
|
|
40
|
+
// what the chat uses, never a value some earlier application left there.
|
|
41
|
+
coreStore
|
|
42
|
+
.getState()
|
|
43
|
+
.setConfiguration({ aiInferenceUrl: config.inferenceUrl || DEFAULT_INFERENCE_URL });
|
|
44
|
+
const Agent = () => (_jsx(Suspense, { fallback: null, children: _jsx(DecksAgent, { agentId: config.agentId, instructions: config.instructions }) }));
|
|
45
|
+
return {
|
|
46
|
+
components: [{ slot: config.slot, id: 'decks-ai-agent', Component: Agent }],
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
export default DecksAiAgentsPlugin;
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";AAuCA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AAEzE,4EAA4E;AAC5E,qDAAqD;AACrD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,2BAA2B,GAAG,mCAAmC,CAAC;AAE/E;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAoBhE,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAI7C;IACA,IAAI,EAAE,2BAA2B;IACjC,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,WAAW;IACxB,WAAW,EACT,wGAAwG;IAC1G,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,iBAAiB;IACxB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,gBAAgB;QACzB,YAAY,EAAE,SAAS;QACvB,YAAY,EAAE,SAAS;KACxB;IACD,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;QACpB,0EAA0E;QAC1E,qEAAqE;QACrE,uEAAuE;QACvE,yEAAyE;QACzE,SAAS;aACN,QAAQ,EAAE;aACV,gBAAgB,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,YAAY,IAAI,qBAAqB,EAAE,CAAC,CAAC;QACtF,MAAM,KAAK,GAAG,GAAgB,EAAE,CAAC,CAC/B,KAAC,QAAQ,IAAC,QAAQ,EAAE,IAAI,YACtB,KAAC,UAAU,IAAC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,GAAI,GACjE,CACZ,CAAC;QACF,OAAO;YACL,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,gBAAgB,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;SAC5E,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@datalayer/decks-plugin-ai-agents",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"description": "An AI agent beside the decks — the reference Decks agent, or one a host names — on a temporary inference key, driving the decks plugin's own commands as its tools.",
|
|
8
|
+
"license": "Datalayer License",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "lib/index.js",
|
|
11
|
+
"types": "lib/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./lib/index.d.ts",
|
|
15
|
+
"import": "./lib/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"lib"
|
|
20
|
+
],
|
|
21
|
+
"keywords": [
|
|
22
|
+
"datalayer",
|
|
23
|
+
"reactor",
|
|
24
|
+
"plugins",
|
|
25
|
+
"decks",
|
|
26
|
+
"agents"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@datalayer/agent-runtimes": "^1.3.10",
|
|
30
|
+
"@datalayer/core": "^1.2.6",
|
|
31
|
+
"@datalayer/primer-addons": "^1.0.21",
|
|
32
|
+
"@primer/react": "^37.31.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@datalayer/reactor": "^1.0.0",
|
|
36
|
+
"react": "^19.0.0",
|
|
37
|
+
"react-dom": "^19.0.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/react": "19.2.18",
|
|
41
|
+
"typescript": "5.9.3"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -p tsconfig.json",
|
|
45
|
+
"build:lib": "tsc -p tsconfig.json",
|
|
46
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
47
|
+
"clean": "rm -rf lib",
|
|
48
|
+
"watch:lib": "tsc -w -p tsconfig.json"
|
|
49
|
+
}
|
|
50
|
+
}
|