0.0.96 • Published 7 days ago

@ibgib/core-gib v0.0.96

Weekly downloads
-
License
ISC
Repository
-
Last release
7 days ago

🚧 wip.

I am working towards creating the fundamental es module package structure before pulling out behavior from the ionic-gib project into this lib. so this is just a shell right now.

forward

I have created a working MVP for ibgib that shows some of the potential for the architecture:

core-gib

core-gib is the intermediate ibgib substrate that provides functionality for basic ibgib interactions.

This includes plumbing for the following primary areas:

  • witnesses
  • spaces
  • apps
  • robbots

note: many of these could technically be its own library, but at the very least for now these will stay within this core library until it seems they should be broken out.

This sits on top of the lowest level ts-gib library, which provides the very basic primitives used in the mechanics of ibgib graphing.

witnesses

witness pseudocode at 10,000 feet

interface Witness extends IbGib {
  function witness(ibgib) => ibgib
}

let resultIbgib = await myIbgib.witness(argIbGib)

So, a witness is a specific type of ibgib that does something. It exposes itself to other ibgibs via a single function that takes in a single ibgib and returns a single ibgib. Since ibgibs are content-addressable, this makes it similar to a universally-addressed function that accepts a single universally-addressed argument and returns a single universally-addressed result in a universally-sized computer.

It is called a "witness" and not, say, a "function", "object", or "universal function/object", etc., because "witness" conveys that instead of being an impartial function, the ibgib has a POV. This associates an identity at the most fundamental level, giving flesh to the bias that exists in the function. This also abstracts away implementation details of individual functional implementations, be they in different languages, different architectures, etc.

So in short, a witness is a distributed computation metaversal function, but personified in order to remind each of us of anything's fallibility (including computer functions).

witness in real code

With this in mind, let's look at the witness interface definitions in TypeScript, with generic types and comments removed for clarity.

export interface IbGib {
    ib: Ib;    // string
    gib?: Gib; // string
}

export interface IbGibWithDataAndRel8ns<...> extends IbGib {
    data?: TData;     // object/map of string->any
    rel8ns?: TRel8ns; // map of string->string[]
}

export interface Witness<...> extends IbGibWithDataAndRel8ns<...> {
    witness(arg: TIbGibIn): Promise<TIbGibOut | undefined>;
}

This last Witness interface has a single member: the witness function. This accepts a single ibgib arg and returns a single ibgib result. Since each ibgib is content addressed^1, this allows for a function addressing scheme that effectively works in an infinite addressing space.

Considering this, the ibgib + witness design can be thought of as a superset of all programming languages with witness ibgib acting similar to how we think of functions. So inter-witness communications are at the extreme of functional programming. Or said another way it can describe any programming language. But when it comes to execution, adding the isomorphic transformation into the ibgib description space would necessarily add overhead and most likely create unfeasible execution times (until computation power vastly improves relative to our current POV in time). Or in short, it would be NECESSARILY SLOWER, to the point of local impracticality.

Still, it's important to think each witness as a universally addressed function, and each space as a special case witness whose job is colocation.

^1 primitives and other ibgibs without a gib hash, like "6^gib" or "hello^gib", are still "content addressed", it's simply the value is the address itself.

spaces

So a "witness" is an ibgib with behavior, i.e. doesn't just have data. A "space" is one kind of witness. Its primary job is to collocate ibgib according to some definition of location.

nuance: The implementation of "collocation" is not concrete and can be decided by - and vary wildly by - the implementing class.

types of spaces

Ideally all spaces are to be considered equally, with the idea being that you treat them as buckets of data. As such, we can think of them like a bucket or a very basic repository with just a couple capabilities: get, put, etc.

But when dealing with the process of living, temporal data dynamics, we must consider one key aspect of data: perspective, i.e. POV. As such, there are necessarily(?) three "types" of space with respect to POV:

  1. local space
  2. outer space
  3. inner space

These are currently implemented in the ionic-gib MVP as follows:

  1. local space
  1. outer space
  • implemented with AWSDynamoSpace_V1
  • this is implemented as a "merge" space, in that when ibgibs are "put" into the space, timelines are dynamically merged using a CRDT-like merging algorithm that applies unapplied DNA transforms
  • uses DynamoDB for most ibgib data stored as four string fields (max string size of 400 KB)
  • uses S3 for larger ibgibs with DynamoDB entries that indicate S3 storage
  1. inner space
  • the InnerSpace_V1 is not used or tested
  • it is only sketched
  • better composeability will be required for inner spaces to be utilized

witnesses, and thus spaces, as universally addressed functions

If you think of a function in a programming language, it has a couple of characteristics:

  • has an address
  • has at least one parameter, which ultimately has an an address (either in the stack/heap or a pointer to memory)
  • returns 0-1+ data structures

spaces related to witnesses

bootstrap

testing

importmaps - npm run test:browser fails

not implemented with respec-gib yet but this is what has to happen for import map. as a workaround for bleeding edge ES module consumption (let alone testing frameworks for them), to include an import map section. So atow paste the following code before any other script tags in the head section. (the versions may need to change):

note: if you are having CORS issues, it may be due to the cdn being down.

using unpkg:

  <script type="importmap">
    {
      "imports": {
        "@ibgib/helper-gib": "https://unpkg.com/@ibgib/helper-gib@0.0.4/dist/index.mjs",
        "@ibgib/helper-gib/": "https://unpkg.com/@ibgib/helper-gib@0.0.4/",
        "@ibgib/ts-gib": "https://unpkg.com/@ibgib/ts-gib@0.5.1/dist/index.mjs",
        "@ibgib/ts-gib/": "https://unpkg.com/@ibgib/ts-gib@0.5.1/",
        "@ibgib/encrypt-gib": "https://unpkg.com/@ibgib/encrypt-gib@0.1.6/dist/index.mjs",
        "@ibgib/encrypt-gib/": "https://unpkg.com/@ibgib/encrypt-gib@0.1.6/"
      }
    }
  </script>

using jsdelivr.net:

  <script type="importmap">
    {
      "imports": {
        "@ibgib/helper-gib": "https://cdn.jsdelivr.net/npm/@ibgib/helper-gib@0.0.4/dist/index.mjs",
        "@ibgib/helper-gib/": "https://cdn.jsdelivr.net/npm/@ibgib/helper-gib@0.0.4/",
        "@ibgib/ts-gib": "https://cdn.jsdelivr.net/npm/@ibgib/ts-gib@0.5.1/dist/index.mjs",
        "@ibgib/ts-gib/": "https://cdn.jsdelivr.net/npm/@ibgib/ts-gib@0.5.1/",
        "@ibgib/encrypt-gib": "https://cdn.jsdelivr.net/npm/@ibgib/encrypt-gib@0.1.6/dist/index.mjs",
        "@ibgib/encrypt-gib/": "https://cdn.jsdelivr.net/npm/@ibgib/encrypt-gib@0.1.6/"
      }
    }
  </script>

carcass related

find and replace patterns

remove constants scoping

import * as c from .+

scoped ts-gib for helper first

(import .+')ts-gib(.*helper)'; $1@ibgib/ts-gib$2.mjs';

scoped ts-gib for non-helper next

(import .+')ts-gib(.*)'; $1@ibgib/ts-gib$2';

non-mjs suffixed imports

(from '.+\w\/\w\w\w)' $1.mjs'

add index.mjs explicit to folder imports

(from '.+/V1)' $1/index.mjs'

convert cast to use as operator

(<)(\w+)(>)(\w.!\?+)(\W) ($4 as $2)$5

0.0.95

7 days ago

0.0.96

7 days ago

0.0.94

7 days ago

0.0.93

9 days ago

0.0.92

12 days ago

0.0.91

13 days ago

0.0.89

14 days ago

0.0.90

14 days ago

0.0.88

19 days ago

0.0.85

21 days ago

0.0.86

21 days ago

0.0.87

20 days ago

0.0.84

26 days ago

0.0.82

26 days ago

0.0.80

28 days ago

0.0.81

28 days ago

0.0.78

1 month ago

0.0.79

1 month ago

0.0.74

1 month ago

0.0.75

1 month ago

0.0.76

1 month ago

0.0.77

1 month ago

0.0.73

1 month ago

0.0.72

1 month ago

0.0.71

2 months ago

0.0.70

2 months ago

0.0.69

2 months ago

0.0.68

2 months ago

0.0.67

2 months ago

0.0.66

2 months ago

0.0.64

2 months ago

0.0.65

2 months ago

0.0.62

2 months ago

0.0.63

2 months ago

0.0.61

2 months ago

0.0.60

2 months ago

0.0.59

2 months ago

0.0.55

2 months ago

0.0.57

2 months ago

0.0.58

2 months ago

0.0.53

3 months ago

0.0.54

3 months ago

0.0.52

3 months ago

0.0.51

3 months ago

0.0.50

3 months ago

0.0.49

3 months ago

0.0.48

3 months ago

0.0.46

3 months ago

0.0.47

3 months ago

0.0.40

3 months ago

0.0.41

3 months ago

0.0.42

3 months ago

0.0.43

3 months ago

0.0.45

3 months ago

0.0.38

3 months ago

0.0.39

3 months ago

0.0.20

9 months ago

0.0.21

9 months ago

0.0.22

9 months ago

0.0.23

9 months ago

0.0.24

9 months ago

0.0.25

9 months ago

0.0.15

10 months ago

0.0.16

10 months ago

0.0.17

10 months ago

0.0.18

10 months ago

0.0.19

9 months ago

0.0.30

7 months ago

0.0.31

6 months ago

0.0.32

6 months ago

0.0.11

10 months ago

0.0.34

6 months ago

0.0.12

10 months ago

0.0.35

6 months ago

0.0.13

10 months ago

0.0.14

10 months ago

0.0.26

9 months ago

0.0.27

7 months ago

0.0.28

7 months ago

0.0.29

7 months ago

0.0.10

11 months ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago