@ibgib/core-gib 0.0.8 → 0.0.11

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.
Files changed (154) hide show
  1. package/README.md +5 -10
  2. package/dist/assumptions.respec.d.mts +2 -0
  3. package/dist/assumptions.respec.d.mts.map +1 -0
  4. package/dist/assumptions.respec.mjs +41 -0
  5. package/dist/assumptions.respec.mjs.map +1 -0
  6. package/dist/core-constants.d.mts +0 -2
  7. package/dist/core-constants.d.mts.map +1 -1
  8. package/dist/core-constants.mjs +0 -2
  9. package/dist/core-constants.mjs.map +1 -1
  10. package/dist/core-helper.respec.d.mts +2 -0
  11. package/dist/core-helper.respec.d.mts.map +1 -0
  12. package/dist/core-helper.respec.mjs +53 -0
  13. package/dist/core-helper.respec.mjs.map +1 -0
  14. package/dist/core-types.d.mts +22 -0
  15. package/dist/core-types.d.mts.map +1 -1
  16. package/dist/respec-gib.node.d.mts +2 -0
  17. package/dist/respec-gib.node.d.mts.map +1 -0
  18. package/dist/respec-gib.node.mjs +211 -0
  19. package/dist/respec-gib.node.mjs.map +1 -0
  20. package/dist/spec-helper.node.respec.d.mts +12 -0
  21. package/dist/spec-helper.node.respec.d.mts.map +1 -0
  22. package/dist/spec-helper.node.respec.mjs +43 -0
  23. package/dist/spec-helper.node.respec.mjs.map +1 -0
  24. package/dist/witness/app/app-base-v1.d.mts +2 -2
  25. package/dist/witness/app/app-base-v1.d.mts.map +1 -1
  26. package/dist/witness/app/app-base-v1.mjs +23 -141
  27. package/dist/witness/app/app-base-v1.mjs.map +1 -1
  28. package/dist/witness/app/app-constants.d.mts +2 -0
  29. package/dist/witness/app/app-constants.d.mts.map +1 -1
  30. package/dist/witness/app/app-constants.mjs +2 -0
  31. package/dist/witness/app/app-constants.mjs.map +1 -1
  32. package/dist/witness/app/app-helper.d.mts.map +1 -1
  33. package/dist/witness/app/app-helper.mjs +2 -1
  34. package/dist/witness/app/app-helper.mjs.map +1 -1
  35. package/dist/witness/app/app-types.d.mts +2 -1
  36. package/dist/witness/app/app-types.d.mts.map +1 -1
  37. package/dist/witness/robbot/robbot-base-v1.d.mts +12 -164
  38. package/dist/witness/robbot/robbot-base-v1.d.mts.map +1 -1
  39. package/dist/witness/robbot/robbot-base-v1.mjs +41 -657
  40. package/dist/witness/robbot/robbot-base-v1.mjs.map +1 -1
  41. package/dist/witness/robbot/robbot-helper.mjs +3 -3
  42. package/dist/witness/robbot/robbot-helper.mjs.map +1 -1
  43. package/dist/witness/robbot/robbot-helper.respec.d.mts +2 -0
  44. package/dist/witness/robbot/robbot-helper.respec.d.mts.map +1 -0
  45. package/dist/witness/robbot/robbot-helper.respec.mjs +106 -0
  46. package/dist/witness/robbot/robbot-helper.respec.mjs.map +1 -0
  47. package/dist/witness/robbot/robbot-types.d.mts +6 -3
  48. package/dist/witness/robbot/robbot-types.d.mts.map +1 -1
  49. package/dist/witness/robbot/robbot-types.mjs +1 -0
  50. package/dist/witness/robbot/robbot-types.mjs.map +1 -1
  51. package/dist/witness/space/filesystem-space/filesystem-space-v1.d.mts +1 -1
  52. package/dist/witness/space/filesystem-space/filesystem-space-v1.d.mts.map +1 -1
  53. package/dist/witness/space/filesystem-space/filesystem-space-v1.respec.d.mts +2 -0
  54. package/dist/witness/space/filesystem-space/filesystem-space-v1.respec.d.mts.map +1 -0
  55. package/dist/witness/space/filesystem-space/filesystem-space-v1.respec.mjs +107 -0
  56. package/dist/witness/space/filesystem-space/filesystem-space-v1.respec.mjs.map +1 -0
  57. package/dist/witness/space/filesystem-space/node-filesystem-space-v1.d.mts.map +1 -1
  58. package/dist/witness/space/filesystem-space/node-filesystem-space-v1.mjs +1 -1
  59. package/dist/witness/space/filesystem-space/node-filesystem-space-v1.mjs.map +1 -1
  60. package/dist/witness/space/filesystem-space/node-filesystem-space-v1.node.respec.d.mts +2 -0
  61. package/dist/witness/space/filesystem-space/node-filesystem-space-v1.node.respec.d.mts.map +1 -0
  62. package/dist/witness/space/filesystem-space/node-filesystem-space-v1.node.respec.mjs +129 -0
  63. package/dist/witness/space/filesystem-space/node-filesystem-space-v1.node.respec.mjs.map +1 -0
  64. package/dist/witness/space/inner-space/inner-space-v1.respec.d.mts +2 -0
  65. package/dist/witness/space/inner-space/inner-space-v1.respec.d.mts.map +1 -0
  66. package/dist/witness/space/inner-space/inner-space-v1.respec.mjs +56 -0
  67. package/dist/witness/space/inner-space/inner-space-v1.respec.mjs.map +1 -0
  68. package/dist/witness/space/metaspace/metaspace-base.d.mts +795 -0
  69. package/dist/witness/space/metaspace/metaspace-base.d.mts.map +1 -0
  70. package/dist/witness/space/metaspace/metaspace-base.mjs +3251 -0
  71. package/dist/witness/space/metaspace/metaspace-base.mjs.map +1 -0
  72. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.d.mts +4 -0
  73. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.d.mts.map +1 -0
  74. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mjs +117 -0
  75. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mjs.map +1 -0
  76. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.d.mts +34 -0
  77. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.d.mts.map +1 -0
  78. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mjs +76 -0
  79. package/dist/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mjs.map +1 -0
  80. package/dist/witness/space/metaspace/metaspace-types.d.mts +580 -0
  81. package/dist/witness/space/metaspace/metaspace-types.d.mts.map +1 -0
  82. package/dist/witness/space/metaspace/metaspace-types.mjs +6 -0
  83. package/dist/witness/space/metaspace/metaspace-types.mjs.map +1 -0
  84. package/dist/witness/space/space-helper.d.mts.map +1 -1
  85. package/dist/witness/space/space-helper.mjs +2 -1
  86. package/dist/witness/space/space-helper.mjs.map +1 -1
  87. package/dist/witness/space/{space-spec-helper.d.mts → space-respec-helper.d.mts} +15 -5
  88. package/dist/witness/space/space-respec-helper.d.mts.map +1 -0
  89. package/dist/witness/space/space-respec-helper.mjs +186 -0
  90. package/dist/witness/space/space-respec-helper.mjs.map +1 -0
  91. package/dist/witness/space/space-types.d.mts +2 -1
  92. package/dist/witness/space/space-types.d.mts.map +1 -1
  93. package/dist/witness/space/space-types.mjs.map +1 -1
  94. package/dist/witness/witness-base-v1.d.mts.map +1 -1
  95. package/dist/witness/witness-base-v1.mjs +7 -7
  96. package/dist/witness/witness-base-v1.mjs.map +1 -1
  97. package/dist/witness/witness-cmd/witness-cmd-types.d.mts +31 -0
  98. package/dist/witness/witness-cmd/witness-cmd-types.d.mts.map +1 -0
  99. package/dist/witness/witness-cmd/witness-cmd-types.mjs +2 -0
  100. package/dist/witness/witness-cmd/witness-cmd-types.mjs.map +1 -0
  101. package/dist/witness/witness-helper.d.mts +8 -0
  102. package/dist/witness/witness-helper.d.mts.map +1 -1
  103. package/dist/witness/witness-helper.mjs +30 -0
  104. package/dist/witness/witness-helper.mjs.map +1 -1
  105. package/dist/witness/witness-types.d.mts +26 -36
  106. package/dist/witness/witness-types.d.mts.map +1 -1
  107. package/dist/witness/witness-with-context/witness-with-context-base-v1.d.mts +235 -0
  108. package/dist/witness/witness-with-context/witness-with-context-base-v1.d.mts.map +1 -0
  109. package/dist/witness/witness-with-context/witness-with-context-base-v1.mjs +742 -0
  110. package/dist/witness/witness-with-context/witness-with-context-base-v1.mjs.map +1 -0
  111. package/dist/witness/witness-with-context/witness-with-context-types.d.mts +17 -0
  112. package/dist/witness/witness-with-context/witness-with-context-types.d.mts.map +1 -0
  113. package/dist/witness/witness-with-context/witness-with-context-types.mjs +2 -0
  114. package/dist/witness/witness-with-context/witness-with-context-types.mjs.map +1 -0
  115. package/package.json +12 -15
  116. package/src/{assumptions.spec.mts → assumptions.respec.mts} +11 -5
  117. package/src/core-constants.mts +0 -2
  118. package/src/core-helper.respec.mts +71 -0
  119. package/src/core-types.mts +20 -0
  120. package/src/respec-gib.node.mts +199 -0
  121. package/src/witness/app/app-base-v1.mts +19 -212
  122. package/src/witness/app/app-constants.mts +3 -0
  123. package/src/witness/app/app-helper.mts +2 -1
  124. package/src/witness/app/app-types.mts +1 -1
  125. package/src/witness/robbot/robbot-base-v1.mts +39 -690
  126. package/src/witness/robbot/robbot-helper.mts +1 -1
  127. package/src/witness/robbot/{robbot-helper.spec.mts → robbot-helper.respec.mts} +39 -33
  128. package/src/witness/robbot/robbot-types.mts +5 -3
  129. package/src/witness/space/filesystem-space/filesystem-space-v1.mts +1 -1
  130. package/src/witness/space/filesystem-space/{filesystem-space-v1.spec.mts → filesystem-space-v1.respec.mts} +17 -8
  131. package/src/witness/space/filesystem-space/node-filesystem-space-v1.mts +3 -11
  132. package/src/witness/space/filesystem-space/{node-filesystem-space-v1.node.spec.mts → node-filesystem-space-v1.node.respec.mts} +18 -14
  133. package/src/witness/space/inner-space/{inner-space-v1.spec.mts → inner-space-v1.respec.mts} +17 -8
  134. package/src/witness/space/metaspace/metaspace-base.mts +3702 -0
  135. package/src/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace-helper.mts +116 -0
  136. package/src/witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mts +88 -0
  137. package/src/witness/space/metaspace/metaspace-types.mts +614 -0
  138. package/src/witness/space/space-helper.mts +2 -1
  139. package/src/witness/space/{space-spec-helper.mts → space-respec-helper.mts} +76 -57
  140. package/src/witness/space/space-types.mts +2 -1
  141. package/src/witness/witness-base-v1.mts +8 -6
  142. package/src/witness/witness-cmd/witness-cmd-types.mts +38 -0
  143. package/src/witness/witness-helper.mts +31 -0
  144. package/src/witness/witness-types.mts +31 -41
  145. package/src/witness/witness-with-context/witness-with-context-base-v1.mts +809 -0
  146. package/src/witness/witness-with-context/witness-with-context-types.mts +24 -0
  147. package/tsconfig.json +1 -0
  148. package/dist/witness/space/space-spec-helper.d.mts.map +0 -1
  149. package/dist/witness/space/space-spec-helper.mjs +0 -179
  150. package/dist/witness/space/space-spec-helper.mjs.map +0 -1
  151. package/jasmine-browser.json +0 -18
  152. package/jasmine.json +0 -6
  153. package/src/core-helper.spec.mts +0 -64
  154. /package/src/{spec-helper.node.spec.mts → spec-helper.node.respec.mts} +0 -0
@@ -0,0 +1,742 @@
1
+ import { filter } from 'rxjs/operators';
2
+ import { delay, getSaferSubstring, pretty } from '@ibgib/helper-gib';
3
+ import { V1, getIbGibAddr } from '@ibgib/ts-gib';
4
+ import { getGibInfo } from '@ibgib/ts-gib/dist/V1/index.mjs';
5
+ import { validateIbGibIntrinsically } from '@ibgib/ts-gib/dist/V1/validate-helper.mjs';
6
+ import { GLOBAL_LOG_A_LOT } from '../../core-constants.mjs';
7
+ import { WitnessBase_V1, } from '../witness-base-v1.mjs';
8
+ import { createCommentIbGib } from '../../common/comment/comment-helper.mjs';
9
+ import { getLatestAddrs } from '../space/space-helper.mjs';
10
+ import { getTjpAddr } from '../../common/other/ibgib-helper.mjs';
11
+ const logalot = GLOBAL_LOG_A_LOT || true;
12
+ /**
13
+ * ## distinguishing characteristics of robbots
14
+ *
15
+ * With any witness ibgib, we are concerned with interpreting an incoming
16
+ * arg ibgib and producing at least one result ibgib. Most often, there will
17
+ * be additional ibgibs created, either creating "new" ibgibs via `fork`
18
+ * transforms, or changing existing ibgibs through `mut8` and `rel8`
19
+ * transforms. And almost always these will be persisted in at least
20
+ * one space.
21
+ *
22
+ * But Robbots in particular are meant to be increasingly adaptable over time.
23
+ *
24
+ * This results in a couple of notes:
25
+ *
26
+ * 1. They should be able to handle any incoming ibgib, including primitives.
27
+ * 2. If they are learning robbots, then they will mutate internally at some rate.
28
+ * 3. Often robbots' output ibgib(s) will be intended for others'
29
+ * consumption, in service of others - be they humans or other
30
+ * biologically living organisms, other robbots or even later versions of
31
+ * themselves.
32
+ *
33
+ * So for example, one of the simplest robbots is one which simply echos the
34
+ * incoming ibgib arg.
35
+
36
+ * ## architecture
37
+ *
38
+ * At the base, any robbot should be able to handle any incoming ibgib. This is
39
+ * in contrast to, e.g., a Space, which is more rigid in design.
40
+ *
41
+ * Certainly there are robbot's who will be more rigid, but this will be an
42
+ * abstract class on top of this one, and all robbots should be able to react to
43
+ * all incoming ibgibs.
44
+ *
45
+ * Output will default to a simple ok^gib or (ROOT) ib^gib primitive...perhaps
46
+ * we'll go with ack^gib, but whatever it is, it's just an acknowledgement of
47
+ * input received. (I'll put it in the constants file).
48
+ *
49
+ * Side effects should occur in a parallel execution thread, which ideally would
50
+ * work in a completely parallel execution context (like a service worker). But
51
+ * then we have to deal with race conditions and the real solution there is to
52
+ * abstract to the robbot having its own space and the synchronization happening
53
+ * exactly like any other sync space.
54
+ *
55
+ * For now, we'll spin off a promise with some intermittent `await delay`
56
+ * calls if they end up called for, effectively the equivalent of the
57
+ * old-fashioned "ProcessMessages/DoEvents" hack.
58
+ */
59
+ export class WitnessWithContextBase_V1 extends WitnessBase_V1 {
60
+ constructor(initialData, initialRel8ns) {
61
+ super(initialData, initialRel8ns);
62
+ /**
63
+ * Log context for convenience with logging. (Ignore if you don't want to use this.)
64
+ *
65
+ * Often used in conjunction with `logalot`.
66
+ */
67
+ this.lc = `[${WitnessWithContextBase_V1.name}]`;
68
+ /**
69
+ * when we get an update to the context, we want to know what the _new_
70
+ * children are in order to interpret comments from the user that may be
71
+ * directed at us.
72
+ *
73
+ * So we will get an initial snapshot of children that we will diff against.
74
+ * We could go via the dna, but ultimately a diff is what is needed.
75
+ */
76
+ this._currentWorkingContextIbGib_PriorChildrenAddrs = [];
77
+ this._updatingContext = false;
78
+ this.initialized = this.initialize();
79
+ }
80
+ async initialize() {
81
+ const lc = `${this.lc}[${this.initialize.name}]`;
82
+ try {
83
+ if (logalot) {
84
+ console.log(`${lc} starting... (I: f0e65ab0f80046a59668ddfbf9f47a4a5)`);
85
+ }
86
+ await super.initialize();
87
+ // await this.initialize_semanticHandlers();
88
+ // await this.initialize_lex();
89
+ }
90
+ catch (error) {
91
+ console.error(`${lc} ${error.message}`);
92
+ }
93
+ finally {
94
+ if (logalot) {
95
+ console.log(`${lc} complete.`);
96
+ }
97
+ }
98
+ }
99
+ async loadNewerSelfIfAvailable() {
100
+ const lc = `${this.lc}[${this.loadNewerSelfIfAvailable.name}]`;
101
+ try {
102
+ if (logalot) {
103
+ console.log(`${lc} starting... (I: 94755c3131f4dfa12d20fa38e2926522)`);
104
+ }
105
+ if (this.ibgibsSvc) {
106
+ // check for newer version of self locally before executing
107
+ const thisAddr = getIbGibAddr({ ibGib: this });
108
+ const latestAddr = await this.ibgibsSvc.getLatestAddr({ ibGib: this });
109
+ if (latestAddr && latestAddr !== thisAddr) {
110
+ // this has a newer ibgib in its timeline
111
+ let resGet = await this.ibgibsSvc.get({ addr: latestAddr });
112
+ if (!resGet || !resGet?.success || (resGet?.ibGibs ?? []).length === 0) {
113
+ throw new Error(`could not get newer ibgib in timeline (E: 15fa346c8ac17edb96e4b0870104c122)`);
114
+ }
115
+ await this.loadIbGibDto(resGet.ibGibs[0]);
116
+ const validationErrors = await this.validateThis();
117
+ if (validationErrors?.length > 0) {
118
+ throw new Error(`validationErrors when loading newer version: ${pretty(validationErrors)} (E: 0d9f0684a1ff6af44e20a57130e3ac22)`);
119
+ }
120
+ }
121
+ }
122
+ else {
123
+ console.warn(`${lc} this.ibgibsSvc undefined (W: 44cc5bf1b14b4695b8de4c589787be06)`);
124
+ }
125
+ }
126
+ catch (error) {
127
+ console.error(`${lc} ${error.message}`);
128
+ throw error;
129
+ }
130
+ finally {
131
+ if (logalot) {
132
+ console.log(`${lc} complete.`);
133
+ }
134
+ }
135
+ }
136
+ /**
137
+ * By default, this...
138
+ *
139
+ * * performs the raw {@link rel8} transform to the given `ibGib`.
140
+ * * persists the new ibgib's transform result in the given space.
141
+ * * registers the newer version of this robbot ibgib with the ibgibs svc.
142
+ *
143
+ * @see {@link ibGibs}
144
+ * @see {@link rel8nName}
145
+ * @see {@link ibgibsSvc}
146
+ * @see {@link space}
147
+ *
148
+ * ## notes
149
+ *
150
+ * * If there is no given `space`, then we will use the `ibgibsSvc` to get
151
+ * the local user space. If none, then we skip persistence.
152
+ * * If there is no `ibgibsSvc`, we won't register the new ibgibs locally.
153
+ */
154
+ async rel8To({ ibGibs, rel8nName, linked, ibgibsSvc,
155
+ // space,
156
+ }) {
157
+ const lc = `${this.lc}[${this.rel8To.name}]`;
158
+ try {
159
+ if (logalot) {
160
+ console.log(`${lc} starting...`);
161
+ }
162
+ // #region initialize, validate args and this
163
+ if ((ibGibs ?? []).length === 0) {
164
+ throw new Error(`ibGibs required (E: 2fd13de0f025b170885bede4d7a50922)`);
165
+ }
166
+ rel8nName = rel8nName || this.data?.defaultRel8nName;
167
+ if (!rel8nName) {
168
+ throw new Error(`rel8nName required either as an arg or in this.data.defaultRel8nName (E: 43ab8ae63694a2a82cd8a70ed6b6b522)`);
169
+ }
170
+ const thisValidationErrors = await this.validateThis();
171
+ if (thisValidationErrors?.length > 0) {
172
+ throw new Error(`this is an invalid ibGib. thisValidationErrors: ${thisValidationErrors.join('|')} (E: 8f08716866cd13bf254222ee9e6a6722)`);
173
+ }
174
+ ibgibsSvc = ibgibsSvc ?? this.ibgibsSvc;
175
+ if (!ibgibsSvc) {
176
+ // if (this.ibgibsSvc) {
177
+ // if (logalot) { console.log(`${lc} ibgibsSvc arg falsy, but we have a reference on this object, which we will use. (I: ee0d39a47ee8aee8ffd797721fea4322)`); }
178
+ // ibgibsSvc = this.ibgibsSvc;
179
+ // }
180
+ throw new Error(`either ibgibsSvc or this.ibgibsSvc required (E: b5f9453ddb394a2b76dec74c7304df22)`);
181
+ }
182
+ // if (!space) {
183
+ // if (ibgibsSvc) {
184
+ // if (logalot) { console.log(`${lc} space arg falsy, but ibgibsSvc truthy, so we'll use ibgibsSvc's local user space for persistence. (I: 37a4b4c1406556cb23831671755b0d22)`); }
185
+ // space = await ibgibsSvc.getLocalUserSpace({ lock: true });
186
+ // }
187
+ // }
188
+ // if (!space) { throw new Error(`(UNEXPECTED) space required and ibgibsSvc couldn't get it? (E: a3b9f9b72f6f6f18883199a19d38c622)`); }
189
+ // #endregion initialize, validate args and this
190
+ // we want to rel8 only to the ibGibs whose timelines we're not
191
+ // already related to. So we look to see if we already have the tjpGib
192
+ // per our rel8nName.
193
+ // if (!this.rel8ns) { this.rel8ns = {} as any };
194
+ const alreadyRel8dAddrs = this.rel8ns ? this.rel8ns[rel8nName] ?? [] : [];
195
+ const alreadyRel8dTjpGibs = alreadyRel8dAddrs.map(x => getGibInfo({ ibGibAddr: x }).tjpGib);
196
+ const ibGibsNotYetRel8dByTjp = ibGibs.filter(x => {
197
+ const tjpGib = getGibInfo({ ibGibAddr: getIbGibAddr({ ibGib: x }) }).tjpGib;
198
+ return !alreadyRel8dTjpGibs.includes(tjpGib);
199
+ });
200
+ if (ibGibsNotYetRel8dByTjp.length === 0) {
201
+ if (logalot) {
202
+ console.log(`${lc} already rel8d to all incoming ibGib(s) via tjp. (I: 5e9d94a98ba262f146c0c0b765157922)`);
203
+ }
204
+ return; /* <<<< returns early */
205
+ }
206
+ // perform the raw ibgib rel8 transform
207
+ const addrs = ibGibsNotYetRel8dByTjp.map(x => getIbGibAddr({ ibGib: x }));
208
+ const resNewThis = await V1.rel8({
209
+ src: this.toIbGibDto(),
210
+ rel8nsToAddByAddr: { [rel8nName]: addrs },
211
+ linkedRel8ns: linked ? ["past", "ancestor", rel8nName] : ["past", "ancestor"],
212
+ dna: true,
213
+ nCounter: true,
214
+ });
215
+ const newThisIbGib = resNewThis.newIbGib;
216
+ const newThisValidationErrors = await validateIbGibIntrinsically({ ibGib: newThisIbGib });
217
+ if (newThisValidationErrors?.length ?? 0 > 0) {
218
+ throw new Error(`new this ibgib would have validation errors. aborting. newThisValidationErrors: ${newThisValidationErrors.join('|')} (E: eb816a27156c246c121ef55e37d59322)`);
219
+ }
220
+ // if space is given, perform the persistence
221
+ // if (space) {
222
+ await ibgibsSvc.persistTransformResult({ resTransform: resNewThis });
223
+ // } else {
224
+ // if (logalot) { console.log(`${lc} space falsy, skipping persistence (I: 90aa3553e92ad1d02bce61f83648ea22)`); }
225
+ // }
226
+ // (in the future, need to revisit the ibgibs service to the idea of locality/ies).
227
+ await ibgibsSvc.registerNewIbGib({ ibGib: newThisIbGib });
228
+ // update this witness' primary ibGib properties (ib, gib, data, rel8ns).
229
+ // override `loadIbGibDto` to update secondary/derivative properties
230
+ await this.loadIbGibDto(newThisIbGib);
231
+ }
232
+ catch (error) {
233
+ console.error(`${lc} ${error.message}`);
234
+ throw error;
235
+ }
236
+ finally {
237
+ if (logalot) {
238
+ console.log(`${lc} complete.`);
239
+ }
240
+ }
241
+ }
242
+ async rel8ToContextIbGib({ ibGibToRel8, ibGibAddrToRel8, contextIbGib, rel8nNames,
243
+ // space,
244
+ }) {
245
+ const lc = `${this.lc}[${this.rel8ToContextIbGib.name}]`;
246
+ try {
247
+ if (!ibGibToRel8 && !ibGibAddrToRel8) {
248
+ throw new Error(`ibGibToRel8 or ibGibAddrToRel8 required (E: 3ee14659fd22355a5ba0e537a477be22)`);
249
+ }
250
+ if (!contextIbGib) {
251
+ throw new Error(`contextIbGib required (E: 85f27c7cbf713704c21084c141cd8822)`);
252
+ }
253
+ if (!this.ibgibsSvc) {
254
+ throw new Error(`this.ibgibsSvc required (E: 6a38c4274bdefc8d44cafd2d6faaa222)`);
255
+ }
256
+ // space = space ?? await this.ibgibsSvc.getLocalUserSpace({ lock: true });
257
+ // if (!space) { throw new Error(`space required (E: 267ad87c148942cda641349df0bbbd22)`); }
258
+ if ((rel8nNames ?? []).length === 0) {
259
+ if (!this.data?.defaultRel8nName) {
260
+ throw new Error(`either rel8nNames or this.data.defaultRel8nName required (E: a14ab4b3e479d9274c61bc5a30bc2222)`);
261
+ }
262
+ rel8nNames = [this.data.defaultRel8nName];
263
+ }
264
+ // set up the rel8ns to add
265
+ const rel8nsToAddByAddr = {};
266
+ ibGibAddrToRel8 = ibGibAddrToRel8 || getIbGibAddr({ ibGib: ibGibToRel8 });
267
+ rel8nNames.forEach((rel8nName) => { rel8nsToAddByAddr[rel8nName] = [ibGibAddrToRel8]; });
268
+ // perform the rel8 transform and...
269
+ const resRel8ToContext = await V1.rel8({
270
+ src: contextIbGib,
271
+ rel8nsToAddByAddr,
272
+ dna: true,
273
+ nCounter: true
274
+ });
275
+ // ...persist it...
276
+ await this.ibgibsSvc.persistTransformResult({ resTransform: resRel8ToContext });
277
+ // ...register the context.
278
+ const { newIbGib: newContext } = resRel8ToContext;
279
+ await this.ibgibsSvc.registerNewIbGib({ ibGib: newContext });
280
+ }
281
+ catch (error) {
282
+ console.error(`${lc} ${error.message}`);
283
+ throw error;
284
+ }
285
+ }
286
+ async createCommentAndRel8ToContextIbGib({ text, contextIbGib, rel8nName, }) {
287
+ const lc = `${this.lc}[${this.createCommentAndRel8ToContextIbGib.name}]`;
288
+ try {
289
+ if (logalot) {
290
+ console.log(`${lc} starting... (I: c3a005f7d323468a5b4e1b2710901d22)`);
291
+ }
292
+ if (!this.ibgibsSvc) {
293
+ throw new Error(`this.ibgibsSvc required (E: 5dbb1a7f0ff5469b8ce3cb1be175e521)`);
294
+ }
295
+ // space = space ?? await this.ibgibsSvc.getLocalUserSpace({ lock: true });
296
+ // if (!space) { throw new Error(`(UNEXPECTED) space required and wasn't able to get it from ibgibsSvc? (E: 7159f9893a66c28a7e09b61384545622)`); }
297
+ let space = await this.ibgibsSvc.getLocalUserSpace({ lock: true });
298
+ /** tag this comment with metadata to show it came from this robbot */
299
+ let resComment = await createCommentIbGib({ text, addlMetadataText: this.getAddlMetadata(), saveInSpace: true, space });
300
+ // get again to be sure it's the latest space.
301
+ space = await this.ibgibsSvc.getLocalUserSpace({ lock: true });
302
+ const commentIbGib = resComment.newIbGib;
303
+ if (!commentIbGib) {
304
+ throw new Error(`(UNEXPECTED) failed to create comment? (E: 6d668f4e55198e654324622eabaac922)`);
305
+ }
306
+ await this.ibgibsSvc.registerNewIbGib({ ibGib: commentIbGib });
307
+ await this.rel8ToContextIbGib({ ibGibToRel8: commentIbGib, contextIbGib, rel8nNames: ['comment'] });
308
+ await this.rel8To({
309
+ ibGibs: [commentIbGib],
310
+ rel8nName,
311
+ });
312
+ }
313
+ catch (error) {
314
+ console.error(`${lc} ${error.message}`);
315
+ throw error;
316
+ }
317
+ finally {
318
+ if (logalot) {
319
+ console.log(`${lc} complete.`);
320
+ }
321
+ }
322
+ }
323
+ /**
324
+ * I'm abstracting getAddlMetadata and the first part is atow "robbot",
325
+ * e.g., * `robbot_classname_id_etc`. So "ThisAtom" is "robbot" for a
326
+ * robbot.
327
+ *
328
+ * override this in descending classes per use case.
329
+ *
330
+ * by default, this returns a safe substring of this.data.classname or "this".
331
+ */
332
+ getThisAtom() {
333
+ return getSaferSubstring({ text: this.data?.classname ?? 'this', length: 16 });
334
+ }
335
+ /**
336
+ * used to help identify when comments are made by descending witnesses.
337
+ *
338
+ * override this with your particular use case's addl metadata.
339
+ *
340
+ * @example atow robbot is: `robbot_${this.data.classname}_${this.data.name}_${this.data.uuid.slice(0, 8)}`;
341
+ *
342
+ * @returns addlmetadata string to be used in comment ib's
343
+ */
344
+ getAddlMetadata() {
345
+ const lc = `${this.lc}[${this.getAddlMetadata.name}]`;
346
+ try {
347
+ if (logalot) {
348
+ console.log(`${lc} starting... (I: 7800732facf3783943fdf1b2423b0c22)`);
349
+ }
350
+ if (!this.data) {
351
+ throw new Error(`(UNEXPECTED) this.data falsy? (E: 7cb044b39b2b8e31f363f3b82f256323)`);
352
+ }
353
+ const atom = this.getThisAtom();
354
+ if (!atom) {
355
+ throw new Error(`(UNEXPECTED) atom couldn't be gotten? (E: b260de391356e04abd334e0cd8b09123)`);
356
+ }
357
+ if (atom.includes(' ')) {
358
+ throw new Error(`(UNEXPECTED) atom contains space? (E: 574d088eea13d3afe5fcd2999ab6b423)`);
359
+ }
360
+ const classnameIsh = this.data.classname?.replace(/[_]/mg, '') || undefined;
361
+ const nameIsh = this.data.name?.slice(0, 8).replace(/[__]/mg, '') || undefined;
362
+ const idIsh = this.data.uuid?.slice(0, 8) || undefined;
363
+ const addlMetadataText = `${atom}_${classnameIsh}_${nameIsh}_${idIsh}`;
364
+ if (logalot) {
365
+ console.log(`${lc} addlMetadataText: ${addlMetadataText} (I: 53c0044671dc99fb75635367d2e63c22)`);
366
+ }
367
+ return addlMetadataText;
368
+ }
369
+ catch (error) {
370
+ console.error(`${lc} ${error.message}`);
371
+ throw error;
372
+ }
373
+ finally {
374
+ if (logalot) {
375
+ console.log(`${lc} complete.`);
376
+ }
377
+ }
378
+ }
379
+ /**
380
+ * I originally created this just to extract the context from the arg, but
381
+ * I'm reusing it to get the latest context from the addr alone.
382
+ */
383
+ async getContextIbGibFromArgOrAddr({ arg, addr, latest, }) {
384
+ const lc = `${this.lc}[${this.getContextIbGibFromArgOrAddr.name}]`;
385
+ try {
386
+ if (logalot) {
387
+ console.log(`${lc} starting... (I: c13f7cb92133984048f606075efb8a22)`);
388
+ }
389
+ let contextIbGib;
390
+ if (!arg && !addr) {
391
+ throw new Error(`either arg or addr required. (E: 3f647b65742242fd9ba878521acf7c22)`);
392
+ }
393
+ if (!this.ibgibsSvc) {
394
+ throw new Error(`(UNEXPECTED) this.ibgibsSvc required (E: f0046290b0d66d28c4bbbf83d9d9f523)`);
395
+ }
396
+ if (arg) {
397
+ if ((arg.ibGibs ?? []).length === 0) {
398
+ throw new Error(`(UNEXPECTED) invalid arg? no context ibgib on arg (E: 89997eb4bdeb3885bee9de5d33ee0f22)`);
399
+ }
400
+ if ((arg.ibGibs ?? []).length !== 1) {
401
+ throw new Error(`(UNEXPECTED) invalid arg? only expected one ibgib on arg.ibGibs (E: 1a1498af668740fe9439f4953a74ea8a)`);
402
+ }
403
+ contextIbGib = arg.ibGibs[0];
404
+ }
405
+ else {
406
+ // addr provided
407
+ const resGet = await this.ibgibsSvc.get({ addr });
408
+ if (!resGet.success || resGet.ibGibs?.length !== 1) {
409
+ throw new Error(`could not get context addr (${addr}) (E: 834492313512a45b23a7bebacdc48122)`);
410
+ }
411
+ contextIbGib = resGet.ibGibs[0];
412
+ }
413
+ if (latest) {
414
+ const resLatestAddr = await this.ibgibsSvc.getLatestAddr({ ibGib: contextIbGib });
415
+ if (resLatestAddr !== getIbGibAddr({ ibGib: contextIbGib })) {
416
+ const resGet = await this.ibgibsSvc.get({ addr: resLatestAddr });
417
+ if (resGet.success && resGet.ibGibs?.length === 1) {
418
+ contextIbGib = resGet.ibGibs[0];
419
+ }
420
+ else {
421
+ throw new Error(`unable to get resLatestAddr (${resLatestAddr}) (E: ce1e1297743e9a16c8f082321e52a122)`);
422
+ }
423
+ }
424
+ }
425
+ return contextIbGib;
426
+ }
427
+ catch (error) {
428
+ console.error(`${lc} ${error.message}`);
429
+ throw error;
430
+ }
431
+ finally {
432
+ if (logalot) {
433
+ console.log(`${lc} complete.`);
434
+ }
435
+ }
436
+ }
437
+ /**
438
+ * The context is the ibgib where we are interacting with the user(s) (only
439
+ * singlular atow).
440
+ *
441
+ * When we initialize, we are setting state on this robbot as well as subscribing
442
+ * to the context ibgib's updates in `this.ibgibsSvc`.
443
+ *
444
+ * if we already have a context, then this will check the new incoming
445
+ * context against it. If it's the same timeline, then this won't do
446
+ * anything. Otherwise, it will finalize the previous context.
447
+ */
448
+ async initializeContext({ arg, rel8nName, }) {
449
+ const lc = `${this.lc}[${this.initializeContext.name}]`;
450
+ try {
451
+ if (logalot) {
452
+ console.log(`${lc} starting... (I: d93429c85b0a494388f66fba3eece922)`);
453
+ }
454
+ // get context from arg just to compare the tjp's so we don't need
455
+ // the latest at this point
456
+ const incomingContext_NotLatest = await this.getContextIbGibFromArgOrAddr({ arg, latest: false });
457
+ if (this._currentWorkingContextIbGib) {
458
+ let currentTjpAddr = getTjpAddr({ ibGib: this._currentWorkingContextIbGib });
459
+ const incomingTjpAddr = getTjpAddr({ ibGib: incomingContext_NotLatest });
460
+ if (currentTjpAddr === incomingTjpAddr) {
461
+ console.warn(`${lc} initializing context but it's the same timeline (${currentTjpAddr}). (W: 7609f8f51172443183e0c93ad52bfe56)`);
462
+ return;
463
+ }
464
+ else {
465
+ await this.finalizeContext({ arg });
466
+ }
467
+ }
468
+ /** used both now and when context ibgib is updated via observable */
469
+ const updatePriorChildren = () => {
470
+ this._currentWorkingContextIbGib_PriorChildrenAddrs = [
471
+ ...this._currentWorkingContextIbGib?.rel8ns?.comment ?? [],
472
+ ...this._currentWorkingContextIbGib?.rel8ns?.pic ?? [],
473
+ ...this._currentWorkingContextIbGib?.rel8ns?.link ?? [],
474
+ ];
475
+ };
476
+ // set the props
477
+ this._currentWorkingContextIbGib = await this.getContextIbGibFromArgOrAddr({ arg, latest: true });
478
+ updatePriorChildren();
479
+ // subscribe to context ibgib updates
480
+ const contextTjpAddr = getTjpAddr({ ibGib: this._currentWorkingContextIbGib });
481
+ if (!this.ibgibsSvc) {
482
+ throw new Error(`this.ibgibsSvc falsy...not initialized? (E: 6e38bfdc5c2eb5fef884f0183889e823)`);
483
+ }
484
+ this._contextChangesSubscription =
485
+ this.ibgibsSvc.latestObs.pipe(filter(x => x.tjpAddr === contextTjpAddr)).subscribe(async (update) => {
486
+ const currentAddr = getIbGibAddr({ ibGib: this._currentWorkingContextIbGib });
487
+ if (update.latestAddr !== currentAddr) {
488
+ if (logalot) {
489
+ console.warn(`${lc} checking if new context is actually new...damn getLatestAddr maybe not working in ionic space... argh (W: 3d1a12154dfafb9c96d07e6f75f7a322)`);
490
+ }
491
+ if (update.latestIbGib) {
492
+ let latestN_Supposedly = update.latestIbGib.data?.n ?? -1;
493
+ let currentN = this._currentWorkingContextIbGib?.data?.n ?? -2;
494
+ if (latestN_Supposedly <= currentN) {
495
+ console.warn(`${lc} latestN is not really the latest. latestN_Supposedly: ${latestN_Supposedly}, currentN: ${currentN} (W: 6792c9a596c44c03b262614ae79a715e)`);
496
+ return; /* <<<< returns early */
497
+ }
498
+ }
499
+ if (logalot) {
500
+ console.log(`${lc} update to context.\ncurrentAddr: ${currentAddr}\nlatestAddr: ${update.latestAddr} (I: d0adcc392e6e974c9917730ebad51322)`);
501
+ }
502
+ this._currentWorkingContextIbGib =
503
+ update.latestIbGib ??
504
+ await this.getContextIbGibFromArgOrAddr({ addr: update.latestAddr, latest: false }); // already latest
505
+ if (!this._updatingContext) {
506
+ await this.handleContextUpdate({ update });
507
+ updatePriorChildren();
508
+ }
509
+ else {
510
+ if (logalot) {
511
+ console.log(`${lc} already updating context (I: f856f9414627ab00418dccd285b55822)`);
512
+ }
513
+ }
514
+ }
515
+ });
516
+ // rel8 to the context (conversation)
517
+ if (rel8nName) {
518
+ await this.rel8To({
519
+ ibGibs: [this._currentWorkingContextIbGib],
520
+ rel8nName,
521
+ // rel8nName: ROBBOT_CONTEXT_REL8N_NAME,
522
+ });
523
+ }
524
+ // subscribe to receive updates to the context so we can participate
525
+ // in the conversation (i.e. interpret incoming ibgibs like commands
526
+ // if needed)
527
+ // let gibInfo = getGibInfo({ gib: this._currentWorkingContextIbGib.gib });
528
+ // if (gibInfo.tjpGib) {
529
+ // this.ibgibsSvc.latestObs
530
+ // .subscribe(update => {
531
+ // if (!update.tjpAddr) { return; /* <<<< returns early */ }
532
+ // if (getIbAndGib({ ibGibAddr: update.tjpAddr }).gib !== gibInfo.tjpGib) { return; /* <<<< returns early */ }
533
+ // if (update.latestAddr === getIbGibAddr({ ibGib: this._currentWorkingContextIbGib })) {
534
+ // if (logalot) { console.log(`${lc} already have that context... (I: a6e17ec40d620f0bd5b231db39eaa522)`); }
535
+ // return; /* <<<< returns early */
536
+ // }
537
+ // if (this._updatingContext) {
538
+ // if (logalot) { console.log(`${lc} already updating context (I: f856f9414627ab00418dccd285b55822)`); }
539
+ // return; /* <<<< returns early */
540
+ // }
541
+ // this.handleContextUpdate({ update });
542
+ // });
543
+ // }
544
+ }
545
+ catch (error) {
546
+ console.error(`${lc} ${error.message}`);
547
+ throw error;
548
+ }
549
+ finally {
550
+ if (logalot) {
551
+ console.log(`${lc} complete.`);
552
+ }
553
+ }
554
+ }
555
+ async finalizeContext({ arg, }) {
556
+ const lc = `${this.lc}[${this.finalizeContext.name}]`;
557
+ try {
558
+ if (logalot) {
559
+ console.log(`${lc} starting... (I: dd53dfc745864dd19fde5f209ceb82c8)`);
560
+ }
561
+ let tries = 0;
562
+ const maxTries = 100;
563
+ while (this._updatingContext && tries < maxTries) {
564
+ await delay(100);
565
+ tries++;
566
+ if (tries % 10 === 0) {
567
+ console.log(`${lc} already updating context and taking a litle while... waiting still. tries: ${tries}/${maxTries} (I: d45ab59af9ea43518432e34ddad95c19)`);
568
+ }
569
+ }
570
+ if (this._updatingContext) {
571
+ console.error(`${lc} previous call to updatingContext took too long. Ignoring flag and finalizing context. (E: 9a2dc4e1923442fa90fbeae72f358acd)`);
572
+ }
573
+ this._updatingContext = true;
574
+ if (this._contextChangesSubscription) {
575
+ debugger;
576
+ this._contextChangesSubscription.unsubscribe();
577
+ delete this._contextChangesSubscription;
578
+ }
579
+ delete this._currentWorkingContextIbGib;
580
+ throw new Error(`not refactored yet. the proceeding code needs to be introduced in the robbot descending class. (E: 066aa414693672d868dbf953617aab23)`);
581
+ // if (this._currentWorkingContextIbGib) {
582
+ // await this.createCommentAndRel8ToContextIbGib({
583
+ // text: await this.getOutputText({ text: 'end of line' }),
584
+ // contextIbGib: this._currentWorkingContextIbGib,
585
+ // });
586
+ // delete this._currentWorkingContextIbGib;
587
+ // }
588
+ }
589
+ catch (error) {
590
+ console.error(`${lc} ${error.message}`);
591
+ throw error;
592
+ }
593
+ finally {
594
+ this._updatingContext = false;
595
+ if (logalot) {
596
+ console.log(`${lc} complete.`);
597
+ }
598
+ }
599
+ }
600
+ /**
601
+ * Handles a new ibgib in the current working context.
602
+ *
603
+ * If it originated from the robbot him/herself, then we will ignore it.
604
+ * Otherwise this is interpreted either as a "command" or something to remember.
605
+ *
606
+ * ## notes
607
+ *
608
+ * If the user says something and we're listening (this is triggered), then
609
+ * it should be either interpreted as a "command" or ignored. I put
610
+ * "command" in quotes because the word is a very short-sighted
611
+ * understanding of the conversational aspect. Or perhaps I speak to the
612
+ * connotations to current belief's regarding robbots and commands.
613
+ *
614
+ * This is complicated by the possibility in the future of multiple robbots
615
+ * being engaged in a conversation within the same context.
616
+ */
617
+ async handleContextUpdate({ update }) {
618
+ const lc = `${this.lc}[${this.handleContextUpdate.name}]`;
619
+ // I don't see this as really being very likely in the near future,
620
+ // but putting in a wait delay in case there are multiple updates
621
+ while (this._updatingContext) {
622
+ console.warn(`${lc} already updating context? delaying... (W: 19d2ebeaaf2340fb91a7d6c717e9cb41)`);
623
+ await delay(1000);
624
+ }
625
+ this._updatingContext = true;
626
+ try {
627
+ if (logalot) {
628
+ console.log(`${lc} starting... (I: 3eeaa40cad49094f125f9f5cd6ff6e22)`);
629
+ }
630
+ // if it's caused by this robbot speaking, then we don't really need
631
+ // it. but if it's from the user, then we want to respond.
632
+ if (logalot) {
633
+ console.log(`${lc} update: (I: ad0abae7de472e3b4d3891ea0b937322)`);
634
+ console.table(update);
635
+ }
636
+ if (!update.latestIbGib) {
637
+ debugger;
638
+ throw new Error(`(UNEXPECTED) update.latestIbGib falsy? (E: e18a048d7e95757238396ddd84748f22)`);
639
+ }
640
+ const newContext = update.latestIbGib;
641
+ const newChildrenIbGibs = await this.getNewChildrenIbGibs({ newContext });
642
+ // should normally be just one (would be very edge casey if not atow)
643
+ let newChild;
644
+ if (newChildrenIbGibs.length === 1) {
645
+ newChild = newChildrenIbGibs[0];
646
+ }
647
+ else if (newChildrenIbGibs.length > 1) {
648
+ console.warn(`${lc} (UNEXPECTED) found multiple new children in conversation? Using only the last. (W: 02d82a8f755f418d95fa30f0f52ad58e)`);
649
+ newChild = newChildrenIbGibs[newChildrenIbGibs.length - 1];
650
+ }
651
+ else {
652
+ // no new children, so maybe the user deleted something or who knows.
653
+ if (logalot) {
654
+ console.log(`${lc} no new children in context update. returning early... (I: 31397b04965351ab29bb3f78cb709122)`);
655
+ }
656
+ return; /* <<<< returns early */
657
+ }
658
+ // we have a new chidl inthe context.
659
+ await this.handleNewContextChild({ newChild });
660
+ }
661
+ catch (error) {
662
+ console.error(`${lc} ${error.message}`);
663
+ throw error;
664
+ }
665
+ finally {
666
+ this._updatingContext = false;
667
+ if (logalot) {
668
+ console.log(`${lc} complete.`);
669
+ }
670
+ }
671
+ }
672
+ async getNewChildrenIbGibs({ newContext }) {
673
+ const lc = `${this.lc}[${this.getNewChildrenIbGibs.name}]`;
674
+ try {
675
+ if (logalot) {
676
+ console.log(`${lc} starting... (I: 1b3d1cf908489087fa3b281f55b9a522)`);
677
+ }
678
+ // get a diff of the new addrs vs. the old addrs.
679
+ /** all of the children addrs of the new context */
680
+ const newContextChildrenAddrs = [
681
+ ...newContext.rel8ns?.comment ?? [],
682
+ ...newContext.rel8ns?.pic ?? [],
683
+ ...newContext.rel8ns?.link ?? [],
684
+ ];
685
+ /** just the new addrs from the context */
686
+ const newChildrenAddrs = newContextChildrenAddrs.filter(x => !this._currentWorkingContextIbGib_PriorChildrenAddrs.includes(x));
687
+ if (newChildrenAddrs.length === 0) {
688
+ // no new children
689
+ if (logalot) {
690
+ console.log(`${lc} no new children addrs in newContext. returning early... (I: 8f9c3658c194c472cb1e2bc19d847b22)`);
691
+ }
692
+ return []; /* <<<< returns early */
693
+ }
694
+ // get the latest addrs for those children
695
+ if (!this.ibgibsSvc) {
696
+ throw new Error(`this.ibgibsSvc falsy. not initialized? (E: 1cc26ca7de7fadcdbaecbd6613350e23)`);
697
+ }
698
+ const space = await this.ibgibsSvc.getLocalUserSpace({});
699
+ if (!space) {
700
+ throw new Error(`couldn't get local user space? (E: f118f75e5852fc22bba3a6495beec723)`);
701
+ }
702
+ const resLatestAddrs = await getLatestAddrs({ addrs: newChildrenAddrs, space, });
703
+ const latestAddrs = Object.values(resLatestAddrs?.data?.latestAddrsMap ?? {});
704
+ if (!resLatestAddrs?.data?.success || latestAddrs.length !== newChildrenAddrs.length) {
705
+ throw new Error(`could not get latest addrs. (E: 2e1619e7e2e166696fe8ff78cb02cc22)`);
706
+ }
707
+ // get the addrs' corresponding ibgibs
708
+ if (latestAddrs.some(x => x === null)) {
709
+ // some of the addrs were not found in the space
710
+ throw new Error(`some addrs were not found in the space. (E: 2216d8e5ad7fb600ceb025ed7c90f323)`);
711
+ }
712
+ const resGet = await this.ibgibsSvc.get({ addrs: latestAddrs });
713
+ if (!resGet.success || resGet.ibGibs?.length !== newChildrenAddrs.length) {
714
+ throw new Error(`failed to get newChildren with addrs: ${newChildrenAddrs.join('|')}. Error: ${resGet.errorMsg ?? 'unknown error 5737bd0996d5445b8bd80975bedc0d57'} (E: 05722e11350ec6ffffdb5c7d0caa2922)`);
715
+ }
716
+ return resGet.ibGibs;
717
+ }
718
+ catch (error) {
719
+ console.error(`${lc} ${error.message}`);
720
+ throw error;
721
+ }
722
+ finally {
723
+ if (logalot) {
724
+ console.log(`${lc} complete.`);
725
+ }
726
+ }
727
+ }
728
+ async handleNewContextChild({ newChild }) {
729
+ const lc = `${this.lc}[${this.handleNewContextChild.name}]`;
730
+ try {
731
+ throw new Error(`not implemented in base class (E: ea6b2b13d9504d93b33b70191d106084)`);
732
+ }
733
+ catch (error) {
734
+ console.error(`${lc} ${error.message}`);
735
+ throw error;
736
+ }
737
+ }
738
+ }
739
+ // export interface IbGibRobbotAny
740
+ // extends RobbotBase_V1<any, any, any, any, any, any, any, any> {
741
+ // }
742
+ //# sourceMappingURL=witness-with-context-base-v1.mjs.map