@nuberea/sdk 0.0.3 → 0.0.4
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/plugin.d.ts +24 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +141 -0
- package/dist/plugin.js.map +1 -0
- package/package.json +5 -2
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NuBerea OpenClaw plugin entry point.
|
|
3
|
+
*
|
|
4
|
+
* Registers NuBerea biblical-data tools into the OpenClaw agent so the LLM
|
|
5
|
+
* can call them directly. Authentication reuses tokens cached at
|
|
6
|
+
* ~/.nuberea/tokens.json — run `nuberea login` once before using the tools.
|
|
7
|
+
*
|
|
8
|
+
* Tools registered:
|
|
9
|
+
* nuberea_verse — KJV verse lookup
|
|
10
|
+
* nuberea_bible_search — KJV full-text search
|
|
11
|
+
* nuberea_greek_lookup — LSJ Greek lexicon
|
|
12
|
+
* nuberea_hebrew_lookup — BDB Hebrew lexicon (Strong's number)
|
|
13
|
+
* nuberea_greek_morphology — Macula Greek verse morphology (Nestle 1904)
|
|
14
|
+
* nuberea_hebrew_morphology — Macula Hebrew verse morphology (WLC)
|
|
15
|
+
* nuberea_query — SQL analytics across all biblical databases
|
|
16
|
+
*/
|
|
17
|
+
declare const plugin: {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
register(api: any): void;
|
|
22
|
+
};
|
|
23
|
+
export default plugin;
|
|
24
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAwCH,QAAA,MAAM,MAAM;;;;kBAOI,GAAG,GAAG,IAAI;CAkHzB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NuBerea OpenClaw plugin entry point.
|
|
3
|
+
*
|
|
4
|
+
* Registers NuBerea biblical-data tools into the OpenClaw agent so the LLM
|
|
5
|
+
* can call them directly. Authentication reuses tokens cached at
|
|
6
|
+
* ~/.nuberea/tokens.json — run `nuberea login` once before using the tools.
|
|
7
|
+
*
|
|
8
|
+
* Tools registered:
|
|
9
|
+
* nuberea_verse — KJV verse lookup
|
|
10
|
+
* nuberea_bible_search — KJV full-text search
|
|
11
|
+
* nuberea_greek_lookup — LSJ Greek lexicon
|
|
12
|
+
* nuberea_hebrew_lookup — BDB Hebrew lexicon (Strong's number)
|
|
13
|
+
* nuberea_greek_morphology — Macula Greek verse morphology (Nestle 1904)
|
|
14
|
+
* nuberea_hebrew_morphology — Macula Hebrew verse morphology (WLC)
|
|
15
|
+
* nuberea_query — SQL analytics across all biblical databases
|
|
16
|
+
*/
|
|
17
|
+
import { Type } from '@sinclair/typebox';
|
|
18
|
+
import { NuBerea } from './client.js';
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Shared client — created lazily, reused across tool calls
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
let sharedClient;
|
|
23
|
+
function getClient() {
|
|
24
|
+
if (!sharedClient)
|
|
25
|
+
sharedClient = new NuBerea();
|
|
26
|
+
return sharedClient;
|
|
27
|
+
}
|
|
28
|
+
async function callTool(name, args = {}) {
|
|
29
|
+
try {
|
|
30
|
+
return await getClient().tool(name, args);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
34
|
+
const isAuth = msg.includes('401') ||
|
|
35
|
+
msg.toLowerCase().includes('unauthorized') ||
|
|
36
|
+
msg.toLowerCase().includes('token');
|
|
37
|
+
const text = isAuth
|
|
38
|
+
? 'NuBerea: not authenticated — run `nuberea login` to sign in'
|
|
39
|
+
: `NuBerea error: ${msg}`;
|
|
40
|
+
return { content: [{ type: 'text', text }] };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// Plugin entry — plain object matching OpenClaw's definePluginEntry shape.
|
|
45
|
+
// No openclaw import needed; definePluginEntry is an identity function at
|
|
46
|
+
// runtime and the `openclaw` package ships only as a host-provided module.
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
const plugin = {
|
|
49
|
+
id: 'nuberea',
|
|
50
|
+
name: 'NuBerea',
|
|
51
|
+
description: 'Biblical data platform — Bible texts, Hebrew/Greek morphology, lexicons, Dead Sea Scrolls',
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
|
+
register(api) {
|
|
54
|
+
// -- Bible ---------------------------------------------------------------
|
|
55
|
+
api.registerTool({
|
|
56
|
+
name: 'nuberea_verse',
|
|
57
|
+
description: 'Look up a KJV Bible verse by book, chapter, and verse number',
|
|
58
|
+
parameters: Type.Object({
|
|
59
|
+
book: Type.String({ description: 'Book name, e.g. "John"' }),
|
|
60
|
+
chapter: Type.Number({ description: 'Chapter number' }),
|
|
61
|
+
verse: Type.Number({ description: 'Verse number' }),
|
|
62
|
+
}),
|
|
63
|
+
async execute(_id, params) {
|
|
64
|
+
return callTool('bible_kjv_get_verse', params);
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
api.registerTool({
|
|
68
|
+
name: 'nuberea_bible_search',
|
|
69
|
+
description: 'Search KJV Bible text for a word or phrase; returns matching verse references',
|
|
70
|
+
parameters: Type.Object({
|
|
71
|
+
query: Type.String({ description: 'Word or phrase to search for' }),
|
|
72
|
+
limit: Type.Optional(Type.Number({ description: 'Max results (default 10)' })),
|
|
73
|
+
}),
|
|
74
|
+
async execute(_id, params) {
|
|
75
|
+
return callTool('bible_kjv_search_text', { query: params.query, limit: params.limit ?? 10 });
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
// -- Lexicons ------------------------------------------------------------
|
|
79
|
+
api.registerTool({
|
|
80
|
+
name: 'nuberea_greek_lookup',
|
|
81
|
+
description: 'Look up a Greek word in the LSJ (Liddell–Scott–Jones) lexicon',
|
|
82
|
+
parameters: Type.Object({
|
|
83
|
+
term: Type.String({ description: 'Greek word or lemma, e.g. "λόγος"' }),
|
|
84
|
+
}),
|
|
85
|
+
async execute(_id, params) {
|
|
86
|
+
return callTool('lexicon_lsj_lookup', params);
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
api.registerTool({
|
|
90
|
+
name: 'nuberea_hebrew_lookup',
|
|
91
|
+
description: "Look up a Hebrew word in the BDB lexicon by Strong's number, e.g. H1254",
|
|
92
|
+
parameters: Type.Object({
|
|
93
|
+
strong: Type.String({ description: "Strong's number, e.g. \"H1254\"" }),
|
|
94
|
+
}),
|
|
95
|
+
async execute(_id, params) {
|
|
96
|
+
return callTool('lexicon_bdb_search_strong', params);
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
// -- Morphology ----------------------------------------------------------
|
|
100
|
+
api.registerTool({
|
|
101
|
+
name: 'nuberea_greek_morphology',
|
|
102
|
+
description: 'Get Greek morphological analysis for a NT verse (Nestle 1904 via Macula Greek)',
|
|
103
|
+
parameters: Type.Object({
|
|
104
|
+
book: Type.String({ description: 'NT book name, e.g. "John"' }),
|
|
105
|
+
chapter: Type.Number({ description: 'Chapter number' }),
|
|
106
|
+
verse: Type.Number({ description: 'Verse number' }),
|
|
107
|
+
}),
|
|
108
|
+
async execute(_id, params) {
|
|
109
|
+
return callTool('macula_greek_query_verse', params);
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
api.registerTool({
|
|
113
|
+
name: 'nuberea_hebrew_morphology',
|
|
114
|
+
description: 'Get Hebrew morphological analysis for an OT verse (WLC via Macula Hebrew)',
|
|
115
|
+
parameters: Type.Object({
|
|
116
|
+
book: Type.String({ description: 'OT book name, e.g. "Gen"' }),
|
|
117
|
+
chapter: Type.Number({ description: 'Chapter number' }),
|
|
118
|
+
verse: Type.Number({ description: 'Verse number' }),
|
|
119
|
+
}),
|
|
120
|
+
async execute(_id, params) {
|
|
121
|
+
return callTool('macula_hebrew_query_verse', params);
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
// -- Analytics -----------------------------------------------------------
|
|
125
|
+
api.registerTool({
|
|
126
|
+
name: 'nuberea_query',
|
|
127
|
+
description: 'Run a SQL analytics query against NuBerea biblical databases ' +
|
|
128
|
+
'(schemas: hebrew, greek, dss, lexicons, bible). ' +
|
|
129
|
+
'Returns JSON rows. Example: SELECT * FROM hebrew.morphemes WHERE book_id = \'Gen\' LIMIT 10',
|
|
130
|
+
parameters: Type.Object({
|
|
131
|
+
sql: Type.String({ description: 'SQL query to execute' }),
|
|
132
|
+
limit: Type.Optional(Type.Number({ description: 'Row limit (default 100)' })),
|
|
133
|
+
}),
|
|
134
|
+
async execute(_id, params) {
|
|
135
|
+
return callTool('analytics_query', { sql: params.sql, limit: params.limit ?? 100 });
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
export default plugin;
|
|
141
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,8EAA8E;AAC9E,2DAA2D;AAC3D,8EAA8E;AAE9E,IAAI,YAAiC,CAAC;AAEtC,SAAS,SAAS;IAChB,IAAI,CAAC,YAAY;QAAE,YAAY,GAAG,IAAI,OAAO,EAAE,CAAC;IAChD,OAAO,YAAY,CAAC;AACtB,CAAC;AAID,KAAK,UAAU,QAAQ,CAAC,IAAY,EAAE,OAAgC,EAAE;IACtE,IA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AC,CAAC;YACvD,CAAC;SACF,CAAC,CAAC;QAEH,2EAA2E;QAE3E,GAAG,CAAC,YAAY,CAAC;YACf,IAAI,EAAE,eAAe;YACrB,WAAW,EACT,+DAA+D;gBAC/D,kDAAkD;gBAClD,6FAA6F;YAC/F,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;gBACtB,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;gBACzD,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC,CAAC;aAC9E,CAAC;YACF,KAAK,CAAC,OAAO,CACX,GAAW,EACX,MAAuC;gBAEvC,OAAO,QAAQ,CAAC,iBAAiB,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC;YACtF,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuberea/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "NuBerea SDK — Client library for the NuBerea biblical data platform. Query morphological corpora, lexicons, Bible texts, manuscripts, and scrolls.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"openclaw": {
|
|
62
62
|
"extensions": [
|
|
63
|
-
"./dist/
|
|
63
|
+
"./dist/plugin.js"
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
@@ -68,5 +68,8 @@
|
|
|
68
68
|
"tsx": "^4.19.0",
|
|
69
69
|
"typescript": "^5.7.0",
|
|
70
70
|
"vitest": "^3.0.0"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"@sinclair/typebox": "^0.34.49"
|
|
71
74
|
}
|
|
72
75
|
}
|