@nextclaw/x-harness 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +231 -6
- package/README.md +15 -1
- package/SOURCE.md +9 -0
- package/cli/main.js +232 -200
- package/dist/api.d.ts +56 -2
- package/dist/api.js +130 -79
- package/dist/boundary.js +1 -0
- package/dist/browser-common.d.ts +11 -0
- package/dist/browser-common.js +34 -18
- package/dist/browser-dom-capabilities.d.ts +7 -2
- package/dist/browser-dom-capabilities.js +123 -102
- package/dist/browser-dom-dependencies.js +1 -0
- package/dist/browser-dom-editing.d.ts +20 -2
- package/dist/browser-dom-editing.js +148 -116
- package/dist/browser-dom-navigation.d.ts +11 -2
- package/dist/browser-dom-navigation.js +66 -50
- package/dist/browser-dom-submission.d.ts +6 -1
- package/dist/browser-dom-submission.js +37 -18
- package/dist/browser-dom.d.ts +13 -1
- package/dist/browser-dom.js +113 -66
- package/dist/browser-native.d.ts +14 -1
- package/dist/browser-native.js +161 -128
- package/dist/creator-native.d.ts +3 -0
- package/dist/creator-native.js +113 -0
- package/dist/diagnostics.d.ts +11 -0
- package/dist/diagnostics.js +10 -0
- package/dist/growth-batch.d.ts +6 -3
- package/dist/growth-batch.js +157 -135
- package/dist/growth-dependencies.js +1 -0
- package/dist/growth-execution.d.ts +8 -2
- package/dist/growth-execution.js +68 -37
- package/dist/growth-parallel.d.ts +6 -2
- package/dist/growth-parallel.js +78 -47
- package/dist/growth-plan.d.ts +8 -3
- package/dist/growth-plan.js +45 -23
- package/dist/growth-policy.d.ts +11 -2
- package/dist/growth-policy.js +80 -53
- package/dist/growth-publishing.d.ts +7 -2
- package/dist/growth-publishing.js +72 -46
- package/dist/growth-reading.d.ts +6 -2
- package/dist/growth-reading.js +47 -25
- package/dist/growth-recovery.d.ts +7 -4
- package/dist/growth-recovery.js +177 -148
- package/dist/growth-state.d.ts +10 -2
- package/dist/growth-state.js +67 -30
- package/dist/growth-tasks.d.ts +19 -16
- package/dist/growth-tasks.js +153 -90
- package/dist/growth.d.ts +25 -1
- package/dist/growth.js +207 -124
- package/dist/platform-capabilities.d.ts +6 -2
- package/dist/platform-capabilities.js +18 -8
- package/dist/platform-collections.d.ts +10 -3
- package/dist/platform-collections.js +62 -35
- package/dist/platform-dependencies.js +1 -0
- package/dist/platform-diagnostics.d.ts +7 -2
- package/dist/platform-diagnostics.js +31 -19
- package/dist/platform-observation.d.ts +10 -2
- package/dist/platform-observation.js +44 -23
- package/dist/platform-targets.d.ts +10 -3
- package/dist/platform-targets.js +39 -14
- package/dist/platform-writing.d.ts +10 -2
- package/dist/platform-writing.js +63 -32
- package/dist/platform.d.ts +22 -1
- package/dist/platform.js +120 -52
- package/dist/readers-ax-host.d.ts +11 -1
- package/dist/readers-ax-host.js +108 -99
- package/dist/readers-ax-program.js +5 -0
- package/dist/readers-ax-tree.js +1 -0
- package/dist/readers-cli.js +79 -0
- package/dist/readers.js +9 -0
- package/dist/round-state.js +18 -1
- package/dist/store.d.ts +22 -4
- package/dist/store.js +173 -151
- package/dist/types.js +1 -0
- package/generated/observation.mjs +1 -1
- package/package.json +23 -9
- package/skill/SKILL.md +2 -2
- package/skill/references/reads.md +1 -1
- package/skill/references/recovery.md +4 -4
- package/skill/references/setup.md +1 -1
package/dist/growth-tasks.js
CHANGED
|
@@ -1,101 +1,164 @@
|
|
|
1
1
|
import { kinds, operations, same } from "./growth-constants.js";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
export class GrowthTasks {
|
|
3
|
+
#platform;
|
|
4
|
+
#capability;
|
|
5
|
+
#executor;
|
|
6
|
+
#readTask;
|
|
7
|
+
#parallelRound;
|
|
8
|
+
#round;
|
|
9
|
+
#load;
|
|
10
|
+
#result;
|
|
11
|
+
#publishIndependent;
|
|
12
|
+
#prepareActionsForCall;
|
|
13
|
+
constructor(dependencies) {
|
|
14
|
+
this.replyToPost = this.replyToPost.bind(this);
|
|
15
|
+
this.publishPost = this.publishPost.bind(this);
|
|
16
|
+
this.followOne = this.followOne.bind(this);
|
|
17
|
+
this.inspectRound = this.inspectRound.bind(this);
|
|
18
|
+
this.resumeGrowthRound = this.resumeGrowthRound.bind(this);
|
|
19
|
+
this.runGrowthRound = this.runGrowthRound.bind(this);
|
|
20
|
+
this.readFeedback = this.readFeedback.bind(this);
|
|
21
|
+
this.searchSources = this.searchSources.bind(this);
|
|
22
|
+
this.readBookmarks = this.readBookmarks.bind(this);
|
|
23
|
+
this.readPerson = this.readPerson.bind(this);
|
|
24
|
+
this.readPost = this.readPost.bind(this);
|
|
25
|
+
this.inspectAccount = this.inspectAccount.bind(this);
|
|
26
|
+
this.readCreator = this.readCreator.bind(this);
|
|
27
|
+
this.preflight = this.preflight.bind(this);
|
|
28
|
+
const { platform, capability, executor, readTask, parallelRound, round, load, result, publishIndependent, prepareActionsForCall, } = dependencies;
|
|
29
|
+
this.#platform = platform;
|
|
30
|
+
this.#capability = capability;
|
|
31
|
+
this.#executor = executor;
|
|
32
|
+
this.#readTask = readTask;
|
|
33
|
+
this.#parallelRound = parallelRound;
|
|
34
|
+
this.#round = round;
|
|
35
|
+
this.#load = load;
|
|
36
|
+
this.#result = result;
|
|
37
|
+
this.#publishIndependent = publishIndependent;
|
|
38
|
+
this.#prepareActionsForCall = prepareActionsForCall;
|
|
39
|
+
}
|
|
40
|
+
preflight({ operation, input = {} }) {
|
|
41
|
+
const executor = this.#executor;
|
|
42
|
+
if (["readBookmarks", "searchSources", "readFeedback"].includes(operation))
|
|
43
|
+
return this.#platform.preflight({ operation, input });
|
|
44
|
+
if (["inspectRound", "verifySubmission"].includes(operation))
|
|
45
|
+
return this.#capability("read", input);
|
|
46
|
+
if (["inspectAccount", "verifyFollow"].includes(operation)) {
|
|
47
|
+
const name = operation === "verifyFollow" ? "readPerson" : "readAccount";
|
|
48
|
+
if (typeof this.#platform?.preflight !== "function" ||
|
|
49
|
+
typeof this.#platform?.[name] !== "function")
|
|
32
50
|
return {
|
|
33
|
-
covered:
|
|
34
|
-
missing: [
|
|
35
|
-
|
|
36
|
-
...new Set(all.filter((c) => !c.covered).map((c) => c.owner)),
|
|
37
|
-
],
|
|
51
|
+
covered: false,
|
|
52
|
+
missing: [name],
|
|
53
|
+
owner: "scripts/x-harness-platform.mjs",
|
|
38
54
|
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
...Object.values(operations),
|
|
47
|
-
].includes(operation))
|
|
55
|
+
return this.#platform.preflight({ operation: "read", input });
|
|
56
|
+
}
|
|
57
|
+
if (["runGrowthRound", "resumeGrowthRound"].includes(operation)) {
|
|
58
|
+
const scoped = executor?.scopeKinds ?? input.scopeKinds ?? kinds;
|
|
59
|
+
if (!Array.isArray(scoped) ||
|
|
60
|
+
!scoped.length ||
|
|
61
|
+
scoped.some((k) => !kinds.includes(k)))
|
|
48
62
|
return {
|
|
49
63
|
covered: false,
|
|
50
|
-
missing: [
|
|
64
|
+
missing: ["scopeKinds"],
|
|
51
65
|
owner: "scripts/x-growth-harness.mjs",
|
|
52
66
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
const all = scoped.map((kind) => this.#capability(operations[kind], { ...input, kind }));
|
|
68
|
+
return {
|
|
69
|
+
covered: all.every((c) => c.covered),
|
|
70
|
+
missing: [...new Set(all.flatMap((c) => c.missing))],
|
|
71
|
+
owners: [
|
|
72
|
+
...new Set(all.filter((c) => !c.covered).map((c) => c.owner)),
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (![
|
|
77
|
+
"read",
|
|
78
|
+
"followOne",
|
|
79
|
+
"followBatch",
|
|
80
|
+
"publishPost",
|
|
81
|
+
"replyToPost",
|
|
82
|
+
...Object.values(operations),
|
|
83
|
+
].includes(operation))
|
|
84
|
+
return {
|
|
85
|
+
covered: false,
|
|
86
|
+
missing: [`operation.${operation}`],
|
|
87
|
+
owner: "scripts/x-growth-harness.mjs",
|
|
88
|
+
};
|
|
89
|
+
return this.#capability(operation, input);
|
|
90
|
+
}
|
|
91
|
+
readCreator(args) {
|
|
92
|
+
return this.#readTask("readCreator", args);
|
|
93
|
+
}
|
|
94
|
+
inspectAccount(args) {
|
|
95
|
+
return this.#readTask("readAccount", args);
|
|
96
|
+
}
|
|
97
|
+
readPost(args) {
|
|
98
|
+
return this.#readTask("readPost", { ...args, expand: true });
|
|
99
|
+
}
|
|
100
|
+
readPerson(args) {
|
|
101
|
+
return this.#readTask("readPerson", args);
|
|
102
|
+
}
|
|
103
|
+
readBookmarks(args) {
|
|
104
|
+
return this.#readTask("readBookmarks", args);
|
|
105
|
+
}
|
|
106
|
+
searchSources(args) {
|
|
107
|
+
return this.#readTask("searchSources", args);
|
|
108
|
+
}
|
|
109
|
+
readFeedback(args) {
|
|
110
|
+
return this.#readTask("readFeedback", args);
|
|
111
|
+
}
|
|
112
|
+
runGrowthRound(args) {
|
|
113
|
+
const executor = this.#executor;
|
|
114
|
+
return executor ? this.#parallelRound(args) : this.#round(args);
|
|
115
|
+
}
|
|
116
|
+
resumeGrowthRound(args) {
|
|
117
|
+
const executor = this.#executor;
|
|
118
|
+
return executor ? this.#parallelRound(args) : this.#round(args);
|
|
119
|
+
}
|
|
120
|
+
async inspectRound({ taskId }) {
|
|
121
|
+
const snapshot = await this.#load(taskId);
|
|
122
|
+
return this.#result(snapshot);
|
|
123
|
+
}
|
|
124
|
+
followOne({ taskId, handle }) {
|
|
125
|
+
const executor = this.#executor;
|
|
126
|
+
return (executor ? this.#parallelRound : this.#round)({
|
|
69
127
|
taskId,
|
|
70
128
|
requestedKind: "follow",
|
|
71
129
|
selector: (a) => a.kind === "follow" && same(a.handle, handle),
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
async publishPost(input) {
|
|
133
|
+
const executor = this.#executor;
|
|
134
|
+
if (!executor && input.independentExecution)
|
|
135
|
+
return this.#publishIndependent(input);
|
|
136
|
+
if (input.preparedAction &&
|
|
137
|
+
(input.preparedAction.kind !== "original" ||
|
|
138
|
+
input.preparedAction.draftPath !== input.draftPath))
|
|
139
|
+
throw new Error("prepared-original-target-mismatch");
|
|
140
|
+
await this.#prepareActionsForCall(input.taskId, input.preparedAction ? [input.preparedAction] : []);
|
|
141
|
+
return (executor ? this.#parallelRound : this.#round)({
|
|
142
|
+
taskId: input.taskId,
|
|
143
|
+
requestedKind: "original",
|
|
144
|
+
selector: (a) => a.kind === "original" && a.draftPath === input.draftPath,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
async replyToPost({ taskId, postId, text, preparedAction }) {
|
|
148
|
+
const executor = this.#executor;
|
|
149
|
+
if (preparedAction &&
|
|
150
|
+
(preparedAction.kind !== "reply" ||
|
|
151
|
+
preparedAction.postId !== postId ||
|
|
152
|
+
preparedAction.text !== text))
|
|
153
|
+
throw new Error("prepared-reply-target-mismatch");
|
|
154
|
+
await this.#prepareActionsForCall(taskId, preparedAction ? [preparedAction] : []);
|
|
155
|
+
return (executor ? this.#parallelRound : this.#round)({
|
|
156
|
+
taskId,
|
|
157
|
+
requestedKind: "reply",
|
|
158
|
+
selector: (a) => a.kind === "reply" && a.postId === postId && a.text === text,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
export function createGrowthTasks(...args) {
|
|
163
|
+
return new GrowthTasks(...args);
|
|
101
164
|
}
|
package/dist/growth.d.ts
CHANGED
|
@@ -1,2 +1,26 @@
|
|
|
1
1
|
/** Synchronous composition only; owners retain one original ledger and settlement path. */
|
|
2
|
-
export declare
|
|
2
|
+
export declare class GrowthHarness {
|
|
3
|
+
#private;
|
|
4
|
+
verifyPublishedPost: ({ taskId, draftPath, publicURL, evidenceRef, sourceLink, }: any) => Promise<any>;
|
|
5
|
+
verifySubmission: ({ taskId, actionId }: any) => Promise<any>;
|
|
6
|
+
verifyFollow: (target: any) => Promise<any>;
|
|
7
|
+
followBatch: ({ taskId, handles, preparedActions, }?: any) => Promise<import("./boundary.js").BoundaryRecord>;
|
|
8
|
+
preflight: ({ operation, input }: any) => any;
|
|
9
|
+
readCreator: (args: any) => Promise<any>;
|
|
10
|
+
inspectAccount: (args: any) => Promise<any>;
|
|
11
|
+
readPost: (args: any) => Promise<any>;
|
|
12
|
+
readPerson: (args: any) => Promise<any>;
|
|
13
|
+
readBookmarks: (args: any) => Promise<any>;
|
|
14
|
+
searchSources: (args: any) => Promise<any>;
|
|
15
|
+
readFeedback: (args: any) => Promise<any>;
|
|
16
|
+
runGrowthRound: (args: any) => Promise<any>;
|
|
17
|
+
resumeGrowthRound: (args: any) => Promise<any>;
|
|
18
|
+
inspectRound: ({ taskId }: any) => Promise<any>;
|
|
19
|
+
followOne: ({ taskId, handle }: any) => Promise<any>;
|
|
20
|
+
publishPost: (input: any) => Promise<any>;
|
|
21
|
+
replyToPost: ({ taskId, postId, text, preparedAction }: any) => Promise<any>;
|
|
22
|
+
constructor({ platform, store, clock, executor, }?: any);
|
|
23
|
+
private composeTasks;
|
|
24
|
+
private stamp;
|
|
25
|
+
}
|
|
26
|
+
export declare function createGrowthHarness(...args: ConstructorParameters<typeof GrowthHarness>): any;
|
package/dist/growth.js
CHANGED
|
@@ -11,128 +11,211 @@ import { createGrowthRecovery } from "./growth-recovery.js";
|
|
|
11
11
|
import { createFollowBatch } from "./growth-batch.js";
|
|
12
12
|
import { createGrowthTasks } from "./growth-tasks.js";
|
|
13
13
|
/** Synchronous composition only; owners retain one original ledger and settlement path. */
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
load
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
14
|
+
export class GrowthHarness {
|
|
15
|
+
#platform;
|
|
16
|
+
#store;
|
|
17
|
+
#clock;
|
|
18
|
+
#executor;
|
|
19
|
+
#session;
|
|
20
|
+
#evidenceExists;
|
|
21
|
+
#runtimeId;
|
|
22
|
+
#authorizedWindow;
|
|
23
|
+
#scope;
|
|
24
|
+
#project;
|
|
25
|
+
#capability;
|
|
26
|
+
#waitBudget;
|
|
27
|
+
#guardInput;
|
|
28
|
+
#load;
|
|
29
|
+
#save;
|
|
30
|
+
#result;
|
|
31
|
+
#settleProof;
|
|
32
|
+
#releaseSession;
|
|
33
|
+
#execute;
|
|
34
|
+
#parallelRound;
|
|
35
|
+
#round;
|
|
36
|
+
#publishIndependent;
|
|
37
|
+
#prepareActionsForCall;
|
|
38
|
+
#readTask;
|
|
39
|
+
#createGrowthRecoveryResult;
|
|
40
|
+
#createFollowBatchResult;
|
|
41
|
+
#createGrowthTasksResult;
|
|
42
|
+
verifyPublishedPost;
|
|
43
|
+
verifySubmission;
|
|
44
|
+
verifyFollow;
|
|
45
|
+
followBatch;
|
|
46
|
+
preflight;
|
|
47
|
+
readCreator;
|
|
48
|
+
inspectAccount;
|
|
49
|
+
readPost;
|
|
50
|
+
readPerson;
|
|
51
|
+
readBookmarks;
|
|
52
|
+
searchSources;
|
|
53
|
+
readFeedback;
|
|
54
|
+
runGrowthRound;
|
|
55
|
+
resumeGrowthRound;
|
|
56
|
+
inspectRound;
|
|
57
|
+
followOne;
|
|
58
|
+
publishPost;
|
|
59
|
+
replyToPost;
|
|
60
|
+
constructor({ platform, store, clock = () => Date.now(), executor, } = {}) {
|
|
61
|
+
this.#platform = platform;
|
|
62
|
+
this.#store = store;
|
|
63
|
+
this.#clock = clock;
|
|
64
|
+
this.#executor = executor;
|
|
65
|
+
this.#session = { claim: undefined, running: false };
|
|
66
|
+
this.#evidenceExists = this.#store.evidenceExists ?? (() => false);
|
|
67
|
+
this.#runtimeId = randomUUID();
|
|
68
|
+
if (this.#executor &&
|
|
69
|
+
(!this.#executor.id ||
|
|
70
|
+
!this.#executor.tabId ||
|
|
71
|
+
!Array.isArray(this.#executor.scopeKinds) ||
|
|
72
|
+
!this.#executor.scopeKinds.length ||
|
|
73
|
+
new Set(this.#executor.scopeKinds).size !==
|
|
74
|
+
this.#executor.scopeKinds.length ||
|
|
75
|
+
this.#executor.scopeKinds.some((k) => !kinds.includes(k)) ||
|
|
76
|
+
!this.#evidenceExists(this.#executor.evidenceRef) ||
|
|
77
|
+
typeof this.#store.transaction !== "function"))
|
|
78
|
+
throw new Error("并行执行者需ID、独立tab、有效职责及原合同证据与transaction");
|
|
79
|
+
const { authorizedWindow, scope, project, capability, waitBudget, guardInput, } = createGrowthPolicy({
|
|
80
|
+
executor: this.#executor,
|
|
81
|
+
clock: this.#clock,
|
|
82
|
+
evidenceExists: this.#evidenceExists,
|
|
83
|
+
platform: this.#platform,
|
|
84
|
+
store: this.#store,
|
|
85
|
+
});
|
|
86
|
+
this.#authorizedWindow = authorizedWindow;
|
|
87
|
+
this.#scope = scope;
|
|
88
|
+
this.#project = project;
|
|
89
|
+
this.#capability = capability;
|
|
90
|
+
this.#waitBudget = waitBudget;
|
|
91
|
+
this.#guardInput = guardInput;
|
|
92
|
+
const { load, save, result, settleProof, releaseSession } = createGrowthState({
|
|
93
|
+
store: this.#store,
|
|
94
|
+
project: this.#project,
|
|
95
|
+
clock: this.#clock,
|
|
96
|
+
evidenceExists: this.#evidenceExists,
|
|
97
|
+
stamp: this.stamp.bind(this),
|
|
98
|
+
executor: this.#executor,
|
|
99
|
+
waitBudget: this.#waitBudget,
|
|
100
|
+
platform: this.#platform,
|
|
101
|
+
runtimeId: this.#runtimeId,
|
|
102
|
+
session: this.#session,
|
|
103
|
+
});
|
|
104
|
+
this.#load = load;
|
|
105
|
+
this.#save = save;
|
|
106
|
+
this.#result = result;
|
|
107
|
+
this.#settleProof = settleProof;
|
|
108
|
+
this.#releaseSession = releaseSession;
|
|
109
|
+
const { execute } = createGrowthExecution({
|
|
110
|
+
capability: this.#capability,
|
|
111
|
+
platform: this.#platform,
|
|
112
|
+
settleProof: this.#settleProof,
|
|
113
|
+
clock: this.#clock,
|
|
114
|
+
save: this.#save,
|
|
115
|
+
guardInput: this.#guardInput,
|
|
116
|
+
waitBudget: this.#waitBudget,
|
|
117
|
+
authorizedWindow: this.#authorizedWindow,
|
|
118
|
+
stamp: this.stamp.bind(this),
|
|
119
|
+
store: this.#store,
|
|
120
|
+
executor: this.#executor,
|
|
121
|
+
session: this.#session,
|
|
122
|
+
});
|
|
123
|
+
this.#execute = execute;
|
|
124
|
+
const { parallelRound } = createParallelRound({
|
|
125
|
+
load: this.#load,
|
|
126
|
+
scope: this.#scope,
|
|
127
|
+
result: this.#result,
|
|
128
|
+
store: this.#store,
|
|
129
|
+
executor: this.#executor,
|
|
130
|
+
runtimeId: this.#runtimeId,
|
|
131
|
+
stamp: this.stamp.bind(this),
|
|
132
|
+
evidenceExists: this.#evidenceExists,
|
|
133
|
+
execute: this.#execute,
|
|
134
|
+
clock: this.#clock,
|
|
135
|
+
releaseSession: this.#releaseSession,
|
|
136
|
+
session: this.#session,
|
|
137
|
+
});
|
|
138
|
+
this.#parallelRound = parallelRound;
|
|
139
|
+
const { round } = createPlannedRound({
|
|
140
|
+
store: this.#store,
|
|
141
|
+
load: this.#load,
|
|
142
|
+
result: this.#result,
|
|
143
|
+
evidenceExists: this.#evidenceExists,
|
|
144
|
+
save: this.#save,
|
|
145
|
+
execute: this.#execute,
|
|
146
|
+
clock: this.#clock,
|
|
147
|
+
stamp: this.stamp.bind(this),
|
|
148
|
+
});
|
|
149
|
+
this.#round = round;
|
|
150
|
+
const { publishIndependent, prepareActionsForCall } = createIndependentPublishing({
|
|
151
|
+
clock: this.#clock,
|
|
152
|
+
evidenceExists: this.#evidenceExists,
|
|
153
|
+
capability: this.#capability,
|
|
154
|
+
store: this.#store,
|
|
155
|
+
load: this.#load,
|
|
156
|
+
guardInput: this.#guardInput,
|
|
157
|
+
save: this.#save,
|
|
158
|
+
platform: this.#platform,
|
|
159
|
+
stamp: this.stamp.bind(this),
|
|
160
|
+
settleProof: this.#settleProof,
|
|
161
|
+
});
|
|
162
|
+
this.#publishIndependent = publishIndependent;
|
|
163
|
+
this.#prepareActionsForCall = prepareActionsForCall;
|
|
164
|
+
const { readTask } = createGrowthReading({
|
|
165
|
+
platform: this.#platform,
|
|
166
|
+
executor: this.#executor,
|
|
167
|
+
store: this.#store,
|
|
168
|
+
runtimeId: this.#runtimeId,
|
|
169
|
+
stamp: this.stamp.bind(this),
|
|
170
|
+
releaseSession: this.#releaseSession,
|
|
171
|
+
session: this.#session,
|
|
172
|
+
});
|
|
173
|
+
this.#readTask = readTask;
|
|
174
|
+
this.composeTasks();
|
|
175
|
+
}
|
|
176
|
+
composeTasks() {
|
|
177
|
+
this.#createGrowthRecoveryResult = createGrowthRecovery({
|
|
178
|
+
capability: this.#capability,
|
|
179
|
+
platform: this.#platform,
|
|
180
|
+
load: this.#load,
|
|
181
|
+
evidenceExists: this.#evidenceExists,
|
|
182
|
+
clock: this.#clock,
|
|
183
|
+
store: this.#store,
|
|
184
|
+
settleProof: this.#settleProof,
|
|
185
|
+
executor: this.#executor,
|
|
186
|
+
parallelRound: this.#parallelRound,
|
|
187
|
+
round: this.#round,
|
|
188
|
+
readTask: this.#readTask,
|
|
189
|
+
});
|
|
190
|
+
this.#createFollowBatchResult = createFollowBatch({
|
|
191
|
+
prepareActionsForCall: this.#prepareActionsForCall,
|
|
192
|
+
store: this.#store,
|
|
193
|
+
scope: this.#scope,
|
|
194
|
+
stamp: this.stamp.bind(this),
|
|
195
|
+
clock: this.#clock,
|
|
196
|
+
evidenceExists: this.#evidenceExists,
|
|
197
|
+
executor: this.#executor,
|
|
198
|
+
parallelRound: this.#parallelRound,
|
|
199
|
+
round: this.#round,
|
|
200
|
+
});
|
|
201
|
+
this.#createGrowthTasksResult = createGrowthTasks({
|
|
202
|
+
platform: this.#platform,
|
|
203
|
+
capability: this.#capability,
|
|
204
|
+
executor: this.#executor,
|
|
205
|
+
readTask: this.#readTask,
|
|
206
|
+
parallelRound: this.#parallelRound,
|
|
207
|
+
round: this.#round,
|
|
208
|
+
load: this.#load,
|
|
209
|
+
result: this.#result,
|
|
210
|
+
publishIndependent: this.#publishIndependent,
|
|
211
|
+
prepareActionsForCall: this.#prepareActionsForCall,
|
|
212
|
+
});
|
|
213
|
+
Object.assign(this, Object.assign({}, this.#createGrowthRecoveryResult, this.#createFollowBatchResult, this.#createGrowthTasksResult));
|
|
214
|
+
}
|
|
215
|
+
stamp() {
|
|
216
|
+
return new Date(this.#clock()).toISOString();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
export function createGrowthHarness(...args) {
|
|
220
|
+
return new GrowthHarness(...args);
|
|
138
221
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { PlatformDependencies } from "./platform-dependencies.js";
|
|
2
|
-
export declare
|
|
2
|
+
export declare class PlatformCapabilities {
|
|
3
|
+
#private;
|
|
3
4
|
preflight: ({ operation, input }: any) => any;
|
|
4
|
-
|
|
5
|
+
constructor(dependencies: Pick<PlatformDependencies, "missing" | "browser">);
|
|
6
|
+
private handlePreflight;
|
|
7
|
+
}
|
|
8
|
+
export declare function createPlatformCapabilities(...args: ConstructorParameters<typeof PlatformCapabilities>): PlatformCapabilities;
|