@ibgib/core-gib 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/.vscode/core-gib-snippets.code-snippets +189 -0
- package/.vscode/launch.json +24 -0
- package/.vscode/settings.json +56 -0
- package/.vscode/tasks.json +37 -0
- package/CHANGELOG.md +11 -0
- package/README.md +215 -0
- package/dist/common/aws-constants.d.mts +7 -0
- package/dist/common/aws-constants.d.mts.map +1 -0
- package/dist/common/aws-constants.mjs +7 -0
- package/dist/common/aws-constants.mjs.map +1 -0
- package/dist/common/bin/bin-types.d.mts +17 -0
- package/dist/common/bin/bin-types.d.mts.map +1 -0
- package/dist/common/bin/bin-types.mjs +3 -0
- package/dist/common/bin/bin-types.mjs.map +1 -0
- package/dist/common/cache/cache-types.d.mts +57 -0
- package/dist/common/cache/cache-types.d.mts.map +1 -0
- package/dist/common/cache/cache-types.mjs +2 -0
- package/dist/common/cache/cache-types.mjs.map +1 -0
- package/dist/common/comment/comment-constants.d.mts +11 -0
- package/dist/common/comment/comment-constants.d.mts.map +1 -0
- package/dist/common/comment/comment-constants.mjs +11 -0
- package/dist/common/comment/comment-constants.mjs.map +1 -0
- package/dist/common/comment/comment-helper.d.mts +59 -0
- package/dist/common/comment/comment-helper.d.mts.map +1 -0
- package/dist/common/comment/comment-helper.mjs +173 -0
- package/dist/common/comment/comment-helper.mjs.map +1 -0
- package/dist/common/comment/comment-types.d.mts +16 -0
- package/dist/common/comment/comment-types.d.mts.map +1 -0
- package/dist/common/comment/comment-types.mjs +2 -0
- package/dist/common/comment/comment-types.mjs.map +1 -0
- package/dist/common/display/display-helper.d.mts +19 -0
- package/dist/common/display/display-helper.d.mts.map +1 -0
- package/dist/common/display/display-helper.mjs +68 -0
- package/dist/common/display/display-helper.mjs.map +1 -0
- package/dist/common/display/display-types.d.mts +97 -0
- package/dist/common/display/display-types.d.mts.map +1 -0
- package/dist/common/display/display-types.mjs +37 -0
- package/dist/common/display/display-types.mjs.map +1 -0
- package/dist/common/encrypt/encrypt-constants.d.mts +27 -0
- package/dist/common/encrypt/encrypt-constants.d.mts.map +1 -0
- package/dist/common/encrypt/encrypt-constants.mjs +27 -0
- package/dist/common/encrypt/encrypt-constants.mjs.map +1 -0
- package/dist/common/encrypt/encrypt-types.d.mts +116 -0
- package/dist/common/encrypt/encrypt-types.d.mts.map +1 -0
- package/dist/common/encrypt/encrypt-types.mjs +9 -0
- package/dist/common/encrypt/encrypt-types.mjs.map +1 -0
- package/dist/common/error/error-constants.d.mts +9 -0
- package/dist/common/error/error-constants.d.mts.map +1 -0
- package/dist/common/error/error-constants.mjs +9 -0
- package/dist/common/error/error-constants.mjs.map +1 -0
- package/dist/common/error/error-helper.d.mts +43 -0
- package/dist/common/error/error-helper.d.mts.map +1 -0
- package/dist/common/error/error-helper.mjs +167 -0
- package/dist/common/error/error-helper.mjs.map +1 -0
- package/dist/common/error/error-types.d.mts +58 -0
- package/dist/common/error/error-types.d.mts.map +1 -0
- package/dist/common/error/error-types.mjs +2 -0
- package/dist/common/error/error-types.mjs.map +1 -0
- package/dist/common/form/form-helper.d.mts +97 -0
- package/dist/common/form/form-helper.d.mts.map +1 -0
- package/dist/common/form/form-helper.mjs +185 -0
- package/dist/common/form/form-helper.mjs.map +1 -0
- package/dist/common/form/form-items.d.mts +229 -0
- package/dist/common/form/form-items.d.mts.map +1 -0
- package/dist/common/form/form-items.mjs +63 -0
- package/dist/common/form/form-items.mjs.map +1 -0
- package/dist/common/import-export/import-export-types.d.mts +18 -0
- package/dist/common/import-export/import-export-types.d.mts.map +1 -0
- package/dist/common/import-export/import-export-types.mjs +2 -0
- package/dist/common/import-export/import-export-types.mjs.map +1 -0
- package/dist/common/legacy/legacy-types.d.mts +2 -0
- package/dist/common/legacy/legacy-types.d.mts.map +1 -0
- package/dist/common/legacy/legacy-types.mjs +2 -0
- package/dist/common/legacy/legacy-types.mjs.map +1 -0
- package/dist/common/link/link-constants.d.mts +2 -0
- package/dist/common/link/link-constants.d.mts.map +1 -0
- package/dist/common/link/link-constants.mjs +2 -0
- package/dist/common/link/link-constants.mjs.map +1 -0
- package/dist/common/link/link-helper.d.mts +37 -0
- package/dist/common/link/link-helper.d.mts.map +1 -0
- package/dist/common/link/link-helper.mjs +143 -0
- package/dist/common/link/link-helper.mjs.map +1 -0
- package/dist/common/link/link-types.d.mts +14 -0
- package/dist/common/link/link-types.d.mts.map +1 -0
- package/dist/common/link/link-types.mjs +2 -0
- package/dist/common/link/link-types.mjs.map +1 -0
- package/dist/common/other/graph-helper.d.mts +166 -0
- package/dist/common/other/graph-helper.d.mts.map +1 -0
- package/dist/common/other/graph-helper.mjs +710 -0
- package/dist/common/other/graph-helper.mjs.map +1 -0
- package/dist/common/other/ibgib-helper.d.mts +245 -0
- package/dist/common/other/ibgib-helper.d.mts.map +1 -0
- package/dist/common/other/ibgib-helper.mjs +641 -0
- package/dist/common/other/ibgib-helper.mjs.map +1 -0
- package/dist/common/other/other-constants.d.mts +53 -0
- package/dist/common/other/other-constants.d.mts.map +1 -0
- package/dist/common/other/other-constants.mjs +67 -0
- package/dist/common/other/other-constants.mjs.map +1 -0
- package/dist/common/other/other-types.d.mts +166 -0
- package/dist/common/other/other-types.d.mts.map +1 -0
- package/dist/common/other/other-types.mjs +30 -0
- package/dist/common/other/other-types.mjs.map +1 -0
- package/dist/common/other/svg-constants.d.mts +2 -0
- package/dist/common/other/svg-constants.d.mts.map +1 -0
- package/dist/common/other/svg-constants.mjs +2 -0
- package/dist/common/other/svg-constants.mjs.map +1 -0
- package/dist/common/other/svg-helper.d.mts +54 -0
- package/dist/common/other/svg-helper.d.mts.map +1 -0
- package/dist/common/other/svg-helper.mjs +170 -0
- package/dist/common/other/svg-helper.mjs.map +1 -0
- package/dist/common/pic/pic-constants.d.mts +13 -0
- package/dist/common/pic/pic-constants.d.mts.map +1 -0
- package/dist/common/pic/pic-constants.mjs +13 -0
- package/dist/common/pic/pic-constants.mjs.map +1 -0
- package/dist/common/pic/pic-helper.d.mts +70 -0
- package/dist/common/pic/pic-helper.d.mts.map +1 -0
- package/dist/common/pic/pic-helper.mjs +235 -0
- package/dist/common/pic/pic-helper.mjs.map +1 -0
- package/dist/common/pic/pic-types.d.mts +23 -0
- package/dist/common/pic/pic-types.d.mts.map +1 -0
- package/dist/common/pic/pic-types.mjs +2 -0
- package/dist/common/pic/pic-types.mjs.map +1 -0
- package/dist/common/root/root-constants.d.mts +40 -0
- package/dist/common/root/root-constants.d.mts.map +1 -0
- package/dist/common/root/root-constants.mjs +40 -0
- package/dist/common/root/root-constants.mjs.map +1 -0
- package/dist/common/root/root-types.d.mts +9 -0
- package/dist/common/root/root-types.d.mts.map +1 -0
- package/dist/common/root/root-types.mjs +2 -0
- package/dist/common/root/root-types.mjs.map +1 -0
- package/dist/common/tag/tag-constants.d.mts +21 -0
- package/dist/common/tag/tag-constants.d.mts.map +1 -0
- package/dist/common/tag/tag-constants.mjs +28 -0
- package/dist/common/tag/tag-constants.mjs.map +1 -0
- package/dist/common/tag/tag-types.d.mts +14 -0
- package/dist/common/tag/tag-types.d.mts.map +1 -0
- package/dist/common/tag/tag-types.mjs +2 -0
- package/dist/common/tag/tag-types.mjs.map +1 -0
- package/dist/core-constants.d.mts +89 -0
- package/dist/core-constants.d.mts.map +1 -0
- package/dist/core-constants.mjs +484 -0
- package/dist/core-constants.mjs.map +1 -0
- package/dist/core-helper.d.mts +6 -0
- package/dist/core-helper.d.mts.map +1 -0
- package/dist/core-helper.mjs +28 -0
- package/dist/core-helper.mjs.map +1 -0
- package/dist/core-types.d.mts +520 -0
- package/dist/core-types.d.mts.map +1 -0
- package/dist/core-types.mjs +2 -0
- package/dist/core-types.mjs.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/dist/witness/app/app-base-v1.d.mts +130 -0
- package/dist/witness/app/app-base-v1.d.mts.map +1 -0
- package/dist/witness/app/app-base-v1.mjs +462 -0
- package/dist/witness/app/app-base-v1.mjs.map +1 -0
- package/dist/witness/app/app-constants.d.mts +10 -0
- package/dist/witness/app/app-constants.d.mts.map +1 -0
- package/dist/witness/app/app-constants.mjs +13 -0
- package/dist/witness/app/app-constants.mjs.map +1 -0
- package/dist/witness/app/app-helper.d.mts +85 -0
- package/dist/witness/app/app-helper.d.mts.map +1 -0
- package/dist/witness/app/app-helper.mjs +258 -0
- package/dist/witness/app/app-helper.mjs.map +1 -0
- package/dist/witness/app/app-types.d.mts +211 -0
- package/dist/witness/app/app-types.d.mts.map +1 -0
- package/dist/witness/app/app-types.mjs +49 -0
- package/dist/witness/app/app-types.mjs.map +1 -0
- package/dist/witness/app/chat-app/chat-app-types.d.mts +18 -0
- package/dist/witness/app/chat-app/chat-app-types.d.mts.map +1 -0
- package/dist/witness/app/chat-app/chat-app-types.mjs +25 -0
- package/dist/witness/app/chat-app/chat-app-types.mjs.map +1 -0
- package/dist/witness/app/flash-app/flash-app-types.d.mts +16 -0
- package/dist/witness/app/flash-app/flash-app-types.d.mts.map +1 -0
- package/dist/witness/app/flash-app/flash-app-types.mjs +23 -0
- package/dist/witness/app/flash-app/flash-app-types.mjs.map +1 -0
- package/dist/witness/app/raw-app/raw-app-types.d.mts +18 -0
- package/dist/witness/app/raw-app/raw-app-types.d.mts.map +1 -0
- package/dist/witness/app/raw-app/raw-app-types.mjs +25 -0
- package/dist/witness/app/raw-app/raw-app-types.mjs.map +1 -0
- package/dist/witness/app/todo-app/todo-app-types.d.ts +33 -0
- package/dist/witness/app/todo-app/todo-app-types.d.ts.map +1 -0
- package/dist/witness/app/todo-app/todo-app-types.js +31 -0
- package/dist/witness/app/todo-app/todo-app-types.js.map +1 -0
- package/dist/witness/robbot/robbot-base-v1.d.ts +432 -0
- package/dist/witness/robbot/robbot-base-v1.d.ts.map +1 -0
- package/dist/witness/robbot/robbot-base-v1.js +1407 -0
- package/dist/witness/robbot/robbot-base-v1.js.map +1 -0
- package/dist/witness/robbot/robbot-constants.d.mts +24 -0
- package/dist/witness/robbot/robbot-constants.d.mts.map +1 -0
- package/dist/witness/robbot/robbot-constants.mjs +24 -0
- package/dist/witness/robbot/robbot-constants.mjs.map +1 -0
- package/dist/witness/robbot/robbot-helper.d.mts +152 -0
- package/dist/witness/robbot/robbot-helper.d.mts.map +1 -0
- package/dist/witness/robbot/robbot-helper.mjs +609 -0
- package/dist/witness/robbot/robbot-helper.mjs.map +1 -0
- package/dist/witness/robbot/robbot-types.d.mts +539 -0
- package/dist/witness/robbot/robbot-types.d.mts.map +1 -0
- package/dist/witness/robbot/robbot-types.mjs +294 -0
- package/dist/witness/robbot/robbot-types.mjs.map +1 -0
- package/dist/witness/space/bootstrap/bootstrap-constants.d.mts +14 -0
- package/dist/witness/space/bootstrap/bootstrap-constants.d.mts.map +1 -0
- package/dist/witness/space/bootstrap/bootstrap-constants.mjs +15 -0
- package/dist/witness/space/bootstrap/bootstrap-constants.mjs.map +1 -0
- package/dist/witness/space/inner-space-v1.d.ts +63 -0
- package/dist/witness/space/inner-space-v1.d.ts.map +1 -0
- package/dist/witness/space/inner-space-v1.js +356 -0
- package/dist/witness/space/inner-space-v1.js.map +1 -0
- package/dist/witness/space/outer-space/outer-space-constants.d.mts +2 -0
- package/dist/witness/space/outer-space/outer-space-constants.d.mts.map +1 -0
- package/dist/witness/space/outer-space/outer-space-constants.mjs +2 -0
- package/dist/witness/space/outer-space/outer-space-constants.mjs.map +1 -0
- package/dist/witness/space/outer-space/outer-space-helper.d.mts +28 -0
- package/dist/witness/space/outer-space/outer-space-helper.d.mts.map +1 -0
- package/dist/witness/space/outer-space/outer-space-helper.mjs +87 -0
- package/dist/witness/space/outer-space/outer-space-helper.mjs.map +1 -0
- package/dist/witness/space/outer-space/outer-space-types.d.mts +548 -0
- package/dist/witness/space/outer-space/outer-space-types.d.mts.map +1 -0
- package/dist/witness/space/outer-space/outer-space-types.mjs +118 -0
- package/dist/witness/space/outer-space/outer-space-types.mjs.map +1 -0
- package/dist/witness/space/space-base-v1.d.mts +147 -0
- package/dist/witness/space/space-base-v1.d.mts.map +1 -0
- package/dist/witness/space/space-base-v1.mjs +350 -0
- package/dist/witness/space/space-base-v1.mjs.map +1 -0
- package/dist/witness/space/space-constants.d.mts +181 -0
- package/dist/witness/space/space-constants.d.mts.map +1 -0
- package/dist/witness/space/space-constants.mjs +192 -0
- package/dist/witness/space/space-constants.mjs.map +1 -0
- package/dist/witness/space/space-helper.d.mts +666 -0
- package/dist/witness/space/space-helper.d.mts.map +1 -0
- package/dist/witness/space/space-helper.mjs +2830 -0
- package/dist/witness/space/space-helper.mjs.map +1 -0
- package/dist/witness/space/space-types.d.mts +422 -0
- package/dist/witness/space/space-types.d.mts.map +1 -0
- package/dist/witness/space/space-types.mjs +52 -0
- package/dist/witness/space/space-types.mjs.map +1 -0
- package/dist/witness/witness-base-v1.d.ts +144 -0
- package/dist/witness/witness-base-v1.d.ts.map +1 -0
- package/dist/witness/witness-base-v1.js +300 -0
- package/dist/witness/witness-base-v1.js.map +1 -0
- package/dist/witness/witness-constants.d.mts +3 -0
- package/dist/witness/witness-constants.d.mts.map +1 -0
- package/dist/witness/witness-constants.mjs +3 -0
- package/dist/witness/witness-constants.mjs.map +1 -0
- package/dist/witness/witness-form-builder.d.mts +45 -0
- package/dist/witness/witness-form-builder.d.mts.map +1 -0
- package/dist/witness/witness-form-builder.mjs +95 -0
- package/dist/witness/witness-form-builder.mjs.map +1 -0
- package/dist/witness/witness-helper.d.mts +89 -0
- package/dist/witness/witness-helper.d.mts.map +1 -0
- package/dist/witness/witness-helper.mjs +229 -0
- package/dist/witness/witness-helper.mjs.map +1 -0
- package/dist/witness/witness-types.d.mts +211 -0
- package/dist/witness/witness-types.d.mts.map +1 -0
- package/dist/witness/witness-types.mjs +2 -0
- package/dist/witness/witness-types.mjs.map +1 -0
- package/jasmine-browser.json +18 -0
- package/jasmine.json +6 -0
- package/package.json +67 -0
- package/src/assumptions.spec.mts +45 -0
- package/src/common/aws-constants.mts +5 -0
- package/src/common/bin/bin-types.mts +17 -0
- package/src/common/cache/cache-types.mts +53 -0
- package/src/common/comment/comment-constants.mts +10 -0
- package/src/common/comment/comment-helper.mts +211 -0
- package/src/common/comment/comment-types.mts +19 -0
- package/src/common/display/display-helper.mts +88 -0
- package/src/common/display/display-types.mts +108 -0
- package/src/common/encrypt/encrypt-constants.mts +28 -0
- package/src/common/encrypt/encrypt-types.mts +130 -0
- package/src/common/error/error-constants.mts +8 -0
- package/src/common/error/error-helper.mts +155 -0
- package/src/common/error/error-types.mts +62 -0
- package/src/common/form/form-helper.mts +253 -0
- package/src/common/form/form-items.mts +236 -0
- package/src/common/import-export/import-export-types.mts +18 -0
- package/src/common/legacy/about-legacy.md +0 -0
- package/src/common/legacy/legacy-types.mts +0 -0
- package/src/common/link/link-constants.mts +1 -0
- package/src/common/link/link-helper.mts +155 -0
- package/src/common/link/link-types.mts +16 -0
- package/src/common/other/graph-helper.mts +853 -0
- package/src/common/other/ibgib-helper.mts +671 -0
- package/src/common/other/other-constants.mts +76 -0
- package/src/common/other/other-types.mts +186 -0
- package/src/common/other/svg-constants.mts +1 -0
- package/src/common/other/svg-helper.mts +238 -0
- package/src/common/pic/pic-constants.mts +13 -0
- package/src/common/pic/pic-helper.mts +295 -0
- package/src/common/pic/pic-types.mts +29 -0
- package/src/common/root/root-constants.mts +41 -0
- package/src/common/root/root-types.mts +8 -0
- package/src/common/tag/tag-constants.mts +34 -0
- package/src/common/tag/tag-types.mts +19 -0
- package/src/core-constants.mts +506 -0
- package/src/core-helper.mts +33 -0
- package/src/core-types.mts +519 -0
- package/src/helper.spec.mts +64 -0
- package/src/index.mts +1 -0
- package/src/witness/app/app-base-v1.mts +584 -0
- package/src/witness/app/app-constants.mts +16 -0
- package/src/witness/app/app-helper.mts +322 -0
- package/src/witness/app/app-types.mts +252 -0
- package/src/witness/app/chat-app/chat-app-types.mts +40 -0
- package/src/witness/app/flash-app/flash-app-types.mts +38 -0
- package/src/witness/app/raw-app/raw-app-types.mts +40 -0
- package/src/witness/app/todo-app/todo-app-types.ts +59 -0
- package/src/witness/robbot/robbot-base-v1.ts +1531 -0
- package/src/witness/robbot/robbot-constants.mts +25 -0
- package/src/witness/robbot/robbot-helper.mts +676 -0
- package/src/witness/robbot/robbot-helper.spec.mts +135 -0
- package/src/witness/robbot/robbot-types.mts +797 -0
- package/src/witness/space/bootstrap/bootstrap-constants.mts +15 -0
- package/src/witness/space/inner-space-v1.ts +372 -0
- package/src/witness/space/outer-space/outer-space-constants.mts +1 -0
- package/src/witness/space/outer-space/outer-space-helper.mts +91 -0
- package/src/witness/space/outer-space/outer-space-types.mts +627 -0
- package/src/witness/space/space-base-v1.mts +414 -0
- package/src/witness/space/space-constants.mts +208 -0
- package/src/witness/space/space-helper.mts +3242 -0
- package/src/witness/space/space-types.mts +476 -0
- package/src/witness/witness-base-v1.ts +325 -0
- package/src/witness/witness-constants.mts +2 -0
- package/src/witness/witness-form-builder.mts +128 -0
- package/src/witness/witness-helper.mts +256 -0
- package/src/witness/witness-types.mts +249 -0
- package/tsconfig.json +15 -0
- package/tsconfig.test.json +10 -0
|
@@ -0,0 +1,797 @@
|
|
|
1
|
+
import * as h from '@ibgib/helper-gib';
|
|
2
|
+
import { Lex, LexData, LexDatum, PropsData, Ssml } from '@ibgib/helper-gib';
|
|
3
|
+
import { Gib, IbGibAddr, TjpIbGibAddr, TransformResult } from '@ibgib/ts-gib';
|
|
4
|
+
import { IbGibData_V1, IbGibRel8ns_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
WitnessData_V1, WitnessRel8ns_V1,
|
|
8
|
+
WitnessCmdData, WitnessCmdRel8ns, WitnessCmdIbGib,
|
|
9
|
+
WitnessResultData, WitnessResultRel8ns, WitnessResultIbGib,
|
|
10
|
+
} from '../witness-types.mjs';
|
|
11
|
+
import { CommentIbGib_V1 } from '../../common/comment/comment-types.mjs';
|
|
12
|
+
import { ROBBOT_TAG_TJP_ADDRS_REL8N_NAME } from './robbot-constants.mjs';
|
|
13
|
+
import { IbGibRobbotAny } from './robbot-base-v1.js';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export type RobbotTransparency = 'transparent' | 'translucent' | 'opaque';
|
|
17
|
+
|
|
18
|
+
export interface RobbotData_V1 extends WitnessData_V1 {
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Name of a Robbot instance...after all, Robbie was only the first Robbot.
|
|
22
|
+
*/
|
|
23
|
+
name: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Redeclared over {@link WitnessData_V1.uuid} making it a required field.
|
|
27
|
+
*/
|
|
28
|
+
uuid: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* For simpler robbots (i.e. early implementations), I'm not sure what this
|
|
32
|
+
* will entail. Ideally the function dependency graph is public but right
|
|
33
|
+
* now we're living with witness functionality "off-chain" ("on-chain"
|
|
34
|
+
* stored in git version control).
|
|
35
|
+
*
|
|
36
|
+
* I think atm this will mean that any weighting will be public. If a robbot
|
|
37
|
+
* has any randomness in its decision making, then this should be
|
|
38
|
+
* translucent at least.
|
|
39
|
+
*
|
|
40
|
+
* Of course, even in the future when there are more sovereign "A"Is,
|
|
41
|
+
* transparency doesn't mean you understand where he/she/it is coming from -
|
|
42
|
+
* only that the raw data is available to see.
|
|
43
|
+
*/
|
|
44
|
+
// reasoningTransparency: RobbotTransparency;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Transparency of timing of planned ibgibs to be presented to the user in a
|
|
48
|
+
* context.
|
|
49
|
+
*
|
|
50
|
+
* For example, when the robbot is asked to process an ibgib context, it
|
|
51
|
+
* must decide when to add which ibgibs to it's output context.
|
|
52
|
+
*/
|
|
53
|
+
// schedulingTransparency: RobbotTransparency;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Minimum amount of time between outputs allowed by the robbot.
|
|
57
|
+
*/
|
|
58
|
+
// minSecondsBetweenPosts: number;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Robbots work with scheduling and executing ibgib processing. But
|
|
62
|
+
* it is often (always?) advantageous to give a certain amount of leeway
|
|
63
|
+
* within the algorithms for making scheduling decisions. This is a
|
|
64
|
+
* maximum time variance percentage per decision.
|
|
65
|
+
*
|
|
66
|
+
* So if there is a rigid schedule of every N days, then we allow that
|
|
67
|
+
* it may indeed schedule the ibgib N +- (N * variance/100). If N is 50,
|
|
68
|
+
* and max variance is 10, then this may schedule the output at
|
|
69
|
+
* 50 plus or minus up to 5; consequently a range from 45-55.
|
|
70
|
+
*/
|
|
71
|
+
// maxTimeVariancePercentage: number;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* If true, then this robbot will be started upon app startup, and perhaps
|
|
75
|
+
* in a background service in the future.
|
|
76
|
+
*
|
|
77
|
+
* if false, the robbot will schedule and execute a single "round" only when
|
|
78
|
+
* prompted by a user.
|
|
79
|
+
*/
|
|
80
|
+
// active: boolean;
|
|
81
|
+
// for now, all robbot output will be passive, i.e., when you ask the robbot
|
|
82
|
+
// within a context using the bottom action bar.
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Some ibgibs work at the date (day) level of granularity, while others
|
|
86
|
+
* work down to the time.
|
|
87
|
+
*/
|
|
88
|
+
// scheduleGranularity: 'date' | 'time';
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* If provided, this will be prepended to any comments made by the robbot,
|
|
92
|
+
* as well as the output subcontext if {@link outputMode} is
|
|
93
|
+
* {@link RobbotOutputMode.subcontext}.
|
|
94
|
+
*/
|
|
95
|
+
outputPrefix?: string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* If provided, this will be appended to any comments made by the robbot,
|
|
99
|
+
* as well as the output subcontext if {@link outputMode} is
|
|
100
|
+
* {@link RobbotOutputMode.subcontext}.
|
|
101
|
+
*/
|
|
102
|
+
outputSuffix?: string;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* There are multiple possibilities for where to output:
|
|
106
|
+
*
|
|
107
|
+
* 1. Inside the input context
|
|
108
|
+
* 2. In a different subcontext ibgib
|
|
109
|
+
* 3. In the robbot's ibgib (todo later)
|
|
110
|
+
* 4. Tagged but not "inside" an ibgib (not planned atm).
|
|
111
|
+
*
|
|
112
|
+
* Also, it is possible to tag all outputs regardless of where the ibgibs
|
|
113
|
+
* are placed originally. @see {@link tagOutput}
|
|
114
|
+
*
|
|
115
|
+
* ## thoughts
|
|
116
|
+
*
|
|
117
|
+
* Since the driving use case is to create drills, it would seem that inside
|
|
118
|
+
* a single grouping ibgib within the output context makes the most sense.
|
|
119
|
+
*/
|
|
120
|
+
// outputMode?: RobbotOutputMode;
|
|
121
|
+
|
|
122
|
+
// /**
|
|
123
|
+
// * If true, rel8s output context depending on {@link outputMode} to the latest
|
|
124
|
+
// * tag(s) whose tjpAddr(s) are given in {@link RobbotRel8ns_V1}
|
|
125
|
+
// * {@link ROBBOT_TAG_TJP_ADDRS_REL8N_NAME}.
|
|
126
|
+
// */
|
|
127
|
+
// tagOutput?: boolean;
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* When relating to an ibGib, this is the default rel8n name.
|
|
132
|
+
*
|
|
133
|
+
* @see `RobbotBase_V1.rel8To`
|
|
134
|
+
*/
|
|
135
|
+
defaultRel8nName?: string;
|
|
136
|
+
/**
|
|
137
|
+
* list of all rel8n names, e.g. {@link defaultRel8nName},
|
|
138
|
+
* that this robbot uses for "my ibgibs".
|
|
139
|
+
*/
|
|
140
|
+
allRel8nNames?: string[];
|
|
141
|
+
/**
|
|
142
|
+
* escape sequence when requesting something from a robbot.
|
|
143
|
+
*
|
|
144
|
+
* So if a comment starts with this, then it's someone asking a robbot to do
|
|
145
|
+
* something.
|
|
146
|
+
*/
|
|
147
|
+
requestEscapeString?: string;
|
|
148
|
+
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* default value for a robbot request escape string (that string to signify
|
|
153
|
+
* a comment is a request of a robbot)
|
|
154
|
+
*/
|
|
155
|
+
export const DEFAULT_ROBBOT_REQUEST_ESCAPE_STRING = '?';
|
|
156
|
+
export const DEFAULT_ROBBOT_REQUEST_MAX_LENGTH = 100;
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
// /**
|
|
160
|
+
// * @see {@link RobbotData_V1.outputMode}
|
|
161
|
+
// */
|
|
162
|
+
// export type RobbotOutputMode = 'context' | 'subcontext' | 'ask';
|
|
163
|
+
// export const RobbotOutputMode = {
|
|
164
|
+
// /**
|
|
165
|
+
// * spread out within the target context
|
|
166
|
+
// */
|
|
167
|
+
// context: 'context' as RobbotOutputMode,
|
|
168
|
+
// /**
|
|
169
|
+
// * creates a single comment ibgib and outputs within that
|
|
170
|
+
// */
|
|
171
|
+
// subcontext: 'subcontext' as RobbotOutputMode,
|
|
172
|
+
// }
|
|
173
|
+
// export const VALID_ROBBOT_OUTPUT_MODES = Object.values(RobbotOutputMode);
|
|
174
|
+
|
|
175
|
+
export interface RobbotRel8ns_V1 extends WitnessRel8ns_V1 {
|
|
176
|
+
[ROBBOT_TAG_TJP_ADDRS_REL8N_NAME]?: TjpIbGibAddr[];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* A robbot's primary function when assigned to an ibgib is to analyze a context
|
|
181
|
+
* ibgib as its input, and output ibgibs into the same or another context.
|
|
182
|
+
*
|
|
183
|
+
* This is quite similar to existing ideas of microservices, but with a few key
|
|
184
|
+
* differences:
|
|
185
|
+
*
|
|
186
|
+
* 1. Robbots exist within the limited domain of ibgib transforms, i.e., `fork`,
|
|
187
|
+
* `mut8` & `rel8` transforms.
|
|
188
|
+
* 2. Robbots themselves live "on-chain" alongside the data with which they
|
|
189
|
+
* interact.
|
|
190
|
+
*/
|
|
191
|
+
export interface RobbotIbGib_V1 extends IbGib_V1<RobbotData_V1, RobbotRel8ns_V1> {
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Cmds for interacting with ibgib spaces.
|
|
198
|
+
*
|
|
199
|
+
* Not all of these will be implemented for every space.
|
|
200
|
+
*
|
|
201
|
+
* ## todo
|
|
202
|
+
*
|
|
203
|
+
* change these commands to better structure, e.g., verb/do/mod, can/get/addrs
|
|
204
|
+
* */
|
|
205
|
+
export type RobbotCmd =
|
|
206
|
+
'ib' | 'gib' | 'ibgib' | 'activate' | 'deactivate';
|
|
207
|
+
/** Cmds for interacting with ibgib spaces. */
|
|
208
|
+
export const RobbotCmd = {
|
|
209
|
+
/**
|
|
210
|
+
* it's more like a grunt that is intepreted by context from the robbot.
|
|
211
|
+
*
|
|
212
|
+
* my initial use of this will be to add an ibgib to a robbot's
|
|
213
|
+
* awareness. (input)
|
|
214
|
+
*/
|
|
215
|
+
ib: 'ib' as RobbotCmd,
|
|
216
|
+
/**
|
|
217
|
+
* it's more like a grunt that is intepreted by context from the robbot.
|
|
218
|
+
*
|
|
219
|
+
* my initial use of this will be to indicate to a robbot to add to a
|
|
220
|
+
* conversation. (output)
|
|
221
|
+
*/
|
|
222
|
+
gib: 'gib' as RobbotCmd,
|
|
223
|
+
/**
|
|
224
|
+
* third placeholder command.
|
|
225
|
+
*
|
|
226
|
+
* I imagine this will be like "what's up", but who knows.
|
|
227
|
+
*/
|
|
228
|
+
ibgib: 'ibgib' as RobbotCmd,
|
|
229
|
+
/**
|
|
230
|
+
* power on
|
|
231
|
+
*/
|
|
232
|
+
activate: 'activate' as RobbotCmd,
|
|
233
|
+
/** power off */
|
|
234
|
+
deactivate: 'deactivate' as RobbotCmd,
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Flags to affect the command's interpretation.
|
|
239
|
+
*/
|
|
240
|
+
export type RobbotCmdModifier =
|
|
241
|
+
'ib' | 'gib' | 'ibgib';
|
|
242
|
+
/**
|
|
243
|
+
* Flags to affect the command's interpretation.
|
|
244
|
+
*/
|
|
245
|
+
export const RobbotCmdModifier = {
|
|
246
|
+
/**
|
|
247
|
+
* hmm...
|
|
248
|
+
*/
|
|
249
|
+
ib: 'ib' as RobbotCmdModifier,
|
|
250
|
+
/**
|
|
251
|
+
* hmm...
|
|
252
|
+
*/
|
|
253
|
+
gib: 'gib' as RobbotCmdModifier,
|
|
254
|
+
/**
|
|
255
|
+
* hmm...
|
|
256
|
+
*/
|
|
257
|
+
ibgib: 'ibgib' as RobbotCmdModifier,
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** Information for interacting with spaces. */
|
|
261
|
+
export interface RobbotCmdData
|
|
262
|
+
extends WitnessCmdData<RobbotCmd, RobbotCmdModifier> {
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export interface RobbotCmdRel8ns extends WitnessCmdRel8ns {
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Shape of options ibgib if used for a robbot.
|
|
270
|
+
*
|
|
271
|
+
* I'm not sure what to do with this atm, so I'm just stubbing out...
|
|
272
|
+
*/
|
|
273
|
+
export interface RobbotCmdIbGib<
|
|
274
|
+
TIbGib extends IbGib_V1 = IbGib_V1,
|
|
275
|
+
TCmdData extends RobbotCmdData = RobbotCmdData,
|
|
276
|
+
TCmdRel8ns extends RobbotCmdRel8ns = RobbotCmdRel8ns,
|
|
277
|
+
> extends WitnessCmdIbGib<TIbGib, RobbotCmd, RobbotCmdModifier, TCmdData, TCmdRel8ns> {
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Optional shape of result data to robbot interactions.
|
|
282
|
+
*
|
|
283
|
+
* This is in addition of course to {@link WitnessResultData}.
|
|
284
|
+
*
|
|
285
|
+
* ## notes
|
|
286
|
+
*
|
|
287
|
+
* * I'm not sure what to do with this atm, so I'm just stubbing out...
|
|
288
|
+
*/
|
|
289
|
+
export interface RobbotResultData extends WitnessResultData {
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Marker interface rel8ns atm...
|
|
294
|
+
*
|
|
295
|
+
* I'm not sure what to do with this atm, so I'm just stubbing out...
|
|
296
|
+
*/
|
|
297
|
+
export interface RobbotResultRel8ns extends WitnessResultRel8ns { }
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Shape of result ibgib if used for a robbot.
|
|
301
|
+
*
|
|
302
|
+
* I'm not sure what to do with this atm, so I'm just stubbing out...
|
|
303
|
+
*/
|
|
304
|
+
export interface RobbotResultIbGib<
|
|
305
|
+
TIbGib extends IbGib_V1,
|
|
306
|
+
TResultData extends RobbotResultData,
|
|
307
|
+
TResultRel8ns extends RobbotResultRel8ns
|
|
308
|
+
>
|
|
309
|
+
extends WitnessResultIbGib<TIbGib, TResultData, TResultRel8ns> {
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* When a robbot creates a comment on a context ibgib, he/she also relates it to
|
|
314
|
+
* itself via this rel8nName.
|
|
315
|
+
*
|
|
316
|
+
* @example robbot.rel8ns.my_comment = 'comment myawesomeopinion wordyrobbot123^ABC'
|
|
317
|
+
*
|
|
318
|
+
* ## notes
|
|
319
|
+
*
|
|
320
|
+
* * "my" prefix is used to differentiate between the robbot's comments and comments
|
|
321
|
+
* on the robbot itself.
|
|
322
|
+
*/
|
|
323
|
+
export const ROBBOT_MY_COMMENTS_REL8N_NAME = 'my_comment';
|
|
324
|
+
/**
|
|
325
|
+
* When a robbot participates in a conversation, that context is related via
|
|
326
|
+
* this rel8n name.
|
|
327
|
+
* @example robbot.rel8ns.context = 'comment someconvo^ABC'
|
|
328
|
+
*/
|
|
329
|
+
export const ROBBOT_CONTEXT_REL8N_NAME = 'context';
|
|
330
|
+
/**
|
|
331
|
+
* Used to rel8 session ibgibs to robbots.
|
|
332
|
+
* @example robbot.rel8ns.session = ['session 123^ABC'];
|
|
333
|
+
*/
|
|
334
|
+
export const ROBBOT_SESSION_REL8N_NAME = 'session';
|
|
335
|
+
/**
|
|
336
|
+
* Used to rel8 interaction to sessions,
|
|
337
|
+
* @example session.rel8ns.interaction = ['interaction 123^ABC'];
|
|
338
|
+
*/
|
|
339
|
+
export const ROBBOT_INTERACTION_REL8N_NAME = 'interaction';
|
|
340
|
+
|
|
341
|
+
export const ROBBOT_SESSION_ATOM = 'robbot_session';
|
|
342
|
+
export const ROBBOT_ANALYSIS_ATOM = 'robbot_analysis';
|
|
343
|
+
export const ROBBOT_INTERACTION_ATOM = 'robbot_interaction';
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* This is stimulus that is coming over the Context that a robbot is being
|
|
348
|
+
* stimulated with.
|
|
349
|
+
*
|
|
350
|
+
* This is different than stimulus that the robbot provides for a given ibgib.
|
|
351
|
+
*/
|
|
352
|
+
export interface StimulusForRobbot {
|
|
353
|
+
/**
|
|
354
|
+
* The actual ibgib that is the stimulus.
|
|
355
|
+
*
|
|
356
|
+
* If falsy, `isClick` should be true.
|
|
357
|
+
*/
|
|
358
|
+
ibGib?: IbGib_V1;
|
|
359
|
+
/**
|
|
360
|
+
* should be true if the user has typed in a request and added the
|
|
361
|
+
* comment to the context.
|
|
362
|
+
*/
|
|
363
|
+
isRequest?: boolean;
|
|
364
|
+
/**
|
|
365
|
+
* The stimulus was generated from a click on a button, as opposed to a
|
|
366
|
+
* comment typed in or a picture/link/comment added/imported in a context.
|
|
367
|
+
*
|
|
368
|
+
* Should be true if `ibGib` is falsy.
|
|
369
|
+
*/
|
|
370
|
+
isClick?: boolean;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export type RobbotInteractionType = 'greeting' | 'stimulation' | 'farewell' | 'info' | 'help';
|
|
374
|
+
export const RobbotInteractionType = {
|
|
375
|
+
/**
|
|
376
|
+
* opening statement of a robbot
|
|
377
|
+
*/
|
|
378
|
+
greeting: 'greeting' as RobbotInteractionType,
|
|
379
|
+
/**
|
|
380
|
+
* stimulates a certain ibgib.
|
|
381
|
+
*/
|
|
382
|
+
stimulation: 'stimulation' as RobbotInteractionType,
|
|
383
|
+
/**
|
|
384
|
+
* closing statements of a robbot
|
|
385
|
+
*/
|
|
386
|
+
farewell: 'farewell' as RobbotInteractionType,
|
|
387
|
+
/**
|
|
388
|
+
* small nudges of info, including possibly repeating previous statement.
|
|
389
|
+
*/
|
|
390
|
+
info: 'info' as RobbotInteractionType,
|
|
391
|
+
/**
|
|
392
|
+
* providing info about context to aid the user in their options.
|
|
393
|
+
*/
|
|
394
|
+
help: 'help' as RobbotInteractionType,
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
export const DEFAULT_INTERACTION_SUBJECTTJPGIBS_DELIM = '_';
|
|
399
|
+
export const UNDEFINED_INTERACTION_SUBJECTTJPGIBS_STRING = 'undefined';
|
|
400
|
+
|
|
401
|
+
export interface RobbotInteractionIbInfo {
|
|
402
|
+
atom: string,
|
|
403
|
+
type: string,
|
|
404
|
+
timestampInTicks: string,
|
|
405
|
+
subjectTjpGibs?: Gib[],
|
|
406
|
+
addlDetailsText?: string,
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export interface RobbotInteractionData_V1 extends IbGibData_V1 {
|
|
410
|
+
timestamp: string;
|
|
411
|
+
/**
|
|
412
|
+
* type of this interaction. for now, this is strongly typed, but
|
|
413
|
+
* later I should add a catchall `| string` type to allow for
|
|
414
|
+
* expansion.
|
|
415
|
+
*/
|
|
416
|
+
type: RobbotInteractionType;
|
|
417
|
+
/**
|
|
418
|
+
* The tjpGib of the interaction's context ibgib.
|
|
419
|
+
*/
|
|
420
|
+
contextTjpGib: Gib;
|
|
421
|
+
/**
|
|
422
|
+
* When an interaction pertains to particular timelines, e.g. stimulating
|
|
423
|
+
* one or more ibgibs, those tjp gibs should be listed here.
|
|
424
|
+
*/
|
|
425
|
+
subjectTjpGibs?: Gib[];
|
|
426
|
+
/**
|
|
427
|
+
* Produced comment text from the interaction. This should be the
|
|
428
|
+
* content of text that the robbot outputs to the context.
|
|
429
|
+
*/
|
|
430
|
+
commentText?: string;
|
|
431
|
+
/**
|
|
432
|
+
* should be an interfaced data object that represents the details of the
|
|
433
|
+
* interaction, e.g. if a stimulation, then here is the simulation interface data.
|
|
434
|
+
*
|
|
435
|
+
* ## notes
|
|
436
|
+
*
|
|
437
|
+
* to create another generic interface here would be too unwieldy. (already may be!)
|
|
438
|
+
*/
|
|
439
|
+
details?: any;
|
|
440
|
+
/**
|
|
441
|
+
* If interaction is associated with a session, here is the session tjp addr.
|
|
442
|
+
*/
|
|
443
|
+
'@sessionTjp'?: TjpIbGibAddr;
|
|
444
|
+
/**
|
|
445
|
+
* If interaction is associated with a session, here is the session id.
|
|
446
|
+
*/
|
|
447
|
+
sessionId?: string;
|
|
448
|
+
/**
|
|
449
|
+
* Flag to indicate if the interaction is expecting a response, like a
|
|
450
|
+
* question to be answered by the user.
|
|
451
|
+
*/
|
|
452
|
+
expectingResponse?: boolean;
|
|
453
|
+
}
|
|
454
|
+
export interface RobbotInteractionRel8ns_V1 extends IbGibRel8ns_V1 {
|
|
455
|
+
}
|
|
456
|
+
export interface RobbotInteractionIbGib_V1
|
|
457
|
+
extends IbGib_V1<RobbotInteractionData_V1, RobbotInteractionRel8ns_V1> { }
|
|
458
|
+
|
|
459
|
+
export interface RobbotSessionData_V1 extends IbGibData_V1 {
|
|
460
|
+
timestamp: string;
|
|
461
|
+
/**
|
|
462
|
+
* Soft link to the context address where the session takes place.
|
|
463
|
+
*/
|
|
464
|
+
'@context': IbGibAddr;
|
|
465
|
+
/**
|
|
466
|
+
* Soft link to the context's tjp address where the session takes place.
|
|
467
|
+
*/
|
|
468
|
+
'@contextTjp': IbGibAddr;
|
|
469
|
+
}
|
|
470
|
+
export interface RobbotSessionRel8ns_V1 extends IbGibRel8ns_V1 {
|
|
471
|
+
interaction?: IbGibAddr[];
|
|
472
|
+
}
|
|
473
|
+
export interface RobbotSessionIbGib_V1 extends IbGib_V1<RobbotSessionData_V1, RobbotSessionRel8ns_V1> { }
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* These are used for raw words/phrases that compose larger, more complex
|
|
478
|
+
* semantic ideas that use SemanticId.
|
|
479
|
+
*
|
|
480
|
+
* Because these are used in composition of lex data, they are not prefixed
|
|
481
|
+
* with something like "atomic_", e.g. "atomic_hi".
|
|
482
|
+
*/
|
|
483
|
+
export type AtomicId =
|
|
484
|
+
'hi' | 'welcome' | 'bye' |
|
|
485
|
+
'yes' | 'no' |
|
|
486
|
+
'learn' |
|
|
487
|
+
'wtg';
|
|
488
|
+
export const AtomicId = {
|
|
489
|
+
hi: 'hi' as AtomicId,
|
|
490
|
+
welcome: 'welcome' as AtomicId,
|
|
491
|
+
bye: 'bye' as AtomicId,
|
|
492
|
+
yes: 'yes' as AtomicId,
|
|
493
|
+
no: 'no' as AtomicId,
|
|
494
|
+
learn: 'learn' as AtomicId,
|
|
495
|
+
wtg: 'wtg' as AtomicId,
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* These are used for specific lex commands/intents/whatevers. Synonyms and
|
|
500
|
+
* equivalency phrases ultimately get resolved to these.
|
|
501
|
+
*
|
|
502
|
+
* These are complex concepts, as opposed to the smaller atomic words/phrases, that
|
|
503
|
+
* a robbot will use when interacting with users.
|
|
504
|
+
*
|
|
505
|
+
* ## example
|
|
506
|
+
*
|
|
507
|
+
* A robbot may say in a semantic greeting (SemanticId.hello) that incorporates
|
|
508
|
+
* a lot of context-specific text. However, these individual greetings will
|
|
509
|
+
* most likely include the usage of individual phrases like 'hi' or 'good day'.
|
|
510
|
+
* These are small, raw "atomic" lexical atoms.
|
|
511
|
+
*/
|
|
512
|
+
export type SemanticId =
|
|
513
|
+
'semantic_help' |
|
|
514
|
+
'semantic_hello' | 'semantic_bye' |
|
|
515
|
+
'semantic_yes' | 'semantic_no' | 'semantic_cancel' |
|
|
516
|
+
'semantic_skip' | 'semantic_forget' | 'semantic_next' |
|
|
517
|
+
'semantic_please' |
|
|
518
|
+
'semantic_in_progress' |
|
|
519
|
+
'semantic_list' |
|
|
520
|
+
'semantic_request' |
|
|
521
|
+
'semantic_count' |
|
|
522
|
+
'semantic_options' |
|
|
523
|
+
'semantic_ready' |
|
|
524
|
+
'semantic_stop' |
|
|
525
|
+
'semantic_result' |
|
|
526
|
+
'semantic_unknown' | 'semantic_default' |
|
|
527
|
+
string; // have to do this for inheritance?
|
|
528
|
+
export const SemanticId = {
|
|
529
|
+
help: 'semantic_help' as SemanticId,
|
|
530
|
+
hello: 'semantic_hello' as SemanticId,
|
|
531
|
+
bye: 'semantic_bye' as SemanticId,
|
|
532
|
+
yes: 'semantic_yes' as SemanticId,
|
|
533
|
+
no: 'semantic_no' as SemanticId,
|
|
534
|
+
cancel: 'semantic_cancel' as SemanticId,
|
|
535
|
+
skip: 'semantic_skip' as SemanticId,
|
|
536
|
+
forget: 'semantic_forget' as SemanticId,
|
|
537
|
+
next: 'semantic_next' as SemanticId,
|
|
538
|
+
please: 'semantic_please' as SemanticId,
|
|
539
|
+
in_progress: 'semantic_in_progress' as SemanticId,
|
|
540
|
+
list: 'semantic_list' as SemanticId,
|
|
541
|
+
request: 'semantic_request' as SemanticId,
|
|
542
|
+
count: 'semantic_count' as SemanticId,
|
|
543
|
+
options: 'semantic_options' as SemanticId,
|
|
544
|
+
ready: 'semantic_ready' as SemanticId,
|
|
545
|
+
stop: 'semantic_stop' as SemanticId,
|
|
546
|
+
result: 'semantic_result' as SemanticId,
|
|
547
|
+
unknown: 'semantic_unknown' as SemanticId,
|
|
548
|
+
default: 'semantic_default' as SemanticId,
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
export interface SemanticInfo {
|
|
552
|
+
semanticId?: SemanticId;
|
|
553
|
+
request?: CommentIbGib_V1;
|
|
554
|
+
other?: IbGib_V1;
|
|
555
|
+
isContinuation?: boolean;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export interface SemanticHandlerResult {
|
|
559
|
+
interaction: RobbotInteractionIbGib_V1 | null;
|
|
560
|
+
/**
|
|
561
|
+
* Should be set to true if the interaction is aborted (i.e. we're ignoring
|
|
562
|
+
* some stimulus). Like if we're expecting a response, but some other ibgib
|
|
563
|
+
* is given (maybe some users/other robbots are talking and it doesn't
|
|
564
|
+
* pertain to us).
|
|
565
|
+
*/
|
|
566
|
+
ignored?: boolean;
|
|
567
|
+
/**
|
|
568
|
+
* If the handler is expecting a response (however the handler may interpret that response),
|
|
569
|
+
*
|
|
570
|
+
*/
|
|
571
|
+
// responseSubject?: ReplaySubject<IbGib_V1 | null>;
|
|
572
|
+
// onResponse?: (response: IbGib_V1|null) => Promise<void>;
|
|
573
|
+
}
|
|
574
|
+
export interface SemanticHandler {
|
|
575
|
+
/**
|
|
576
|
+
* This should be a unique id for this handler.
|
|
577
|
+
*/
|
|
578
|
+
handlerId: string;
|
|
579
|
+
/**
|
|
580
|
+
* The semanticId that this handler is associated with.
|
|
581
|
+
*/
|
|
582
|
+
semanticId: SemanticId;
|
|
583
|
+
/**
|
|
584
|
+
* If truthy, the robbot should execute this filter before
|
|
585
|
+
* attempting to execute this handler's {@link fnExec}
|
|
586
|
+
*/
|
|
587
|
+
fnCanExec: (info: SemanticInfo) => Promise<boolean>;
|
|
588
|
+
/**
|
|
589
|
+
* Actual function of handler that gets executed if context is
|
|
590
|
+
* correct ({@link fnCanHandle} is true).
|
|
591
|
+
*/
|
|
592
|
+
fnExec: (info: SemanticInfo) => Promise<SemanticHandlerResult>;
|
|
593
|
+
/**
|
|
594
|
+
* If the user cancels the response and this is truthy, this is called.
|
|
595
|
+
*/
|
|
596
|
+
fnCancelResponse?: () => Promise<void>;
|
|
597
|
+
// handleSubject$: ReplaySubject<SemanticInfo>;
|
|
598
|
+
// handleResult$: ReplaySubject<SemanticHandlerResult>;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
export interface RobbotPropsData<TSemanticId extends SemanticId = SemanticId> extends PropsData {
|
|
602
|
+
/**
|
|
603
|
+
* This datum expects these template vars.
|
|
604
|
+
*
|
|
605
|
+
* This is not strictly necessary, but is used for documentation/aid to the
|
|
606
|
+
* caller on providing stuff for the datum for what is expected.
|
|
607
|
+
*/
|
|
608
|
+
templateVars?: string;
|
|
609
|
+
/**
|
|
610
|
+
* If assigned, then this lex datum is a semantic entry, and this is the corresponding
|
|
611
|
+
* semantic id.
|
|
612
|
+
*/
|
|
613
|
+
semanticId?: TSemanticId;
|
|
614
|
+
atomicId?: AtomicId;
|
|
615
|
+
/**
|
|
616
|
+
* Only use this lex datum if YES there is an active session in progress.
|
|
617
|
+
*/
|
|
618
|
+
onlyInSession?: boolean;
|
|
619
|
+
/**
|
|
620
|
+
* Only use this lex datum if there is NOT an active session in progress.
|
|
621
|
+
*/
|
|
622
|
+
onlyNotInSession?: boolean;
|
|
623
|
+
/**
|
|
624
|
+
* The robbot hasn't seen anything so has no knowledge/has nothing to work
|
|
625
|
+
* on.
|
|
626
|
+
*/
|
|
627
|
+
blankSlate?: boolean;
|
|
628
|
+
/**
|
|
629
|
+
* Just starting a new session, i.e. no prev interactions exist.
|
|
630
|
+
*/
|
|
631
|
+
freshStart?: boolean;
|
|
632
|
+
/**
|
|
633
|
+
* Flag to indicate if the lex datum corresponds to a user request.
|
|
634
|
+
*/
|
|
635
|
+
isRequest?: boolean;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export function toLexDatums_Semantics(semanticId: SemanticId, texts: string[]): LexDatum<RobbotPropsData>[] {
|
|
639
|
+
return texts.flatMap(t => {
|
|
640
|
+
return {
|
|
641
|
+
texts: [t],
|
|
642
|
+
language: 'en-US',
|
|
643
|
+
props: { semanticId },
|
|
644
|
+
} as LexDatum<RobbotPropsData>;
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
export function toLexDatums_Atomics(atomicId: AtomicId, texts: string[]): LexDatum<RobbotPropsData>[] {
|
|
648
|
+
return texts.flatMap(t => {
|
|
649
|
+
return {
|
|
650
|
+
texts: [t],
|
|
651
|
+
language: 'en-US',
|
|
652
|
+
props: { atomicId },
|
|
653
|
+
} as LexDatum<RobbotPropsData>;
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
export const DEFAULT_HUMAN_LEX_DATA_ENGLISH_SEMANTICS: LexData<RobbotPropsData> = {
|
|
658
|
+
[SemanticId.help]: [
|
|
659
|
+
...toLexDatums_Semantics(SemanticId.help, [
|
|
660
|
+
'h', 'help', 'help me',
|
|
661
|
+
]),
|
|
662
|
+
],
|
|
663
|
+
[SemanticId.yes]: [
|
|
664
|
+
...toLexDatums_Semantics(SemanticId.yes, [
|
|
665
|
+
'yes', 'y', 'yeah', 'yea', 'aye', 'yup', 'yep', 'sure', 'ok',
|
|
666
|
+
'sounds good', 'go for it', 'yes please', 'yes thanks', 'ok thanks',
|
|
667
|
+
'uh huh', 'god yes', 'affirmative', 'ten four', '10-4', 'roger',
|
|
668
|
+
]),
|
|
669
|
+
],
|
|
670
|
+
[SemanticId.no]: [
|
|
671
|
+
...toLexDatums_Semantics(SemanticId.no, [
|
|
672
|
+
'no', 'n', 'nah', 'nay', 'nope', 'uh uh', 'no thanks', 'ick', 'nuh uh',
|
|
673
|
+
'god no', 'no way', 'not at all', 'negative', 'that\'s a negative', 'nein',
|
|
674
|
+
])
|
|
675
|
+
],
|
|
676
|
+
[SemanticId.cancel]: [
|
|
677
|
+
...toLexDatums_Semantics(SemanticId.cancel, [
|
|
678
|
+
'cancel', 'nm', 'nevermind', 'cancel that', 'don\'t worry about it'
|
|
679
|
+
])
|
|
680
|
+
],
|
|
681
|
+
[SemanticId.skip]: [
|
|
682
|
+
...toLexDatums_Semantics(SemanticId.skip, [
|
|
683
|
+
'skip', 'sk',
|
|
684
|
+
])
|
|
685
|
+
],
|
|
686
|
+
[SemanticId.forget]: [
|
|
687
|
+
...toLexDatums_Semantics(SemanticId.forget, [
|
|
688
|
+
'forget', 'forget this', 'forget this one',
|
|
689
|
+
])
|
|
690
|
+
],
|
|
691
|
+
[SemanticId.next]: [
|
|
692
|
+
...toLexDatums_Semantics(SemanticId.next, [
|
|
693
|
+
'next', // 'next $(please)' /* need to get this kind of thing working */
|
|
694
|
+
])
|
|
695
|
+
],
|
|
696
|
+
[SemanticId.bye]: [
|
|
697
|
+
...toLexDatums_Semantics(SemanticId.bye, [
|
|
698
|
+
'bye', 'bye bye', 'see you later', 'see you',
|
|
699
|
+
])
|
|
700
|
+
],
|
|
701
|
+
[SemanticId.unknown]: [
|
|
702
|
+
...toLexDatums_Semantics(SemanticId.unknown, [
|
|
703
|
+
'are you mocking me, human?', 'mmhmm...', 'i see...', 'does not compute...', 'indeed'
|
|
704
|
+
])
|
|
705
|
+
],
|
|
706
|
+
};
|
|
707
|
+
export const DEFAULT_HUMAN_LEX_DATA_ENGLISH_ATOMICS: LexData<RobbotPropsData> = {
|
|
708
|
+
[AtomicId.hi]: [
|
|
709
|
+
...toLexDatums_Atomics(AtomicId.hi, [
|
|
710
|
+
'hi', 'howdy', 'hello', 'greetings', 'good day', 'hello there', 'good day to you', 'yo',
|
|
711
|
+
]),
|
|
712
|
+
],
|
|
713
|
+
[AtomicId.welcome]: [
|
|
714
|
+
...toLexDatums_Atomics(AtomicId.welcome, [
|
|
715
|
+
'welcome',
|
|
716
|
+
]),
|
|
717
|
+
],
|
|
718
|
+
[AtomicId.yes]: [
|
|
719
|
+
...toLexDatums_Atomics(AtomicId.yes, [
|
|
720
|
+
'yes', 'y', 'yeah', 'yea', 'aye', 'yup', 'yep', 'sure', 'ok',
|
|
721
|
+
'sounds good', 'go for it', 'yes please', 'yes thanks', 'ok thanks',
|
|
722
|
+
'uh huh', 'god yes', 'affirmative', 'ten four', '10-4', 'roger',
|
|
723
|
+
]),
|
|
724
|
+
],
|
|
725
|
+
[AtomicId.no]: [
|
|
726
|
+
...toLexDatums_Atomics(AtomicId.no, [
|
|
727
|
+
'no', 'n', 'nope', 'no thanks', 'no thank you',
|
|
728
|
+
]),
|
|
729
|
+
],
|
|
730
|
+
[AtomicId.bye]: [
|
|
731
|
+
...toLexDatums_Atomics(AtomicId.bye, [
|
|
732
|
+
'bye', 'bye bye', 'adios', 'ciao', 'later',
|
|
733
|
+
]),
|
|
734
|
+
],
|
|
735
|
+
[AtomicId.learn]: [
|
|
736
|
+
...toLexDatums_Atomics(AtomicId.learn, [
|
|
737
|
+
'learn', 'study', 'review',
|
|
738
|
+
]),
|
|
739
|
+
],
|
|
740
|
+
[AtomicId.wtg]: [
|
|
741
|
+
...toLexDatums_Atomics(AtomicId.wtg, [
|
|
742
|
+
'wtg', 'nice', 'not bad', 'pretty good', 'good job',
|
|
743
|
+
]),
|
|
744
|
+
],
|
|
745
|
+
}
|
|
746
|
+
export const DEFAULT_HUMAN_LEX_DATA_ENGLISH: LexData<RobbotPropsData> = {
|
|
747
|
+
...DEFAULT_HUMAN_LEX_DATA_ENGLISH_SEMANTICS,
|
|
748
|
+
...DEFAULT_HUMAN_LEX_DATA_ENGLISH_ATOMICS,
|
|
749
|
+
}
|
|
750
|
+
export const DEFAULT_HUMAN_LEX_DATA: LexData<RobbotPropsData> = {
|
|
751
|
+
...h.clone(DEFAULT_HUMAN_LEX_DATA_ENGLISH),
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
export const DEFAULT_USER_LEX_DATA: LexData<RobbotPropsData> = {
|
|
755
|
+
...h.clone(DEFAULT_HUMAN_LEX_DATA),
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* This lex is to be used for parsing user responses.
|
|
760
|
+
*
|
|
761
|
+
* Also, you can use this in the robbot's responses, if you initialize the
|
|
762
|
+
* robbot's lex to include this. This way, the robbot speaks as he/she expects
|
|
763
|
+
* to be spoken to.
|
|
764
|
+
*
|
|
765
|
+
* So when a user says 'yes', we can interpret it via a lookup in the lex data.
|
|
766
|
+
* we will find the id filter via keywords.
|
|
767
|
+
*/
|
|
768
|
+
export const DEFAULT_USER_LEX = new Lex<RobbotPropsData>(DEFAULT_USER_LEX_DATA, {
|
|
769
|
+
requestLanguage: "en-US", defaultLanguage: "en-US",
|
|
770
|
+
defaultCapitalize: "none",
|
|
771
|
+
defaultLineConcat: "delim", defaultDelim: "\n\n",
|
|
772
|
+
defaultKeywordMode: "any", defaultPropsMode: "prop",
|
|
773
|
+
});
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* default phrases for the robbot to use when chatting.
|
|
777
|
+
*/
|
|
778
|
+
export const DEFAULT_ROBBOT_LEX_DATA: LexData<RobbotPropsData> = {
|
|
779
|
+
...h.clone(DEFAULT_HUMAN_LEX_DATA),
|
|
780
|
+
};
|
|
781
|
+
// adjust for robbot-ness a bit
|
|
782
|
+
DEFAULT_ROBBOT_LEX_DATA[SemanticId.bye].push(
|
|
783
|
+
{
|
|
784
|
+
texts: ['EOL',],
|
|
785
|
+
ssmls: [Ssml.sub('EOL', 'end of line'),],
|
|
786
|
+
language: 'en-US',
|
|
787
|
+
props: { semanticId: SemanticId.bye, },
|
|
788
|
+
weighting: 100,
|
|
789
|
+
}
|
|
790
|
+
)
|
|
791
|
+
DEFAULT_ROBBOT_LEX_DATA[SemanticId.unknown] = [
|
|
792
|
+
...toLexDatums_Semantics(SemanticId.unknown, [
|
|
793
|
+
'i\'m not quite sure what you mean', 'does not compute',
|
|
794
|
+
])
|
|
795
|
+
];
|
|
796
|
+
|
|
797
|
+
export type RobbotPromptResult = TransformResult<IbGibRobbotAny>;
|