Spaces:
Running
Running
Commit
·
b39afbe
1
Parent(s):
c06a0ff
copy of omnitool_latest - should be working
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .editorconfig +10 -0
- .eslintignore +1 -0
- .eslintrc.cjs +107 -0
- .fossa.yml.template +8 -0
- .gitignore +161 -0
- .mercs.yaml +309 -0
- .npmignore +162 -0
- .prettierignore +11 -0
- .prettierrc +9 -0
- .yarn/plugins/@yarnpkg/plugin-engines.cjs +9 -0
- .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -0
- .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs +28 -0
- .yarn/releases/yarn-3.3.1.cjs +0 -0
- .yarnrc.yml +11 -0
- CLA.md +110 -0
- CODE_OF_CONDUCT.md +132 -0
- COPYRIGHT.md +2 -0
- Dockerfile +42 -0
- LICENSE.md +667 -0
- NOTICE.md +3 -0
- ORIGIN.md +1 -0
- README.md +305 -1
- SOURCE.md +2 -0
- THIRD_PARTIES.md +0 -0
- THIRD_PARTIES_ADDITIONAL.md +25 -0
- docker_build.sh +4 -0
- launch.js +53 -0
- omnitool_start.sh +18 -0
- package.json +66 -0
- packages/omni-sdk/.gitignore +1 -0
- packages/omni-sdk/README.md +48 -0
- packages/omni-sdk/build.js +30 -0
- packages/omni-sdk/package.json +37 -0
- packages/omni-sdk/src/MarkdownEngine.ts +111 -0
- packages/omni-sdk/src/OmniSDKClient.ts +273 -0
- packages/omni-sdk/src/OmniSDKHost.ts +321 -0
- packages/omni-sdk/src/OmniSDKShared.ts +307 -0
- packages/omni-sdk/src/Resources/OmniBaseResource.ts +133 -0
- packages/omni-sdk/src/Resources/OmniResource.ts +31 -0
- packages/omni-sdk/src/Utils/HttpClient.ts +18 -0
- packages/omni-sdk/src/index.ts +11 -0
- packages/omni-sdk/src/types.ts +159 -0
- packages/omni-sdk/tsconfig.json +104 -0
- packages/omni-server/.editorconfig +10 -0
- packages/omni-server/.gitignore +17 -0
- packages/omni-server/.npmignore +16 -0
- packages/omni-server/README.md +77 -0
- packages/omni-server/build.js +39 -0
- packages/omni-server/config.default/README.md +5 -0
- packages/omni-server/config.default/extensions/known_extensions.yaml +111 -0
.editorconfig
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
root = true
|
2 |
+
|
3 |
+
[*]
|
4 |
+
end_of_line = lf
|
5 |
+
insert_final_newline = true
|
6 |
+
|
7 |
+
[*.{js,json,yml}]
|
8 |
+
charset = utf-8
|
9 |
+
indent_style = space
|
10 |
+
indent_size = 2
|
.eslintignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.eslintrc.cjs
|
.eslintrc.cjs
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const path = require('path')
|
2 |
+
|
3 |
+
const project = [
|
4 |
+
path.join(__dirname, 'packages/omni-shared/tsconfig.json'),
|
5 |
+
path.join(__dirname, 'packages/omni-ui/omni-client-services/tsconfig.json'),
|
6 |
+
path.join(__dirname, 'packages/omni-sockets/tsconfig.json'),
|
7 |
+
path.join(__dirname, 'packages/omni-server/tsconfig.json'),
|
8 |
+
path.join(__dirname, 'packages/omni-server/tsconfig.eslint.json'),
|
9 |
+
path.join(__dirname, 'packages/omni-ui/omni-web/tsconfig.json'),
|
10 |
+
path.join(__dirname, 'packages/omni-sdk/tsconfig.json'),
|
11 |
+
]
|
12 |
+
|
13 |
+
module.exports = {
|
14 |
+
env: {
|
15 |
+
browser: true,
|
16 |
+
es2021: true
|
17 |
+
},
|
18 |
+
extends: ['standard-with-typescript', 'eslint-config-prettier'],
|
19 |
+
plugins: ['@typescript-eslint', 'prettier'],
|
20 |
+
overrides: [
|
21 |
+
{
|
22 |
+
env: {
|
23 |
+
node: true
|
24 |
+
},
|
25 |
+
files: ['.eslintrc.{js,cjs}'],
|
26 |
+
parserOptions: {
|
27 |
+
sourceType: 'script',
|
28 |
+
project
|
29 |
+
}
|
30 |
+
}
|
31 |
+
],
|
32 |
+
ignorePatterns: ['setup/**', 'vite.config.js', '*.cjs', '*.d.ts', '*/omni-server/extensions/**'],
|
33 |
+
parser: "@typescript-eslint/parser",
|
34 |
+
parserOptions: {
|
35 |
+
ecmaVersion: 'latest',
|
36 |
+
sourceType: 'module',
|
37 |
+
project
|
38 |
+
},
|
39 |
+
rules: {
|
40 |
+
'no-debugger': 'warn',
|
41 |
+
'prettier/prettier': 'off',
|
42 |
+
'no-prototype-builtins': 'off',
|
43 |
+
'eslint-disable-next-line': 'off',
|
44 |
+
"no-lone-blocks" : 'off',
|
45 |
+
'no-trailing-spaces': 'off',
|
46 |
+
'no-multi-spaces': 'off',
|
47 |
+
'padded-blocks': 'off',
|
48 |
+
'no-debugger': 'off',
|
49 |
+
'object-property-newline': 'off',
|
50 |
+
'object-curly-newline': 'off',
|
51 |
+
'arrow-spacing': 'off',
|
52 |
+
'no-multiple-empty-lines': 'off',
|
53 |
+
'eol-last': 'off',
|
54 |
+
'space-in-parens':'off',
|
55 |
+
'block-spacing':'off',
|
56 |
+
'spaced-comment': 'off',
|
57 |
+
'new-cap': 'off',
|
58 |
+
'@typescript-eslint/quotes': 'off',
|
59 |
+
'promise/param-names': 'off',
|
60 |
+
'@typescript-eslint/array-type': 'off', // candidate for code quality pass
|
61 |
+
'@typescript-eslint/space-before-blocks': 'off',
|
62 |
+
'@typescript-eslint/keyword-spacing': 'off',
|
63 |
+
'@typescript-eslint/member-delimiter-style': 'off',
|
64 |
+
'@typescript-eslint/brace-style': 'off',
|
65 |
+
'@typescript-eslint/lines-between-class-members': 'off',
|
66 |
+
'@typescript-eslint/comma-dangle': 'off',
|
67 |
+
'@typescript-eslint/comma-spacing': 'off',
|
68 |
+
'generator-star-spacing': 'off',
|
69 |
+
'no-unexpected-multiline': 'off',
|
70 |
+
'@typescript-eslint/space-infix-ops': 'off',
|
71 |
+
'@typescript-eslint/object-curly-spacing' : 'off',
|
72 |
+
'@typescript-eslint/key-spacing': 'off',
|
73 |
+
'@typescript-eslint/type-annotation-spacing': 'off',
|
74 |
+
'@typescript-eslint/naming-convention': 'off',
|
75 |
+
'@typescript-eslint/space-before-function-paren': 'off',
|
76 |
+
'@typescript-eslint/indent': ['off', 4],
|
77 |
+
'@typescript-eslint/strict-boolean-expressions': 'off',
|
78 |
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
79 |
+
'@typescript-eslint/ban-ts-comment': 'off',
|
80 |
+
'@typescript-eslint/semi': 'off',
|
81 |
+
'@typescript-eslint/no-unused-vars': 'warn',
|
82 |
+
'@typescript-eslint/no-unused-expressions': 'warn',
|
83 |
+
'@typescript-eslint/prefer-ts-expect-error': 'off',
|
84 |
+
'@typescript-eslint/restrict-template-expressions': 'off',
|
85 |
+
'@typescript-eslint/naming': 'off',
|
86 |
+
'@typescript-eslint/prefer-optional-chain': 'off',
|
87 |
+
'@typescript-eslint/no-floating-promises': 'warn',
|
88 |
+
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
|
89 |
+
'@typescript-eslint/ban-types': ['warn', {
|
90 |
+
'types': {
|
91 |
+
'Function': false
|
92 |
+
}
|
93 |
+
}],
|
94 |
+
'@typescript-eslint/restrict-plus-operands': 'warn',
|
95 |
+
'@typescript-eslint/no-dynamic-delete': 'warn',
|
96 |
+
'@typescript-eslint/no-misused-promises': 'warn',
|
97 |
+
'@typescript-eslint/no-useless-constructor': 'off',
|
98 |
+
'@typescript-eslint/await-thenable': 'warn',
|
99 |
+
'@typescript-eslint/restrict-plus-operands': 'off',
|
100 |
+
'@typescript-eslint/no-non-null-assertion': 'warn',
|
101 |
+
'@typescript-eslint/return-await': 'warn',
|
102 |
+
'@typescript-eslint/no-this-alias': 'off',
|
103 |
+
'@typescript-eslint/no-extraneous-class': 'warn',
|
104 |
+
'no-eval': 'warn',
|
105 |
+
'eqeqeq': 'warn'
|
106 |
+
}
|
107 |
+
}
|
.fossa.yml.template
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: 3
|
2 |
+
|
3 |
+
apiKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
4 |
+
|
5 |
+
paths:
|
6 |
+
exclude:
|
7 |
+
- ./packages/omni-server/extensions/
|
8 |
+
- ./packages/node_modules/omni-server/extensions/
|
.gitignore
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.DS_Store
|
2 |
+
.env.local
|
3 |
+
dist-ssr
|
4 |
+
*.local.*
|
5 |
+
.mercs.local.yaml
|
6 |
+
.vscode
|
7 |
+
*/etc/keystore/*
|
8 |
+
*/etc/registry/.cache/*
|
9 |
+
omni.zip
|
10 |
+
fossa*
|
11 |
+
.fossa.yml
|
12 |
+
|
13 |
+
tsconfig.tsbuildinfo
|
14 |
+
/**/*/public/t
|
15 |
+
/**/*/public/sets
|
16 |
+
stats.html
|
17 |
+
|
18 |
+
# Created by .ignore support plugin (hsz.mobi)
|
19 |
+
### JetBrains template
|
20 |
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
21 |
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
22 |
+
|
23 |
+
# User-specific stuff:
|
24 |
+
.idea/workspace.xml
|
25 |
+
.idea/tasks.xml
|
26 |
+
*/cache/**
|
27 |
+
./var/**
|
28 |
+
content/
|
29 |
+
docker-certs/
|
30 |
+
log.txt
|
31 |
+
/.yarn/*
|
32 |
+
/**/*/.yarn/install-state.gz
|
33 |
+
!.yarn/patches
|
34 |
+
!.yarn/releases
|
35 |
+
!.yarn/plugins
|
36 |
+
!.yarn/sdks
|
37 |
+
!.yarn/versions
|
38 |
+
.pnp.*
|
39 |
+
/etc/ssl/
|
40 |
+
tmp/
|
41 |
+
Untitled*.md
|
42 |
+
user_files/*
|
43 |
+
!user_files/USER_FILES_GO_HERE
|
44 |
+
!user_files/oobabooga_models_directory.json
|
45 |
+
!user_files/local_llms_directories.json
|
46 |
+
packages/server/user_provided_models/*
|
47 |
+
!packages/server/USER_PROVIDED_MODELS_GO_HERE
|
48 |
+
packages/omni-server/user_provided_models/*
|
49 |
+
!packages/omni-server/USER_PROVIDED_MODELS_GO_HERE
|
50 |
+
|
51 |
+
# package bundles
|
52 |
+
build
|
53 |
+
setup/updates
|
54 |
+
|
55 |
+
# transient packaging
|
56 |
+
/build
|
57 |
+
|
58 |
+
# Sensitive or high-churn files:
|
59 |
+
.idea/dataSources/
|
60 |
+
.idea/dataSources.ids
|
61 |
+
.idea/dataSources.xml
|
62 |
+
.idea/dataSources.local.xml
|
63 |
+
.idea/sqlDataSources.xml
|
64 |
+
.idea/dynamic.xml
|
65 |
+
.idea/uiDesigner.xml
|
66 |
+
|
67 |
+
|
68 |
+
# Gradle:
|
69 |
+
.idea/gradle.xml
|
70 |
+
.idea/libraries
|
71 |
+
./tmp/
|
72 |
+
# Mongo Explorer plugin:
|
73 |
+
.idea/mongoSettings.xml
|
74 |
+
|
75 |
+
## File-based project format:
|
76 |
+
*.iws
|
77 |
+
|
78 |
+
## Plugin-specific files:
|
79 |
+
|
80 |
+
# IntelliJ
|
81 |
+
/out/
|
82 |
+
|
83 |
+
# mpeltonen/sbt-idea plugin
|
84 |
+
.idea_modules/
|
85 |
+
|
86 |
+
# JIRA plugin
|
87 |
+
atlassian-ide-plugin.xml
|
88 |
+
|
89 |
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
90 |
+
com_crashlytics_export_strings.xml
|
91 |
+
crashlytics.properties
|
92 |
+
crashlytics-build.properties
|
93 |
+
fabric.properties
|
94 |
+
### Node template
|
95 |
+
# Logs
|
96 |
+
logs
|
97 |
+
*.log
|
98 |
+
npm-debug.log*
|
99 |
+
|
100 |
+
# Runtime data
|
101 |
+
pids
|
102 |
+
*.pid
|
103 |
+
*.seed
|
104 |
+
*.pid.lock
|
105 |
+
|
106 |
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
107 |
+
lib-cov
|
108 |
+
|
109 |
+
# Coverage directory used by tools like istanbul
|
110 |
+
coverage
|
111 |
+
|
112 |
+
# nyc test coverage
|
113 |
+
.nyc_output
|
114 |
+
|
115 |
+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
116 |
+
.grunt
|
117 |
+
|
118 |
+
# node-waf configuration
|
119 |
+
.lock-wscript
|
120 |
+
|
121 |
+
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
122 |
+
build/Release
|
123 |
+
|
124 |
+
# Dependency directories
|
125 |
+
node_modules
|
126 |
+
jspm_packages
|
127 |
+
|
128 |
+
# Optional npm cache directory
|
129 |
+
.npm
|
130 |
+
|
131 |
+
# Optional eslint cache
|
132 |
+
.eslintcache
|
133 |
+
|
134 |
+
# Optional REPL history
|
135 |
+
.node_repl_history
|
136 |
+
|
137 |
+
# Output of 'npm pack'
|
138 |
+
*.tgz
|
139 |
+
|
140 |
+
# Yarn Integrity file
|
141 |
+
.yarn-integrity
|
142 |
+
|
143 |
+
.idea/
|
144 |
+
#.idea/watcherTasks.xml
|
145 |
+
.DS_Store
|
146 |
+
.env.local
|
147 |
+
server.local
|
148 |
+
~$*
|
149 |
+
/public/js/app.js
|
150 |
+
/public/js/app.js.map
|
151 |
+
/public/**/*.map
|
152 |
+
/webapp/public/js
|
153 |
+
.parcel-cache/
|
154 |
+
/docs/
|
155 |
+
/public/
|
156 |
+
config.yaml.local
|
157 |
+
/assets.local/
|
158 |
+
/assets.local2/
|
159 |
+
*.code-workspace
|
160 |
+
etc.local/
|
161 |
+
keystore.local.yaml
|
.mercs.yaml
ADDED
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
server:
|
2 |
+
network:
|
3 |
+
public_url: http://127.0.0.1:1688
|
4 |
+
rateLimit:
|
5 |
+
global: false
|
6 |
+
max: 1000
|
7 |
+
timeWindow: 60000 # 1 minute
|
8 |
+
|
9 |
+
session:
|
10 |
+
cookie:
|
11 |
+
maxAge: 604800000 # 1 week, 7*24*60*60*1000
|
12 |
+
secure: true
|
13 |
+
httpOnly: false
|
14 |
+
|
15 |
+
logger:
|
16 |
+
level: 2
|
17 |
+
|
18 |
+
kvStorage: # Location of the server KV Storage
|
19 |
+
dbPath: './data.local/db'
|
20 |
+
|
21 |
+
settings:
|
22 |
+
kvStorage:
|
23 |
+
dbPath: './data.local/db'
|
24 |
+
dbName: 'settings.db'
|
25 |
+
|
26 |
+
services:
|
27 |
+
messaging:
|
28 |
+
keepaliveInterval: 60000 # 60*1000 ms between sending keepalive packets to the client to prevent proxies from reaping the SSE connection
|
29 |
+
|
30 |
+
credentials:
|
31 |
+
disabled: false
|
32 |
+
type: default # default, local, vaultwarden (default to KV)
|
33 |
+
omniKeys: '../../keystore.local.yaml' # The default keystore to use if user doesn't have organization or user level credentials in the root folder
|
34 |
+
encryption:
|
35 |
+
keyPath: './data.local/keystore/encryption.key' # The key used to encrypt the credentials in the keystore
|
36 |
+
algorithm: aes-256-cbc
|
37 |
+
signature:
|
38 |
+
keyPath: './data.local/keystore/signature.key' # The key used to sign the credentials in the keystore
|
39 |
+
algorithm: sha256
|
40 |
+
storeConfig:
|
41 |
+
dbPath: './data.local/db'
|
42 |
+
oauth:
|
43 |
+
google-tts:
|
44 |
+
opts:
|
45 |
+
access_type: 'offline'
|
46 |
+
prompt: 'consent'
|
47 |
+
google-translate:
|
48 |
+
opts:
|
49 |
+
access_type: 'offline'
|
50 |
+
prompt: 'consent'
|
51 |
+
google-play:
|
52 |
+
opts:
|
53 |
+
access_type: 'offline'
|
54 |
+
prompt: 'consent'
|
55 |
+
google-llm:
|
56 |
+
opts:
|
57 |
+
access_type: 'offline'
|
58 |
+
prompt: 'consent'
|
59 |
+
google-vision:
|
60 |
+
opts:
|
61 |
+
access_type: 'offline'
|
62 |
+
prompt: 'consent'
|
63 |
+
google-gmail:
|
64 |
+
opts:
|
65 |
+
access_type: 'offline'
|
66 |
+
prompt: 'consent'
|
67 |
+
|
68 |
+
db:
|
69 |
+
pocketbase:
|
70 |
+
local:
|
71 |
+
dbUrl: 'http://127.0.0.1:8090'
|
72 |
+
login: '[email protected]'
|
73 |
+
development:
|
74 |
+
dbUrl: 'https://pocket.intern.mercenaries.ai'
|
75 |
+
|
76 |
+
rest_consumer:
|
77 |
+
exchange: { name: 'omni_tasks', type: 'topic', options: { durable: true, autoDelete: false, internal: false, arguments: {} } }
|
78 |
+
retry:
|
79 |
+
disabled: false
|
80 |
+
maxRetries: 3
|
81 |
+
delay: 3000
|
82 |
+
disabled: false
|
83 |
+
|
84 |
+
amqp:
|
85 |
+
exchanges:
|
86 |
+
- name: 'omni_tasks'
|
87 |
+
type: 'topic'
|
88 |
+
options:
|
89 |
+
durable: true
|
90 |
+
autoDelete: false
|
91 |
+
internal: false
|
92 |
+
arguments: {}
|
93 |
+
|
94 |
+
- name: 'omni_announce'
|
95 |
+
type: 'topic'
|
96 |
+
options:
|
97 |
+
durable: true
|
98 |
+
autoDelete: false
|
99 |
+
internal: false
|
100 |
+
arguments: {}
|
101 |
+
|
102 |
+
blockmanager:
|
103 |
+
preload: true
|
104 |
+
kvStorage:
|
105 |
+
dbPath: './data.local/db'
|
106 |
+
dbName: 'blocks.db'
|
107 |
+
|
108 |
+
# Integrations Configuration (Integrations are defined and added to the server in run.ts before it loads)
|
109 |
+
integrations:
|
110 |
+
|
111 |
+
cdn:
|
112 |
+
type: local
|
113 |
+
useLocalRoute: true #whether to use the local route or seaweed returned public url for serving images
|
114 |
+
localRoute: 'http://127.0.0.1:1688/fid'
|
115 |
+
kvStorage:
|
116 |
+
dbPath: './data.local/db'
|
117 |
+
|
118 |
+
local:
|
119 |
+
default_ttl: 7d #default ttl for temp artifacts
|
120 |
+
# ${{ if navigator.platform.startsWith("Win") }}:
|
121 |
+
# root: 'c://temp//cdn'
|
122 |
+
# url: '127.0.0.1:1688'
|
123 |
+
# insecure: true #whether to use https (e.g. behind reverse proxy) when talking to volume nodes on the backend
|
124 |
+
# ${{ else }}:
|
125 |
+
root: './data.local/files'
|
126 |
+
url: '127.0.0.1:1688'
|
127 |
+
insecure: true #whether to use https (e.g. behind reverse proxy) when talking to volume nodes on the backend
|
128 |
+
|
129 |
+
routes:
|
130 |
+
'/fid/:fid':
|
131 |
+
insecure: true
|
132 |
+
handler: 'fid'
|
133 |
+
clientExport: 'fid'
|
134 |
+
'POST /fid':
|
135 |
+
insecure: false
|
136 |
+
handler: 'fidupload'
|
137 |
+
clientExport: 'fidupload'
|
138 |
+
|
139 |
+
# Our own backend server APIs. These are declared as routes
|
140 |
+
mercenaries:
|
141 |
+
routes:
|
142 |
+
'/api/v1/mercenaries/ping': # Test route - defaults to GET
|
143 |
+
handler: 'ping'
|
144 |
+
clientExport: 'ping'
|
145 |
+
insecure: true
|
146 |
+
'POST /api/v1/mercenaries/ping': # Test route - adds the same handler responding to POST
|
147 |
+
handler: 'ping'
|
148 |
+
'/api/v1/mercenaries/fetch': # Server side fetch route (formerly /p) - GET
|
149 |
+
handler: 'fetch'
|
150 |
+
config:
|
151 |
+
rateLimit:
|
152 |
+
max: 300
|
153 |
+
timeWindow: 60000 # 1 minute
|
154 |
+
'POST /api/v1/mercenaries/fetch': # Server side fetch route (formerly /p) - POST
|
155 |
+
handler: 'fetch'
|
156 |
+
clientExport: 'fetch' # Auto register a client function in the client.api namespace
|
157 |
+
'/api/v1/mercenaries/integrations': # Server export of client routes
|
158 |
+
handler: 'integrations'
|
159 |
+
'/api/v1/mercenaries/components': # Server export of client routes
|
160 |
+
handler: 'components'
|
161 |
+
clientExport: 'components'
|
162 |
+
|
163 |
+
'/api/v1/mercenaries/extensions': # Get all extensions
|
164 |
+
handler: 'getExtensions'
|
165 |
+
|
166 |
+
'/api/v1/mercenaries/listen': # Server side listen route (sse)
|
167 |
+
handler: 'listen'
|
168 |
+
ignoreOnDevServer: true # unfortunately the vite dev server does not support SSE
|
169 |
+
# so we can't proxy this route
|
170 |
+
|
171 |
+
'POST /api/v1/mercenaries/runscript/:script' :
|
172 |
+
handler: runscript
|
173 |
+
'GET /api/v1/mercenaries/runscript/:script' :
|
174 |
+
handler: runscript
|
175 |
+
|
176 |
+
'GET /api/v1/mercenaries/user/requiredKeys':
|
177 |
+
handler: 'getRequiredKeys'
|
178 |
+
clientExport: 'getRequiredKeys'
|
179 |
+
|
180 |
+
'POST /api/v1/mercenaries/user/key':
|
181 |
+
handler: 'setUserKey'
|
182 |
+
clientExport: 'setUserKey'
|
183 |
+
'DELETE /api/v1/mercenaries/user/key':
|
184 |
+
handler: 'revokeUserKey'
|
185 |
+
clientExport: 'revokeUserKey'
|
186 |
+
'GET /api/v1/mercenaries/user/keys':
|
187 |
+
handler: 'listUserKeys'
|
188 |
+
clientExport: 'listUserKeys'
|
189 |
+
'POST /api/v1/mercenaries/user/keys/bulkAdd':
|
190 |
+
handler: 'bulkAddUserKeys'
|
191 |
+
|
192 |
+
|
193 |
+
auth: # Authentication and user related routes
|
194 |
+
kvStorage:
|
195 |
+
dbPath: './data.local/db'
|
196 |
+
dbName: 'auth.db'
|
197 |
+
routes:
|
198 |
+
'POST /api/v1/auth/login': # default username / pwd login
|
199 |
+
handler: login
|
200 |
+
authStrategy: local
|
201 |
+
'/api/v1/auth/autologin': # auto login : cloudflare , pocketbase single user
|
202 |
+
handler: login
|
203 |
+
authStrategy: ['cloudflare', 'pb_admin']
|
204 |
+
'POST /api/v1/auth/logout': # destroy session
|
205 |
+
handler: logout
|
206 |
+
'/api/v1/auth/user': # Get authenticated user info
|
207 |
+
handler: getAuthenticatedUser
|
208 |
+
'POST /api/v1/auth/token': # Generate token
|
209 |
+
handler: generateToken
|
210 |
+
'POST /api/v1/auth/accepttos':
|
211 |
+
handler: acceptTos
|
212 |
+
'GET /api/v1/auth/oauth2': # OAuth2.0
|
213 |
+
handler: oauth2
|
214 |
+
'GET /api/v1/auth/oauth2/:ns/callback': # OAuth2.0 callback
|
215 |
+
handler: oauth2Callback
|
216 |
+
|
217 |
+
chat:
|
218 |
+
routes:
|
219 |
+
'/api/v1/chat/:contextId': # Get associated chat history
|
220 |
+
handler: 'chatHistory'
|
221 |
+
clientExport: 'chatHistory'
|
222 |
+
|
223 |
+
'PUT /api/v1/chat/:contextId': # Append to persistent layer
|
224 |
+
handler: 'append'
|
225 |
+
clientExport: 'append'
|
226 |
+
|
227 |
+
'DELETE /api/v1/chat/:contextId': # Delete chat history
|
228 |
+
handler: 'clear'
|
229 |
+
clientExport: 'clear'
|
230 |
+
|
231 |
+
workflow: # Worklow related routes
|
232 |
+
routes:
|
233 |
+
'POST /api/v1/workflow/exec': # Execute a client workflow on the server
|
234 |
+
handler: 'exec'
|
235 |
+
clientExport: 'exec'
|
236 |
+
authStrategy: 'jwt'
|
237 |
+
|
238 |
+
'POST /api/v1/workflow/stop': # Stop all running workflows the user has access to
|
239 |
+
handler: 'stop'
|
240 |
+
clientExport: 'stop'
|
241 |
+
|
242 |
+
'/api/v1/workflow/workflows': # Get a users workflows
|
243 |
+
handler: 'getWorkflows'
|
244 |
+
clientExport: 'getWorkflows'
|
245 |
+
|
246 |
+
'/api/v1/workflow/workflowResults': # Get results for a workflow
|
247 |
+
handler: 'getWorkflowResults'
|
248 |
+
clientExport: 'getWorkflowResults'
|
249 |
+
|
250 |
+
'/api/v1/workflow/jobs': # Get a users running workflows (jobs)
|
251 |
+
handler: 'jobs'
|
252 |
+
clientExport: 'jobs'
|
253 |
+
|
254 |
+
'PUT /api/v1/workflow': # Update an existing workflow
|
255 |
+
handler: 'update'
|
256 |
+
clientExport: 'update'
|
257 |
+
|
258 |
+
'POST /api/v1/workflow': # Save/Create a new workflow
|
259 |
+
handler: 'create'
|
260 |
+
clientExport: 'create'
|
261 |
+
|
262 |
+
'POST /api/v1/workflow/clone': # Clone an existing workflow
|
263 |
+
handler: 'clone'
|
264 |
+
clientExport: 'clone'
|
265 |
+
|
266 |
+
'GET /api/v1/workflow/:workflowId/:version': # Load workflow from backend
|
267 |
+
handler: 'load'
|
268 |
+
clientExport: 'load'
|
269 |
+
|
270 |
+
'GET /api/v1/workflow/:workflowId': # Load the non-published version of a workflow
|
271 |
+
handler: 'load'
|
272 |
+
clientExport: 'load'
|
273 |
+
|
274 |
+
'DELETE /api/v1/workflow/:workflowId': # Delete a workflow
|
275 |
+
handler: 'deleteWorkflow'
|
276 |
+
clientExport: 'deleteWorkflow'
|
277 |
+
|
278 |
+
|
279 |
+
|
280 |
+
# Vite Configuration
|
281 |
+
vite:
|
282 |
+
# Configuration for the build visualizer plugin. Set to true or pass in the visualizer options
|
283 |
+
# https://github.com/btd/rollup-plugin-visualizer
|
284 |
+
visualizer:
|
285 |
+
open: false #whether or not to open statistics in a browser after build
|
286 |
+
gzipSize: true #whether to show the gzip size
|
287 |
+
template: 'treemap' # treemap, sunburst, network, list, raw-data
|
288 |
+
title: 'Mercenaries.ai Vite Build Statistics' # title for generated HTML
|
289 |
+
filename: 'stats.html'
|
290 |
+
|
291 |
+
# Additional API proxy routes
|
292 |
+
# Any route or proxy defined under server.integrations is automatically declared
|
293 |
+
# when vite.config.js builds the vite configuration
|
294 |
+
apiProxy:
|
295 |
+
'/t':
|
296 |
+
# not defining target: means use the address provided in the server.network section
|
297 |
+
# (this logic is implemented in vite.config.js)
|
298 |
+
changeOrigin: true
|
299 |
+
'/sets':
|
300 |
+
changeOrigin: true
|
301 |
+
|
302 |
+
'/fid':
|
303 |
+
changeOrigin: true
|
304 |
+
|
305 |
+
'/auth':
|
306 |
+
changeOrigin: true
|
307 |
+
|
308 |
+
'/img':
|
309 |
+
changeOrigin: true
|
.npmignore
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.DS_Store
|
2 |
+
.env.local
|
3 |
+
dist-ssr
|
4 |
+
*.local.*
|
5 |
+
.mercs.local.yaml
|
6 |
+
.vscode
|
7 |
+
*/etc/keystore/*
|
8 |
+
*/etc/registry/.cache/*
|
9 |
+
omni.zip
|
10 |
+
fossa*
|
11 |
+
|
12 |
+
tsconfig.tsbuildinfo
|
13 |
+
/**/*/public/t
|
14 |
+
/**/*/public/sets
|
15 |
+
stats.html
|
16 |
+
|
17 |
+
# Created by .ignore support plugin (hsz.mobi)
|
18 |
+
### JetBrains template
|
19 |
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
20 |
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
21 |
+
|
22 |
+
# User-specific stuff:
|
23 |
+
.idea/workspace.xml
|
24 |
+
.idea/tasks.xml
|
25 |
+
*/cache/**
|
26 |
+
./var/**
|
27 |
+
content/
|
28 |
+
docker-certs/
|
29 |
+
log.txt
|
30 |
+
/.yarn/*
|
31 |
+
/**/*/.yarn/install-state.gz
|
32 |
+
!.yarn/patches
|
33 |
+
!.yarn/releases
|
34 |
+
!.yarn/plugins
|
35 |
+
!.yarn/sdks
|
36 |
+
!.yarn/versions
|
37 |
+
.pnp.*
|
38 |
+
/etc/ssl/
|
39 |
+
tmp/
|
40 |
+
Untitled*.md
|
41 |
+
user_files/*
|
42 |
+
!user_files/USER_FILES_GO_HERE
|
43 |
+
!user_files/oobabooga_models_directory.json
|
44 |
+
!user_files/local_llms_directories.json
|
45 |
+
packages/omni-server/user_provided_models/*
|
46 |
+
!packages/omni-server/USER_PROVIDED_MODELS_GO_HERE
|
47 |
+
packages/omni-server/data.local/
|
48 |
+
!packages/omni-server/data.local/README.md
|
49 |
+
packages/omni-server/config.local/
|
50 |
+
!packages/omni-server/config.local/README.md
|
51 |
+
|
52 |
+
# package bundles
|
53 |
+
build
|
54 |
+
setup/updates
|
55 |
+
|
56 |
+
# transient packaging
|
57 |
+
/build
|
58 |
+
|
59 |
+
# Sensitive or high-churn files:
|
60 |
+
.idea/dataSources/
|
61 |
+
.idea/dataSources.ids
|
62 |
+
.idea/dataSources.xml
|
63 |
+
.idea/dataSources.local.xml
|
64 |
+
.idea/sqlDataSources.xml
|
65 |
+
.idea/dynamic.xml
|
66 |
+
.idea/uiDesigner.xml
|
67 |
+
|
68 |
+
|
69 |
+
# Gradle:
|
70 |
+
.idea/gradle.xml
|
71 |
+
.idea/libraries
|
72 |
+
./tmp/
|
73 |
+
# Mongo Explorer plugin:
|
74 |
+
.idea/mongoSettings.xml
|
75 |
+
|
76 |
+
## File-based project format:
|
77 |
+
*.iws
|
78 |
+
|
79 |
+
## Plugin-specific files:
|
80 |
+
|
81 |
+
# IntelliJ
|
82 |
+
/out/
|
83 |
+
|
84 |
+
# mpeltonen/sbt-idea plugin
|
85 |
+
.idea_modules/
|
86 |
+
|
87 |
+
# JIRA plugin
|
88 |
+
atlassian-ide-plugin.xml
|
89 |
+
|
90 |
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
91 |
+
com_crashlytics_export_strings.xml
|
92 |
+
crashlytics.properties
|
93 |
+
crashlytics-build.properties
|
94 |
+
fabric.properties
|
95 |
+
### Node template
|
96 |
+
# Logs
|
97 |
+
logs
|
98 |
+
*.log
|
99 |
+
npm-debug.log*
|
100 |
+
|
101 |
+
# Runtime data
|
102 |
+
pids
|
103 |
+
*.pid
|
104 |
+
*.seed
|
105 |
+
*.pid.lock
|
106 |
+
|
107 |
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
108 |
+
lib-cov
|
109 |
+
|
110 |
+
# Coverage directory used by tools like istanbul
|
111 |
+
coverage
|
112 |
+
|
113 |
+
# nyc test coverage
|
114 |
+
.nyc_output
|
115 |
+
|
116 |
+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
117 |
+
.grunt
|
118 |
+
|
119 |
+
# node-waf configuration
|
120 |
+
.lock-wscript
|
121 |
+
|
122 |
+
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
123 |
+
build/Release
|
124 |
+
|
125 |
+
# Dependency directories
|
126 |
+
node_modules
|
127 |
+
jspm_packages
|
128 |
+
|
129 |
+
# Optional npm cache directory
|
130 |
+
.npm
|
131 |
+
|
132 |
+
# Optional eslint cache
|
133 |
+
.eslintcache
|
134 |
+
|
135 |
+
# Optional REPL history
|
136 |
+
.node_repl_history
|
137 |
+
|
138 |
+
# Output of 'npm pack'
|
139 |
+
*.tgz
|
140 |
+
|
141 |
+
# Yarn Integrity file
|
142 |
+
.yarn-integrity
|
143 |
+
|
144 |
+
.idea/
|
145 |
+
#.idea/watcherTasks.xml
|
146 |
+
.DS_Store
|
147 |
+
.env.local
|
148 |
+
server.local
|
149 |
+
~$*
|
150 |
+
/public/js/app.js
|
151 |
+
/public/js/app.js.map
|
152 |
+
/public/**/*.map
|
153 |
+
/webapp/public/js
|
154 |
+
.parcel-cache/
|
155 |
+
/docs/
|
156 |
+
/public/
|
157 |
+
config.yaml.local
|
158 |
+
/assets.local/
|
159 |
+
/assets.local2/
|
160 |
+
*.code-workspace
|
161 |
+
etc.local/
|
162 |
+
keystore.local.yaml
|
.prettierignore
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.mjs
|
2 |
+
*.cjs
|
3 |
+
packages/**/*.js
|
4 |
+
*.d.ts
|
5 |
+
*.map.ts
|
6 |
+
**/dist/**
|
7 |
+
**/lib/**
|
8 |
+
*.hbs
|
9 |
+
*.md
|
10 |
+
**/omni-server/public/**
|
11 |
+
**/omni-server/extensions/**
|
.prettierrc
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"tabWidth": 2,
|
3 |
+
"useTabs": false,
|
4 |
+
"printWidth": 120,
|
5 |
+
"singleQuote": true,
|
6 |
+
"bracketSameLine": true,
|
7 |
+
"trailingComma": "none",
|
8 |
+
"endOfLine": "auto"
|
9 |
+
}
|
.yarn/plugins/@yarnpkg/plugin-engines.cjs
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* eslint-disable */
|
2 |
+
//prettier-ignore
|
3 |
+
module.exports = {
|
4 |
+
name: "@yarnpkg/plugin-engines",
|
5 |
+
factory: function (require) {
|
6 |
+
var plugin=(()=>{var P=Object.create,f=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var b=n=>f(n,"__esModule",{value:!0});var i=n=>{if(typeof require!="undefined")return require(n);throw new Error('Dynamic require of "'+n+'" is not supported')};var T=(n,e)=>{for(var r in e)f(n,r,{get:e[r],enumerable:!0})},V=(n,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of N(e))!Y.call(n,t)&&t!=="default"&&f(n,t,{get:()=>e[t],enumerable:!(r=R(e,t))||r.enumerable});return n},s=n=>V(b(f(n!=null?P(j(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var U={};T(U,{default:()=>q});var o=s(i("@yarnpkg/core")),c;(function(r){r.Yarn="Yarn",r.Console="Console"})(c||(c={}));var h=class{constructor(e){this.throwWrongEngineError=(e,r)=>{let t=this.formatErrorMessage(e,r);this.throwError(t)};this.throwError=e=>{switch(this.errorReporter){case c.Yarn:this.reportYarnError(e);break;case c.Console:default:this.reportConsoleError(e);break}};this.reportYarnError=e=>{throw new o.ReportError(o.MessageName.UNNAMED,e)};this.reportConsoleError=e=>{console.error(e),process.exit(1)};this.formatErrorMessage=(e,r)=>{let{configuration:t}=this.project,p=o.formatUtils.applyStyle(t,o.formatUtils.pretty(t,this.engine,"green"),2),g=o.formatUtils.pretty(t,e,"cyan"),d=o.formatUtils.pretty(t,r,"cyan"),w=`The current ${p} version ${g} does not satisfy the required version ${d}.`;return o.formatUtils.pretty(t,w,"red")};this.project=e.project,this.errorReporter=e.errorReporter}};var m=s(i("fs")),y=s(i("path")),l=s(i("semver")),k=s(i("@yarnpkg/fslib")),a=s(i("@yarnpkg/core"));var v=class extends h{constructor(){super(...arguments);this.resolveNvmRequiredVersion=()=>{let{configuration:e,cwd:r}=this.project,t=(0,y.resolve)(k.npath.fromPortablePath(r),".nvmrc"),p=a.formatUtils.applyStyle(e,a.formatUtils.pretty(e,this.engine,"green"),2);if(!(0,m.existsSync)(t)){this.throwError(a.formatUtils.pretty(e,`Unable to verify the ${p} version. The .nvmrc file does not exist.`,"red"));return}let g=(0,m.readFileSync)(t,"utf-8").trim();if((0,l.validRange)(g))return g;let d=a.formatUtils.pretty(e,".nvmrc","yellow");this.throwError(a.formatUtils.pretty(e,`Unable to verify the ${p} version. The ${d} file contains an invalid semver range.`,"red"))}}get engine(){return"Node"}verifyEngine(e){let r=e.node;r!=null&&(r===".nvmrc"&&(r=this.resolveNvmRequiredVersion()),(0,l.satisfies)(process.version,r,{includePrerelease:!0})||this.throwWrongEngineError(process.version.replace(/^v/i,""),r.replace(/^v/i,"")))}};var x=s(i("semver")),E=s(i("@yarnpkg/core"));var u=class extends h{get engine(){return"Yarn"}verifyEngine(e){let r=e.yarn;r!=null&&((0,x.satisfies)(E.YarnVersion,r,{includePrerelease:!0})||this.throwWrongEngineError(E.YarnVersion,r))}};var C=n=>e=>{if(process.env.PLUGIN_YARN_ENGINES_DISABLE!=null)return;let{engines:r={}}=e.getWorkspaceByCwd(e.cwd).manifest.raw,t={project:e,errorReporter:n};[new v(t),new u(t)].forEach(g=>g.verifyEngine(r))},S={hooks:{validateProject:C(c.Yarn),setupScriptEnvironment:C(c.Console)}},q=S;return U;})();
|
7 |
+
return plugin;
|
8 |
+
}
|
9 |
+
};
|
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
ADDED
The diff for this file is too large to render.
See raw diff
|
|
.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* eslint-disable */
|
2 |
+
//prettier-ignore
|
3 |
+
module.exports = {
|
4 |
+
name: "@yarnpkg/plugin-workspace-tools",
|
5 |
+
factory: function (require) {
|
6 |
+
var plugin=(()=>{var _r=Object.create;var we=Object.defineProperty;var Er=Object.getOwnPropertyDescriptor;var br=Object.getOwnPropertyNames;var xr=Object.getPrototypeOf,Cr=Object.prototype.hasOwnProperty;var W=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var q=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),wr=(e,r)=>{for(var t in r)we(e,t,{get:r[t],enumerable:!0})},Je=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of br(r))!Cr.call(e,s)&&s!==t&&we(e,s,{get:()=>r[s],enumerable:!(n=Er(r,s))||n.enumerable});return e};var Be=(e,r,t)=>(t=e!=null?_r(xr(e)):{},Je(r||!e||!e.__esModule?we(t,"default",{value:e,enumerable:!0}):t,e)),Sr=e=>Je(we({},"__esModule",{value:!0}),e);var ve=q(ee=>{"use strict";ee.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1;ee.find=(e,r)=>e.nodes.find(t=>t.type===r);ee.exceedsLimit=(e,r,t=1,n)=>n===!1||!ee.isInteger(e)||!ee.isInteger(r)?!1:(Number(r)-Number(e))/Number(t)>=n;ee.escapeNode=(e,r=0,t)=>{let n=e.nodes[r];!n||(t&&n.type===t||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};ee.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0===0?(e.invalid=!0,!0):!1;ee.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0===0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1;ee.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0;ee.reduce=e=>e.reduce((r,t)=>(t.type==="text"&&r.push(t.value),t.type==="range"&&(t.type="text"),r),[]);ee.flatten=(...e)=>{let r=[],t=n=>{for(let s=0;s<n.length;s++){let i=n[s];Array.isArray(i)?t(i,r):i!==void 0&&r.push(i)}return r};return t(e),r}});var He=q((Vn,rt)=>{"use strict";var tt=ve();rt.exports=(e,r={})=>{let t=(n,s={})=>{let i=r.escapeInvalid&&tt.isInvalidBrace(s),a=n.invalid===!0&&r.escapeInvalid===!0,c="";if(n.value)return(i||a)&&tt.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let p of n.nodes)c+=t(p);return c};return t(e)}});var st=q((Jn,nt)=>{"use strict";nt.exports=function(e){return typeof e=="number"?e-e===0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}});var ht=q((es,pt)=>{"use strict";var at=st(),le=(e,r,t)=>{if(at(e)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(r===void 0||e===r)return String(e);if(at(r)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...t};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let s=String(n.relaxZeros),i=String(n.shorthand),a=String(n.capture),c=String(n.wrap),p=e+":"+r+"="+s+i+a+c;if(le.cache.hasOwnProperty(p))return le.cache[p].result;let m=Math.min(e,r),h=Math.max(e,r);if(Math.abs(m-h)===1){let y=e+"|"+r;return n.capture?`(${y})`:n.wrap===!1?y:`(?:${y})`}let R=ft(e)||ft(r),f={min:e,max:r,a:m,b:h},$=[],_=[];if(R&&(f.isPadded=R,f.maxLen=String(f.max).length),m<0){let y=h<0?Math.abs(h):1;_=it(y,Math.abs(m),f,n),m=f.a=0}return h>=0&&($=it(m,h,f,n)),f.negatives=_,f.positives=$,f.result=vr(_,$,n),n.capture===!0?f.result=`(${f.result})`:n.wrap!==!1&&$.length+_.length>1&&(f.result=`(?:${f.result})`),le.cache[p]=f,f.result};function vr(e,r,t){let n=Me(e,r,"-",!1,t)||[],s=Me(r,e,"",!1,t)||[],i=Me(e,r,"-?",!0,t)||[];return n.concat(i).concat(s).join("|")}function Hr(e,r){let t=1,n=1,s=ut(e,t),i=new Set([r]);for(;e<=s&&s<=r;)i.add(s),t+=1,s=ut(e,t);for(s=ct(r+1,n)-1;e<s&&s<=r;)i.add(s),n+=1,s=ct(r+1,n)-1;return i=[...i],i.sort(kr),i}function $r(e,r,t){if(e===r)return{pattern:e,count:[],digits:0};let n=Tr(e,r),s=n.length,i="",a=0;for(let c=0;c<s;c++){let[p,m]=n[c];p===m?i+=p:p!=="0"||m!=="9"?i+=Lr(p,m,t):a++}return a&&(i+=t.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:s}}function it(e,r,t,n){let s=Hr(e,r),i=[],a=e,c;for(let p=0;p<s.length;p++){let m=s[p],h=$r(String(a),String(m),n),R="";if(!t.isPadded&&c&&c.pattern===h.pattern){c.count.length>1&&c.count.pop(),c.count.push(h.count[0]),c.string=c.pattern+lt(c.count),a=m+1;continue}t.isPadded&&(R=Or(m,t,n)),h.string=R+h.pattern+lt(h.count),i.push(h),a=m+1,c=h}return i}function Me(e,r,t,n,s){let i=[];for(let a of e){let{string:c}=a;!n&&!ot(r,"string",c)&&i.push(t+c),n&&ot(r,"string",c)&&i.push(t+c)}return i}function Tr(e,r){let t=[];for(let n=0;n<e.length;n++)t.push([e[n],r[n]]);return t}function kr(e,r){return e>r?1:r>e?-1:0}function ot(e,r,t){return e.some(n=>n[r]===t)}function ut(e,r){return Number(String(e).slice(0,-r)+"9".repeat(r))}function ct(e,r){return e-e%Math.pow(10,r)}function lt(e){let[r=0,t=""]=e;return t||r>1?`{${r+(t?","+t:"")}}`:""}function Lr(e,r,t){return`[${e}${r-e===1?"":"-"}${r}]`}function ft(e){return/^-?(0+)\d/.test(e)}function Or(e,r,t){if(!r.isPadded)return e;let n=Math.abs(r.maxLen-String(e).length),s=t.relaxZeros!==!1;switch(n){case 0:return"";case 1:return s?"0?":"0";case 2:return s?"0{0,2}":"00";default:return s?`0{0,${n}}`:`0{${n}}`}}le.cache={};le.clearCache=()=>le.cache={};pt.exports=le});var Ue=q((ts,Et)=>{"use strict";var Nr=W("util"),At=ht(),dt=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Ir=e=>r=>e===!0?Number(r):String(r),Pe=e=>typeof e=="number"||typeof e=="string"&&e!=="",Ae=e=>Number.isInteger(+e),De=e=>{let r=`${e}`,t=-1;if(r[0]==="-"&&(r=r.slice(1)),r==="0")return!1;for(;r[++t]==="0";);return t>0},Br=(e,r,t)=>typeof e=="string"||typeof r=="string"?!0:t.stringify===!0,Mr=(e,r,t)=>{if(r>0){let n=e[0]==="-"?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?r-1:r,"0")}return t===!1?String(e):e},gt=(e,r)=>{let t=e[0]==="-"?"-":"";for(t&&(e=e.slice(1),r--);e.length<r;)e="0"+e;return t?"-"+e:e},Pr=(e,r)=>{e.negatives.sort((a,c)=>a<c?-1:a>c?1:0),e.positives.sort((a,c)=>a<c?-1:a>c?1:0);let t=r.capture?"":"?:",n="",s="",i;return e.positives.length&&(n=e.positives.join("|")),e.negatives.length&&(s=`-(${t}${e.negatives.join("|")})`),n&&s?i=`${n}|${s}`:i=n||s,r.wrap?`(${t}${i})`:i},mt=(e,r,t,n)=>{if(t)return At(e,r,{wrap:!1,...n});let s=String.fromCharCode(e);if(e===r)return s;let i=String.fromCharCode(r);return`[${s}-${i}]`},Rt=(e,r,t)=>{if(Array.isArray(e)){let n=t.wrap===!0,s=t.capture?"":"?:";return n?`(${s}${e.join("|")})`:e.join("|")}return At(e,r,t)},yt=(...e)=>new RangeError("Invalid range arguments: "+Nr.inspect(...e)),_t=(e,r,t)=>{if(t.strictRanges===!0)throw yt([e,r]);return[]},Dr=(e,r)=>{if(r.strictRanges===!0)throw new TypeError(`Expected step "${e}" to be a number`);return[]},Ur=(e,r,t=1,n={})=>{let s=Number(e),i=Number(r);if(!Number.isInteger(s)||!Number.isInteger(i)){if(n.strictRanges===!0)throw yt([e,r]);return[]}s===0&&(s=0),i===0&&(i=0);let a=s>i,c=String(e),p=String(r),m=String(t);t=Math.max(Math.abs(t),1);let h=De(c)||De(p)||De(m),R=h?Math.max(c.length,p.length,m.length):0,f=h===!1&&Br(e,r,n)===!1,$=n.transform||Ir(f);if(n.toRegex&&t===1)return mt(gt(e,R),gt(r,R),!0,n);let _={negatives:[],positives:[]},y=T=>_[T<0?"negatives":"positives"].push(Math.abs(T)),E=[],S=0;for(;a?s>=i:s<=i;)n.toRegex===!0&&t>1?y(s):E.push(Mr($(s,S),R,f)),s=a?s-t:s+t,S++;return n.toRegex===!0?t>1?Pr(_,n):Rt(E,null,{wrap:!1,...n}):E},Gr=(e,r,t=1,n={})=>{if(!Ae(e)&&e.length>1||!Ae(r)&&r.length>1)return _t(e,r,n);let s=n.transform||(f=>String.fromCharCode(f)),i=`${e}`.charCodeAt(0),a=`${r}`.charCodeAt(0),c=i>a,p=Math.min(i,a),m=Math.max(i,a);if(n.toRegex&&t===1)return mt(p,m,!1,n);let h=[],R=0;for(;c?i>=a:i<=a;)h.push(s(i,R)),i=c?i-t:i+t,R++;return n.toRegex===!0?Rt(h,null,{wrap:!1,options:n}):h},$e=(e,r,t,n={})=>{if(r==null&&Pe(e))return[e];if(!Pe(e)||!Pe(r))return _t(e,r,n);if(typeof t=="function")return $e(e,r,1,{transform:t});if(dt(t))return $e(e,r,0,t);let s={...n};return s.capture===!0&&(s.wrap=!0),t=t||s.step||1,Ae(t)?Ae(e)&&Ae(r)?Ur(e,r,t,s):Gr(e,r,Math.max(Math.abs(t),1),s):t!=null&&!dt(t)?Dr(t,s):$e(e,r,1,t)};Et.exports=$e});var Ct=q((rs,xt)=>{"use strict";var qr=Ue(),bt=ve(),Kr=(e,r={})=>{let t=(n,s={})=>{let i=bt.isInvalidBrace(s),a=n.invalid===!0&&r.escapeInvalid===!0,c=i===!0||a===!0,p=r.escapeInvalid===!0?"\\":"",m="";if(n.isOpen===!0||n.isClose===!0)return p+n.value;if(n.type==="open")return c?p+n.value:"(";if(n.type==="close")return c?p+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":c?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let h=bt.reduce(n.nodes),R=qr(...h,{...r,wrap:!1,toRegex:!0});if(R.length!==0)return h.length>1&&R.length>1?`(${R})`:R}if(n.nodes)for(let h of n.nodes)m+=t(h,n);return m};return t(e)};xt.exports=Kr});var vt=q((ns,St)=>{"use strict";var Wr=Ue(),wt=He(),he=ve(),fe=(e="",r="",t=!1)=>{let n=[];if(e=[].concat(e),r=[].concat(r),!r.length)return e;if(!e.length)return t?he.flatten(r).map(s=>`{${s}}`):r;for(let s of e)if(Array.isArray(s))for(let i of s)n.push(fe(i,r,t));else for(let i of r)t===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?fe(s,i,t):s+i);return he.flatten(n)},jr=(e,r={})=>{let t=r.rangeLimit===void 0?1e3:r.rangeLimit,n=(s,i={})=>{s.queue=[];let a=i,c=i.queue;for(;a.type!=="brace"&&a.type!=="root"&&a.parent;)a=a.parent,c=a.queue;if(s.invalid||s.dollar){c.push(fe(c.pop(),wt(s,r)));return}if(s.type==="brace"&&s.invalid!==!0&&s.nodes.length===2){c.push(fe(c.pop(),["{}"]));return}if(s.nodes&&s.ranges>0){let R=he.reduce(s.nodes);if(he.exceedsLimit(...R,r.step,t))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=Wr(...R,r);f.length===0&&(f=wt(s,r)),c.push(fe(c.pop(),f)),s.nodes=[];return}let p=he.encloseBrace(s),m=s.queue,h=s;for(;h.type!=="brace"&&h.type!=="root"&&h.parent;)h=h.parent,m=h.queue;for(let R=0;R<s.nodes.length;R++){let f=s.nodes[R];if(f.type==="comma"&&s.type==="brace"){R===1&&m.push(""),m.push("");continue}if(f.type==="close"){c.push(fe(c.pop(),m,p));continue}if(f.value&&f.type!=="open"){m.push(fe(m.pop(),f.value));continue}f.nodes&&n(f,s)}return m};return he.flatten(n(e))};St.exports=jr});var $t=q((ss,Ht)=>{"use strict";Ht.exports={MAX_LENGTH:1024*64,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
7 |
+
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Nt=q((as,Ot)=>{"use strict";var Fr=He(),{MAX_LENGTH:Tt,CHAR_BACKSLASH:Ge,CHAR_BACKTICK:Qr,CHAR_COMMA:Xr,CHAR_DOT:Zr,CHAR_LEFT_PARENTHESES:Yr,CHAR_RIGHT_PARENTHESES:zr,CHAR_LEFT_CURLY_BRACE:Vr,CHAR_RIGHT_CURLY_BRACE:Jr,CHAR_LEFT_SQUARE_BRACKET:kt,CHAR_RIGHT_SQUARE_BRACKET:Lt,CHAR_DOUBLE_QUOTE:en,CHAR_SINGLE_QUOTE:tn,CHAR_NO_BREAK_SPACE:rn,CHAR_ZERO_WIDTH_NOBREAK_SPACE:nn}=$t(),sn=(e,r={})=>{if(typeof e!="string")throw new TypeError("Expected a string");let t=r||{},n=typeof t.maxLength=="number"?Math.min(Tt,t.maxLength):Tt;if(e.length>n)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${n})`);let s={type:"root",input:e,nodes:[]},i=[s],a=s,c=s,p=0,m=e.length,h=0,R=0,f,$={},_=()=>e[h++],y=E=>{if(E.type==="text"&&c.type==="dot"&&(c.type="text"),c&&c.type==="text"&&E.type==="text"){c.value+=E.value;return}return a.nodes.push(E),E.parent=a,E.prev=c,c=E,E};for(y({type:"bos"});h<m;)if(a=i[i.length-1],f=_(),!(f===nn||f===rn)){if(f===Ge){y({type:"text",value:(r.keepEscaping?f:"")+_()});continue}if(f===Lt){y({type:"text",value:"\\"+f});continue}if(f===kt){p++;let E=!0,S;for(;h<m&&(S=_());){if(f+=S,S===kt){p++;continue}if(S===Ge){f+=_();continue}if(S===Lt&&(p--,p===0))break}y({type:"text",value:f});continue}if(f===Yr){a=y({type:"paren",nodes:[]}),i.push(a),y({type:"text",value:f});continue}if(f===zr){if(a.type!=="paren"){y({type:"text",value:f});continue}a=i.pop(),y({type:"text",value:f}),a=i[i.length-1];continue}if(f===en||f===tn||f===Qr){let E=f,S;for(r.keepQuotes!==!0&&(f="");h<m&&(S=_());){if(S===Ge){f+=S+_();continue}if(S===E){r.keepQuotes===!0&&(f+=S);break}f+=S}y({type:"text",value:f});continue}if(f===Vr){R++;let E=c.value&&c.value.slice(-1)==="$"||a.dollar===!0;a=y({type:"brace",open:!0,close:!1,dollar:E,depth:R,commas:0,ranges:0,nodes:[]}),i.push(a),y({type:"open",value:f});continue}if(f===Jr){if(a.type!=="brace"){y({type:"text",value:f});continue}let E="close";a=i.pop(),a.close=!0,y({type:E,value:f}),R--,a=i[i.length-1];continue}if(f===Xr&&R>0){if(a.ranges>0){a.ranges=0;let E=a.nodes.shift();a.nodes=[E,{type:"text",value:Fr(a)}]}y({type:"comma",value:f}),a.commas++;continue}if(f===Zr&&R>0&&a.commas===0){let E=a.nodes;if(R===0||E.length===0){y({type:"text",value:f});continue}if(c.type==="dot"){if(a.range=[],c.value+=f,c.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,c.type="text";continue}a.ranges++,a.args=[];continue}if(c.type==="range"){E.pop();let S=E[E.length-1];S.value+=c.value+f,c=S,a.ranges--;continue}y({type:"dot",value:f});continue}y({type:"text",value:f})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(T=>{T.nodes||(T.type==="open"&&(T.isOpen=!0),T.type==="close"&&(T.isClose=!0),T.nodes||(T.type="text"),T.invalid=!0)});let E=i[i.length-1],S=E.nodes.indexOf(a);E.nodes.splice(S,1,...a.nodes)}while(i.length>0);return y({type:"eos"}),s};Ot.exports=sn});var Mt=q((is,Bt)=>{"use strict";var It=He(),an=Ct(),on=vt(),un=Nt(),X=(e,r={})=>{let t=[];if(Array.isArray(e))for(let n of e){let s=X.create(n,r);Array.isArray(s)?t.push(...s):t.push(s)}else t=[].concat(X.create(e,r));return r&&r.expand===!0&&r.nodupes===!0&&(t=[...new Set(t)]),t};X.parse=(e,r={})=>un(e,r);X.stringify=(e,r={})=>It(typeof e=="string"?X.parse(e,r):e,r);X.compile=(e,r={})=>(typeof e=="string"&&(e=X.parse(e,r)),an(e,r));X.expand=(e,r={})=>{typeof e=="string"&&(e=X.parse(e,r));let t=on(e,r);return r.noempty===!0&&(t=t.filter(Boolean)),r.nodupes===!0&&(t=[...new Set(t)]),t};X.create=(e,r={})=>e===""||e.length<3?[e]:r.expand!==!0?X.compile(e,r):X.expand(e,r);Bt.exports=X});var me=q((os,qt)=>{"use strict";var cn=W("path"),se="\\\\/",Pt=`[^${se}]`,ie="\\.",ln="\\+",fn="\\?",Te="\\/",pn="(?=.)",Dt="[^/]",qe=`(?:${Te}|$)`,Ut=`(?:^|${Te})`,Ke=`${ie}{1,2}${qe}`,hn=`(?!${ie})`,dn=`(?!${Ut}${Ke})`,gn=`(?!${ie}{0,1}${qe})`,An=`(?!${Ke})`,mn=`[^.${Te}]`,Rn=`${Dt}*?`,Gt={DOT_LITERAL:ie,PLUS_LITERAL:ln,QMARK_LITERAL:fn,SLASH_LITERAL:Te,ONE_CHAR:pn,QMARK:Dt,END_ANCHOR:qe,DOTS_SLASH:Ke,NO_DOT:hn,NO_DOTS:dn,NO_DOT_SLASH:gn,NO_DOTS_SLASH:An,QMARK_NO_DOT:mn,STAR:Rn,START_ANCHOR:Ut},yn={...Gt,SLASH_LITERAL:`[${se}]`,QMARK:Pt,STAR:`${Pt}*?`,DOTS_SLASH:`${ie}{1,2}(?:[${se}]|$)`,NO_DOT:`(?!${ie})`,NO_DOTS:`(?!(?:^|[${se}])${ie}{1,2}(?:[${se}]|$))`,NO_DOT_SLASH:`(?!${ie}{0,1}(?:[${se}]|$))`,NO_DOTS_SLASH:`(?!${ie}{1,2}(?:[${se}]|$))`,QMARK_NO_DOT:`[^.${se}]`,START_ANCHOR:`(?:^|[${se}])`,END_ANCHOR:`(?:[${se}]|$)`},_n={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};qt.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:_n,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:cn.sep,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?yn:Gt}}});var Re=q(F=>{"use strict";var En=W("path"),bn=process.platform==="win32",{REGEX_BACKSLASH:xn,REGEX_REMOVE_BACKSLASH:Cn,REGEX_SPECIAL_CHARS:wn,REGEX_SPECIAL_CHARS_GLOBAL:Sn}=me();F.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);F.hasRegexChars=e=>wn.test(e);F.isRegexChar=e=>e.length===1&&F.hasRegexChars(e);F.escapeRegex=e=>e.replace(Sn,"\\$1");F.toPosixSlashes=e=>e.replace(xn,"/");F.removeBackslashes=e=>e.replace(Cn,r=>r==="\\"?"":r);F.supportsLookbehinds=()=>{let e=process.version.slice(1).split(".").map(Number);return e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10};F.isWindows=e=>e&&typeof e.windows=="boolean"?e.windows:bn===!0||En.sep==="\\";F.escapeLast=(e,r,t)=>{let n=e.lastIndexOf(r,t);return n===-1?e:e[n-1]==="\\"?F.escapeLast(e,r,n-1):`${e.slice(0,n)}\\${e.slice(n)}`};F.removePrefix=(e,r={})=>{let t=e;return t.startsWith("./")&&(t=t.slice(2),r.prefix="./"),t};F.wrapOutput=(e,r={},t={})=>{let n=t.contains?"":"^",s=t.contains?"":"$",i=`${n}(?:${e})${s}`;return r.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var Yt=q((cs,Zt)=>{"use strict";var Kt=Re(),{CHAR_ASTERISK:We,CHAR_AT:vn,CHAR_BACKWARD_SLASH:ye,CHAR_COMMA:Hn,CHAR_DOT:je,CHAR_EXCLAMATION_MARK:Fe,CHAR_FORWARD_SLASH:Xt,CHAR_LEFT_CURLY_BRACE:Qe,CHAR_LEFT_PARENTHESES:Xe,CHAR_LEFT_SQUARE_BRACKET:$n,CHAR_PLUS:Tn,CHAR_QUESTION_MARK:Wt,CHAR_RIGHT_CURLY_BRACE:kn,CHAR_RIGHT_PARENTHESES:jt,CHAR_RIGHT_SQUARE_BRACKET:Ln}=me(),Ft=e=>e===Xt||e===ye,Qt=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)},On=(e,r)=>{let t=r||{},n=e.length-1,s=t.parts===!0||t.scanToEnd===!0,i=[],a=[],c=[],p=e,m=-1,h=0,R=0,f=!1,$=!1,_=!1,y=!1,E=!1,S=!1,T=!1,L=!1,z=!1,I=!1,re=0,K,g,v={value:"",depth:0,isGlob:!1},k=()=>m>=n,l=()=>p.charCodeAt(m+1),H=()=>(K=g,p.charCodeAt(++m));for(;m<n;){g=H();let M;if(g===ye){T=v.backslashes=!0,g=H(),g===Qe&&(S=!0);continue}if(S===!0||g===Qe){for(re++;k()!==!0&&(g=H());){if(g===ye){T=v.backslashes=!0,H();continue}if(g===Qe){re++;continue}if(S!==!0&&g===je&&(g=H())===je){if(f=v.isBrace=!0,_=v.isGlob=!0,I=!0,s===!0)continue;break}if(S!==!0&&g===Hn){if(f=v.isBrace=!0,_=v.isGlob=!0,I=!0,s===!0)continue;break}if(g===kn&&(re--,re===0)){S=!1,f=v.isBrace=!0,I=!0;break}}if(s===!0)continue;break}if(g===Xt){if(i.push(m),a.push(v),v={value:"",depth:0,isGlob:!1},I===!0)continue;if(K===je&&m===h+1){h+=2;continue}R=m+1;continue}if(t.noext!==!0&&(g===Tn||g===vn||g===We||g===Wt||g===Fe)===!0&&l()===Xe){if(_=v.isGlob=!0,y=v.isExtglob=!0,I=!0,g===Fe&&m===h&&(z=!0),s===!0){for(;k()!==!0&&(g=H());){if(g===ye){T=v.backslashes=!0,g=H();continue}if(g===jt){_=v.isGlob=!0,I=!0;break}}continue}break}if(g===We){if(K===We&&(E=v.isGlobstar=!0),_=v.isGlob=!0,I=!0,s===!0)continue;break}if(g===Wt){if(_=v.isGlob=!0,I=!0,s===!0)continue;break}if(g===$n){for(;k()!==!0&&(M=H());){if(M===ye){T=v.backslashes=!0,H();continue}if(M===Ln){$=v.isBracket=!0,_=v.isGlob=!0,I=!0;break}}if(s===!0)continue;break}if(t.nonegate!==!0&&g===Fe&&m===h){L=v.negated=!0,h++;continue}if(t.noparen!==!0&&g===Xe){if(_=v.isGlob=!0,s===!0){for(;k()!==!0&&(g=H());){if(g===Xe){T=v.backslashes=!0,g=H();continue}if(g===jt){I=!0;break}}continue}break}if(_===!0){if(I=!0,s===!0)continue;break}}t.noext===!0&&(y=!1,_=!1);let w=p,B="",o="";h>0&&(B=p.slice(0,h),p=p.slice(h),R-=h),w&&_===!0&&R>0?(w=p.slice(0,R),o=p.slice(R)):_===!0?(w="",o=p):w=p,w&&w!==""&&w!=="/"&&w!==p&&Ft(w.charCodeAt(w.length-1))&&(w=w.slice(0,-1)),t.unescape===!0&&(o&&(o=Kt.removeBackslashes(o)),w&&T===!0&&(w=Kt.removeBackslashes(w)));let u={prefix:B,input:e,start:h,base:w,glob:o,isBrace:f,isBracket:$,isGlob:_,isExtglob:y,isGlobstar:E,negated:L,negatedExtglob:z};if(t.tokens===!0&&(u.maxDepth=0,Ft(g)||a.push(v),u.tokens=a),t.parts===!0||t.tokens===!0){let M;for(let b=0;b<i.length;b++){let V=M?M+1:h,J=i[b],Q=e.slice(V,J);t.tokens&&(b===0&&h!==0?(a[b].isPrefix=!0,a[b].value=B):a[b].value=Q,Qt(a[b]),u.maxDepth+=a[b].depth),(b!==0||Q!=="")&&c.push(Q),M=J}if(M&&M+1<e.length){let b=e.slice(M+1);c.push(b),t.tokens&&(a[a.length-1].value=b,Qt(a[a.length-1]),u.maxDepth+=a[a.length-1].depth)}u.slashes=i,u.parts=c}return u};Zt.exports=On});var er=q((ls,Jt)=>{"use strict";var ke=me(),Z=Re(),{MAX_LENGTH:Le,POSIX_REGEX_SOURCE:Nn,REGEX_NON_SPECIAL_CHARS:In,REGEX_SPECIAL_CHARS_BACKREF:Bn,REPLACEMENTS:zt}=ke,Mn=(e,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...e,r);e.sort();let t=`[${e.join("-")}]`;try{new RegExp(t)}catch{return e.map(s=>Z.escapeRegex(s)).join("..")}return t},de=(e,r)=>`Missing ${e}: "${r}" - use "\\\\${r}" to match literal characters`,Vt=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=zt[e]||e;let t={...r},n=typeof t.maxLength=="number"?Math.min(Le,t.maxLength):Le,s=e.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:t.prepend||""},a=[i],c=t.capture?"":"?:",p=Z.isWindows(r),m=ke.globChars(p),h=ke.extglobChars(m),{DOT_LITERAL:R,PLUS_LITERAL:f,SLASH_LITERAL:$,ONE_CHAR:_,DOTS_SLASH:y,NO_DOT:E,NO_DOT_SLASH:S,NO_DOTS_SLASH:T,QMARK:L,QMARK_NO_DOT:z,STAR:I,START_ANCHOR:re}=m,K=A=>`(${c}(?:(?!${re}${A.dot?y:R}).)*?)`,g=t.dot?"":E,v=t.dot?L:z,k=t.bash===!0?K(t):I;t.capture&&(k=`(${k})`),typeof t.noext=="boolean"&&(t.noextglob=t.noext);let l={input:e,index:-1,start:0,dot:t.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:a};e=Z.removePrefix(e,l),s=e.length;let H=[],w=[],B=[],o=i,u,M=()=>l.index===s-1,b=l.peek=(A=1)=>e[l.index+A],V=l.advance=()=>e[++l.index]||"",J=()=>e.slice(l.index+1),Q=(A="",O=0)=>{l.consumed+=A,l.index+=O},Ee=A=>{l.output+=A.output!=null?A.output:A.value,Q(A.value)},Rr=()=>{let A=1;for(;b()==="!"&&(b(2)!=="("||b(3)==="?");)V(),l.start++,A++;return A%2===0?!1:(l.negated=!0,l.start++,!0)},be=A=>{l[A]++,B.push(A)},oe=A=>{l[A]--,B.pop()},C=A=>{if(o.type==="globstar"){let O=l.braces>0&&(A.type==="comma"||A.type==="brace"),d=A.extglob===!0||H.length&&(A.type==="pipe"||A.type==="paren");A.type!=="slash"&&A.type!=="paren"&&!O&&!d&&(l.output=l.output.slice(0,-o.output.length),o.type="star",o.value="*",o.output=k,l.output+=o.output)}if(H.length&&A.type!=="paren"&&(H[H.length-1].inner+=A.value),(A.value||A.output)&&Ee(A),o&&o.type==="text"&&A.type==="text"){o.value+=A.value,o.output=(o.output||"")+A.value;return}A.prev=o,a.push(A),o=A},xe=(A,O)=>{let d={...h[O],conditions:1,inner:""};d.prev=o,d.parens=l.parens,d.output=l.output;let x=(t.capture?"(":"")+d.open;be("parens"),C({type:A,value:O,output:l.output?"":_}),C({type:"paren",extglob:!0,value:V(),output:x}),H.push(d)},yr=A=>{let O=A.close+(t.capture?")":""),d;if(A.type==="negate"){let x=k;A.inner&&A.inner.length>1&&A.inner.includes("/")&&(x=K(t)),(x!==k||M()||/^\)+$/.test(J()))&&(O=A.close=`)$))${x}`),A.inner.includes("*")&&(d=J())&&/^\.[^\\/.]+$/.test(d)&&(O=A.close=`)${d})${x})`),A.prev.type==="bos"&&(l.negatedExtglob=!0)}C({type:"paren",extglob:!0,value:u,output:O}),oe("parens")};if(t.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let A=!1,O=e.replace(Bn,(d,x,P,j,G,Ie)=>j==="\\"?(A=!0,d):j==="?"?x?x+j+(G?L.repeat(G.length):""):Ie===0?v+(G?L.repeat(G.length):""):L.repeat(P.length):j==="."?R.repeat(P.length):j==="*"?x?x+j+(G?k:""):k:x?d:`\\${d}`);return A===!0&&(t.unescape===!0?O=O.replace(/\\/g,""):O=O.replace(/\\+/g,d=>d.length%2===0?"\\\\":d?"\\":"")),O===e&&t.contains===!0?(l.output=e,l):(l.output=Z.wrapOutput(O,l,r),l)}for(;!M();){if(u=V(),u==="\0")continue;if(u==="\\"){let d=b();if(d==="/"&&t.bash!==!0||d==="."||d===";")continue;if(!d){u+="\\",C({type:"text",value:u});continue}let x=/^\\+/.exec(J()),P=0;if(x&&x[0].length>2&&(P=x[0].length,l.index+=P,P%2!==0&&(u+="\\")),t.unescape===!0?u=V():u+=V(),l.brackets===0){C({type:"text",value:u});continue}}if(l.brackets>0&&(u!=="]"||o.value==="["||o.value==="[^")){if(t.posix!==!1&&u===":"){let d=o.value.slice(1);if(d.includes("[")&&(o.posix=!0,d.includes(":"))){let x=o.value.lastIndexOf("["),P=o.value.slice(0,x),j=o.value.slice(x+2),G=Nn[j];if(G){o.value=P+G,l.backtrack=!0,V(),!i.output&&a.indexOf(o)===1&&(i.output=_);continue}}}(u==="["&&b()!==":"||u==="-"&&b()==="]")&&(u=`\\${u}`),u==="]"&&(o.value==="["||o.value==="[^")&&(u=`\\${u}`),t.posix===!0&&u==="!"&&o.value==="["&&(u="^"),o.value+=u,Ee({value:u});continue}if(l.quotes===1&&u!=='"'){u=Z.escapeRegex(u),o.value+=u,Ee({value:u});continue}if(u==='"'){l.quotes=l.quotes===1?0:1,t.keepQuotes===!0&&C({type:"text",value:u});continue}if(u==="("){be("parens"),C({type:"paren",value:u});continue}if(u===")"){if(l.parens===0&&t.strictBrackets===!0)throw new SyntaxError(de("opening","("));let d=H[H.length-1];if(d&&l.parens===d.parens+1){yr(H.pop());continue}C({type:"paren",value:u,output:l.parens?")":"\\)"}),oe("parens");continue}if(u==="["){if(t.nobracket===!0||!J().includes("]")){if(t.nobracket!==!0&&t.strictBrackets===!0)throw new SyntaxError(de("closing","]"));u=`\\${u}`}else be("brackets");C({type:"bracket",value:u});continue}if(u==="]"){if(t.nobracket===!0||o&&o.type==="bracket"&&o.value.length===1){C({type:"text",value:u,output:`\\${u}`});continue}if(l.brackets===0){if(t.strictBrackets===!0)throw new SyntaxError(de("opening","["));C({type:"text",value:u,output:`\\${u}`});continue}oe("brackets");let d=o.value.slice(1);if(o.posix!==!0&&d[0]==="^"&&!d.includes("/")&&(u=`/${u}`),o.value+=u,Ee({value:u}),t.literalBrackets===!1||Z.hasRegexChars(d))continue;let x=Z.escapeRegex(o.value);if(l.output=l.output.slice(0,-o.value.length),t.literalBrackets===!0){l.output+=x,o.value=x;continue}o.value=`(${c}${x}|${o.value})`,l.output+=o.value;continue}if(u==="{"&&t.nobrace!==!0){be("braces");let d={type:"brace",value:u,output:"(",outputIndex:l.output.length,tokensIndex:l.tokens.length};w.push(d),C(d);continue}if(u==="}"){let d=w[w.length-1];if(t.nobrace===!0||!d){C({type:"text",value:u,output:u});continue}let x=")";if(d.dots===!0){let P=a.slice(),j=[];for(let G=P.length-1;G>=0&&(a.pop(),P[G].type!=="brace");G--)P[G].type!=="dots"&&j.unshift(P[G].value);x=Mn(j,t),l.backtrack=!0}if(d.comma!==!0&&d.dots!==!0){let P=l.output.slice(0,d.outputIndex),j=l.tokens.slice(d.tokensIndex);d.value=d.output="\\{",u=x="\\}",l.output=P;for(let G of j)l.output+=G.output||G.value}C({type:"brace",value:u,output:x}),oe("braces"),w.pop();continue}if(u==="|"){H.length>0&&H[H.length-1].conditions++,C({type:"text",value:u});continue}if(u===","){let d=u,x=w[w.length-1];x&&B[B.length-1]==="braces"&&(x.comma=!0,d="|"),C({type:"comma",value:u,output:d});continue}if(u==="/"){if(o.type==="dot"&&l.index===l.start+1){l.start=l.index+1,l.consumed="",l.output="",a.pop(),o=i;continue}C({type:"slash",value:u,output:$});continue}if(u==="."){if(l.braces>0&&o.type==="dot"){o.value==="."&&(o.output=R);let d=w[w.length-1];o.type="dots",o.output+=u,o.value+=u,d.dots=!0;continue}if(l.braces+l.parens===0&&o.type!=="bos"&&o.type!=="slash"){C({type:"text",value:u,output:R});continue}C({type:"dot",value:u,output:R});continue}if(u==="?"){if(!(o&&o.value==="(")&&t.noextglob!==!0&&b()==="("&&b(2)!=="?"){xe("qmark",u);continue}if(o&&o.type==="paren"){let x=b(),P=u;if(x==="<"&&!Z.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(o.value==="("&&!/[!=<:]/.test(x)||x==="<"&&!/<([!=]|\w+>)/.test(J()))&&(P=`\\${u}`),C({type:"text",value:u,output:P});continue}if(t.dot!==!0&&(o.type==="slash"||o.type==="bos")){C({type:"qmark",value:u,output:z});continue}C({type:"qmark",value:u,output:L});continue}if(u==="!"){if(t.noextglob!==!0&&b()==="("&&(b(2)!=="?"||!/[!=<:]/.test(b(3)))){xe("negate",u);continue}if(t.nonegate!==!0&&l.index===0){Rr();continue}}if(u==="+"){if(t.noextglob!==!0&&b()==="("&&b(2)!=="?"){xe("plus",u);continue}if(o&&o.value==="("||t.regex===!1){C({type:"plus",value:u,output:f});continue}if(o&&(o.type==="bracket"||o.type==="paren"||o.type==="brace")||l.parens>0){C({type:"plus",value:u});continue}C({type:"plus",value:f});continue}if(u==="@"){if(t.noextglob!==!0&&b()==="("&&b(2)!=="?"){C({type:"at",extglob:!0,value:u,output:""});continue}C({type:"text",value:u});continue}if(u!=="*"){(u==="$"||u==="^")&&(u=`\\${u}`);let d=In.exec(J());d&&(u+=d[0],l.index+=d[0].length),C({type:"text",value:u});continue}if(o&&(o.type==="globstar"||o.star===!0)){o.type="star",o.star=!0,o.value+=u,o.output=k,l.backtrack=!0,l.globstar=!0,Q(u);continue}let A=J();if(t.noextglob!==!0&&/^\([^?]/.test(A)){xe("star",u);continue}if(o.type==="star"){if(t.noglobstar===!0){Q(u);continue}let d=o.prev,x=d.prev,P=d.type==="slash"||d.type==="bos",j=x&&(x.type==="star"||x.type==="globstar");if(t.bash===!0&&(!P||A[0]&&A[0]!=="/")){C({type:"star",value:u,output:""});continue}let G=l.braces>0&&(d.type==="comma"||d.type==="brace"),Ie=H.length&&(d.type==="pipe"||d.type==="paren");if(!P&&d.type!=="paren"&&!G&&!Ie){C({type:"star",value:u,output:""});continue}for(;A.slice(0,3)==="/**";){let Ce=e[l.index+4];if(Ce&&Ce!=="/")break;A=A.slice(3),Q("/**",3)}if(d.type==="bos"&&M()){o.type="globstar",o.value+=u,o.output=K(t),l.output=o.output,l.globstar=!0,Q(u);continue}if(d.type==="slash"&&d.prev.type!=="bos"&&!j&&M()){l.output=l.output.slice(0,-(d.output+o.output).length),d.output=`(?:${d.output}`,o.type="globstar",o.output=K(t)+(t.strictSlashes?")":"|$)"),o.value+=u,l.globstar=!0,l.output+=d.output+o.output,Q(u);continue}if(d.type==="slash"&&d.prev.type!=="bos"&&A[0]==="/"){let Ce=A[1]!==void 0?"|$":"";l.output=l.output.slice(0,-(d.output+o.output).length),d.output=`(?:${d.output}`,o.type="globstar",o.output=`${K(t)}${$}|${$}${Ce})`,o.value+=u,l.output+=d.output+o.output,l.globstar=!0,Q(u+V()),C({type:"slash",value:"/",output:""});continue}if(d.type==="bos"&&A[0]==="/"){o.type="globstar",o.value+=u,o.output=`(?:^|${$}|${K(t)}${$})`,l.output=o.output,l.globstar=!0,Q(u+V()),C({type:"slash",value:"/",output:""});continue}l.output=l.output.slice(0,-o.output.length),o.type="globstar",o.output=K(t),o.value+=u,l.output+=o.output,l.globstar=!0,Q(u);continue}let O={type:"star",value:u,output:k};if(t.bash===!0){O.output=".*?",(o.type==="bos"||o.type==="slash")&&(O.output=g+O.output),C(O);continue}if(o&&(o.type==="bracket"||o.type==="paren")&&t.regex===!0){O.output=u,C(O);continue}(l.index===l.start||o.type==="slash"||o.type==="dot")&&(o.type==="dot"?(l.output+=S,o.output+=S):t.dot===!0?(l.output+=T,o.output+=T):(l.output+=g,o.output+=g),b()!=="*"&&(l.output+=_,o.output+=_)),C(O)}for(;l.brackets>0;){if(t.strictBrackets===!0)throw new SyntaxError(de("closing","]"));l.output=Z.escapeLast(l.output,"["),oe("brackets")}for(;l.parens>0;){if(t.strictBrackets===!0)throw new SyntaxError(de("closing",")"));l.output=Z.escapeLast(l.output,"("),oe("parens")}for(;l.braces>0;){if(t.strictBrackets===!0)throw new SyntaxError(de("closing","}"));l.output=Z.escapeLast(l.output,"{"),oe("braces")}if(t.strictSlashes!==!0&&(o.type==="star"||o.type==="bracket")&&C({type:"maybe_slash",value:"",output:`${$}?`}),l.backtrack===!0){l.output="";for(let A of l.tokens)l.output+=A.output!=null?A.output:A.value,A.suffix&&(l.output+=A.suffix)}return l};Vt.fastpaths=(e,r)=>{let t={...r},n=typeof t.maxLength=="number"?Math.min(Le,t.maxLength):Le,s=e.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);e=zt[e]||e;let i=Z.isWindows(r),{DOT_LITERAL:a,SLASH_LITERAL:c,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOTS:R,NO_DOTS_SLASH:f,STAR:$,START_ANCHOR:_}=ke.globChars(i),y=t.dot?R:h,E=t.dot?f:h,S=t.capture?"":"?:",T={negated:!1,prefix:""},L=t.bash===!0?".*?":$;t.capture&&(L=`(${L})`);let z=g=>g.noglobstar===!0?L:`(${S}(?:(?!${_}${g.dot?m:a}).)*?)`,I=g=>{switch(g){case"*":return`${y}${p}${L}`;case".*":return`${a}${p}${L}`;case"*.*":return`${y}${L}${a}${p}${L}`;case"*/*":return`${y}${L}${c}${p}${E}${L}`;case"**":return y+z(t);case"**/*":return`(?:${y}${z(t)}${c})?${E}${p}${L}`;case"**/*.*":return`(?:${y}${z(t)}${c})?${E}${L}${a}${p}${L}`;case"**/.*":return`(?:${y}${z(t)}${c})?${a}${p}${L}`;default:{let v=/^(.*?)\.(\w+)$/.exec(g);if(!v)return;let k=I(v[1]);return k?k+a+v[2]:void 0}}},re=Z.removePrefix(e,T),K=I(re);return K&&t.strictSlashes!==!0&&(K+=`${c}?`),K};Jt.exports=Vt});var rr=q((fs,tr)=>{"use strict";var Pn=W("path"),Dn=Yt(),Ze=er(),Ye=Re(),Un=me(),Gn=e=>e&&typeof e=="object"&&!Array.isArray(e),D=(e,r,t=!1)=>{if(Array.isArray(e)){let h=e.map(f=>D(f,r,t));return f=>{for(let $ of h){let _=$(f);if(_)return _}return!1}}let n=Gn(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let s=r||{},i=Ye.isWindows(r),a=n?D.compileRe(e,r):D.makeRe(e,r,!1,!0),c=a.state;delete a.state;let p=()=>!1;if(s.ignore){let h={...r,ignore:null,onMatch:null,onResult:null};p=D(s.ignore,h,t)}let m=(h,R=!1)=>{let{isMatch:f,match:$,output:_}=D.test(h,a,r,{glob:e,posix:i}),y={glob:e,state:c,regex:a,posix:i,input:h,output:_,match:$,isMatch:f};return typeof s.onResult=="function"&&s.onResult(y),f===!1?(y.isMatch=!1,R?y:!1):p(h)?(typeof s.onIgnore=="function"&&s.onIgnore(y),y.isMatch=!1,R?y:!1):(typeof s.onMatch=="function"&&s.onMatch(y),R?y:!0)};return t&&(m.state=c),m};D.test=(e,r,t,{glob:n,posix:s}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let i=t||{},a=i.format||(s?Ye.toPosixSlashes:null),c=e===n,p=c&&a?a(e):e;return c===!1&&(p=a?a(e):e,c=p===n),(c===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?c=D.matchBase(e,r,t,s):c=r.exec(p)),{isMatch:Boolean(c),match:c,output:p}};D.matchBase=(e,r,t,n=Ye.isWindows(t))=>(r instanceof RegExp?r:D.makeRe(r,t)).test(Pn.basename(e));D.isMatch=(e,r,t)=>D(r,t)(e);D.parse=(e,r)=>Array.isArray(e)?e.map(t=>D.parse(t,r)):Ze(e,{...r,fastpaths:!1});D.scan=(e,r)=>Dn(e,r);D.compileRe=(e,r,t=!1,n=!1)=>{if(t===!0)return e.output;let s=r||{},i=s.contains?"":"^",a=s.contains?"":"$",c=`${i}(?:${e.output})${a}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let p=D.toRegex(c,r);return n===!0&&(p.state=e),p};D.makeRe=(e,r={},t=!1,n=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(s.output=Ze.fastpaths(e,r)),s.output||(s=Ze(e,r)),D.compileRe(s,r,t,n)};D.toRegex=(e,r)=>{try{let t=r||{};return new RegExp(e,t.flags||(t.nocase?"i":""))}catch(t){if(r&&r.debug===!0)throw t;return/$^/}};D.constants=Un;tr.exports=D});var sr=q((ps,nr)=>{"use strict";nr.exports=rr()});var cr=q((hs,ur)=>{"use strict";var ir=W("util"),or=Mt(),ae=sr(),ze=Re(),ar=e=>e===""||e==="./",N=(e,r,t)=>{r=[].concat(r),e=[].concat(e);let n=new Set,s=new Set,i=new Set,a=0,c=h=>{i.add(h.output),t&&t.onResult&&t.onResult(h)};for(let h=0;h<r.length;h++){let R=ae(String(r[h]),{...t,onResult:c},!0),f=R.state.negated||R.state.negatedExtglob;f&&a++;for(let $ of e){let _=R($,!0);!(f?!_.isMatch:_.isMatch)||(f?n.add(_.output):(n.delete(_.output),s.add(_.output)))}}let m=(a===r.length?[...i]:[...s]).filter(h=>!n.has(h));if(t&&m.length===0){if(t.failglob===!0)throw new Error(`No matches found for "${r.join(", ")}"`);if(t.nonull===!0||t.nullglob===!0)return t.unescape?r.map(h=>h.replace(/\\/g,"")):r}return m};N.match=N;N.matcher=(e,r)=>ae(e,r);N.isMatch=(e,r,t)=>ae(r,t)(e);N.any=N.isMatch;N.not=(e,r,t={})=>{r=[].concat(r).map(String);let n=new Set,s=[],a=N(e,r,{...t,onResult:c=>{t.onResult&&t.onResult(c),s.push(c.output)}});for(let c of s)a.includes(c)||n.add(c);return[...n]};N.contains=(e,r,t)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${ir.inspect(e)}"`);if(Array.isArray(r))return r.some(n=>N.contains(e,n,t));if(typeof r=="string"){if(ar(e)||ar(r))return!1;if(e.includes(r)||e.startsWith("./")&&e.slice(2).includes(r))return!0}return N.isMatch(e,r,{...t,contains:!0})};N.matchKeys=(e,r,t)=>{if(!ze.isObject(e))throw new TypeError("Expected the first argument to be an object");let n=N(Object.keys(e),r,t),s={};for(let i of n)s[i]=e[i];return s};N.some=(e,r,t)=>{let n=[].concat(e);for(let s of[].concat(r)){let i=ae(String(s),t);if(n.some(a=>i(a)))return!0}return!1};N.every=(e,r,t)=>{let n=[].concat(e);for(let s of[].concat(r)){let i=ae(String(s),t);if(!n.every(a=>i(a)))return!1}return!0};N.all=(e,r,t)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${ir.inspect(e)}"`);return[].concat(r).every(n=>ae(n,t)(e))};N.capture=(e,r,t)=>{let n=ze.isWindows(t),i=ae.makeRe(String(e),{...t,capture:!0}).exec(n?ze.toPosixSlashes(r):r);if(i)return i.slice(1).map(a=>a===void 0?"":a)};N.makeRe=(...e)=>ae.makeRe(...e);N.scan=(...e)=>ae.scan(...e);N.parse=(e,r)=>{let t=[];for(let n of[].concat(e||[]))for(let s of or(String(n),r))t.push(ae.parse(s,r));return t};N.braces=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");return r&&r.nobrace===!0||!/\{.*\}/.test(e)?[e]:or(e,r)};N.braceExpand=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a string");return N.braces(e,{...r,expand:!0})};ur.exports=N});var fr=q((ds,lr)=>{"use strict";lr.exports=(e,...r)=>new Promise(t=>{t(e(...r))})});var hr=q((gs,Ve)=>{"use strict";var qn=fr(),pr=e=>{if(e<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");let r=[],t=0,n=()=>{t--,r.length>0&&r.shift()()},s=(c,p,...m)=>{t++;let h=qn(c,...m);p(h),h.then(n,n)},i=(c,p,...m)=>{t<e?s(c,p,...m):r.push(s.bind(null,c,p,...m))},a=(c,...p)=>new Promise(m=>i(c,m,...p));return Object.defineProperties(a,{activeCount:{get:()=>t},pendingCount:{get:()=>r.length}}),a};Ve.exports=pr;Ve.exports.default=pr});var Fn={};wr(Fn,{default:()=>jn});var Se=W("@yarnpkg/cli"),ne=W("@yarnpkg/core"),et=W("@yarnpkg/core"),ue=W("clipanion"),ce=class extends Se.BaseCommand{constructor(){super(...arguments);this.json=ue.Option.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.production=ue.Option.Boolean("--production",!1,{description:"Only install regular dependencies by omitting dev dependencies"});this.all=ue.Option.Boolean("-A,--all",!1,{description:"Install the entire project"});this.workspaces=ue.Option.Rest()}async execute(){let t=await ne.Configuration.find(this.context.cwd,this.context.plugins),{project:n,workspace:s}=await ne.Project.find(t,this.context.cwd),i=await ne.Cache.find(t);await n.restoreInstallState({restoreResolutions:!1});let a;if(this.all)a=new Set(n.workspaces);else if(this.workspaces.length===0){if(!s)throw new Se.WorkspaceRequiredError(n.cwd,this.context.cwd);a=new Set([s])}else a=new Set(this.workspaces.map(p=>n.getWorkspaceByIdent(et.structUtils.parseIdent(p))));for(let p of a)for(let m of this.production?["dependencies"]:ne.Manifest.hardDependencies)for(let h of p.manifest.getForScope(m).values()){let R=n.tryWorkspaceByDescriptor(h);R!==null&&a.add(R)}for(let p of n.workspaces)a.has(p)?this.production&&p.manifest.devDependencies.clear():(p.manifest.installConfig=p.manifest.installConfig||{},p.manifest.installConfig.selfReferences=!1,p.manifest.dependencies.clear(),p.manifest.devDependencies.clear(),p.manifest.peerDependencies.clear(),p.manifest.scripts.clear());return(await ne.StreamReport.start({configuration:t,json:this.json,stdout:this.context.stdout,includeLogs:!0},async p=>{await n.install({cache:i,report:p,persistProject:!1})})).exitCode()}};ce.paths=[["workspaces","focus"]],ce.usage=ue.Command.Usage({category:"Workspace-related commands",description:"install a single workspace and its dependencies",details:"\n This command will run an install as if the specified workspaces (and all other workspaces they depend on) were the only ones in the project. If no workspaces are explicitly listed, the active one will be assumed.\n\n Note that this command is only very moderately useful when using zero-installs, since the cache will contain all the packages anyway - meaning that the only difference between a full install and a focused install would just be a few extra lines in the `.pnp.cjs` file, at the cost of introducing an extra complexity.\n\n If the `-A,--all` flag is set, the entire project will be installed. Combine with `--production` to replicate the old `yarn install --production`.\n "});var Ne=W("@yarnpkg/cli"),ge=W("@yarnpkg/core"),_e=W("@yarnpkg/core"),Y=W("@yarnpkg/core"),gr=W("@yarnpkg/plugin-git"),U=W("clipanion"),Oe=Be(cr()),Ar=W("os"),mr=Be(hr()),te=Be(W("typanion")),pe=class extends Ne.BaseCommand{constructor(){super(...arguments);this.recursive=U.Option.Boolean("-R,--recursive",!1,{description:"Find packages via dependencies/devDependencies instead of using the workspaces field"});this.from=U.Option.Array("--from",[],{description:"An array of glob pattern idents from which to base any recursion"});this.all=U.Option.Boolean("-A,--all",!1,{description:"Run the command on all workspaces of a project"});this.verbose=U.Option.Boolean("-v,--verbose",!1,{description:"Prefix each output line with the name of the originating workspace"});this.parallel=U.Option.Boolean("-p,--parallel",!1,{description:"Run the commands in parallel"});this.interlaced=U.Option.Boolean("-i,--interlaced",!1,{description:"Print the output of commands in real-time instead of buffering it"});this.jobs=U.Option.String("-j,--jobs",{description:"The maximum number of parallel tasks that the execution will be limited to; or `unlimited`",validator:te.isOneOf([te.isEnum(["unlimited"]),te.applyCascade(te.isNumber(),[te.isInteger(),te.isAtLeast(1)])])});this.topological=U.Option.Boolean("-t,--topological",!1,{description:"Run the command after all workspaces it depends on (regular) have finished"});this.topologicalDev=U.Option.Boolean("--topological-dev",!1,{description:"Run the command after all workspaces it depends on (regular + dev) have finished"});this.include=U.Option.Array("--include",[],{description:"An array of glob pattern idents; only matching workspaces will be traversed"});this.exclude=U.Option.Array("--exclude",[],{description:"An array of glob pattern idents; matching workspaces won't be traversed"});this.publicOnly=U.Option.Boolean("--no-private",{description:"Avoid running the command on private workspaces"});this.since=U.Option.String("--since",{description:"Only include workspaces that have been changed since the specified ref.",tolerateBoolean:!0});this.commandName=U.Option.String();this.args=U.Option.Proxy()}async execute(){let t=await ge.Configuration.find(this.context.cwd,this.context.plugins),{project:n,workspace:s}=await ge.Project.find(t,this.context.cwd);if(!this.all&&!s)throw new Ne.WorkspaceRequiredError(n.cwd,this.context.cwd);await n.restoreInstallState();let i=this.cli.process([this.commandName,...this.args]),a=i.path.length===1&&i.path[0]==="run"&&typeof i.scriptName<"u"?i.scriptName:null;if(i.path.length===0)throw new U.UsageError("Invalid subcommand name for iteration - use the 'run' keyword if you wish to execute a script");let c=this.all?n.topLevelWorkspace:s,p=this.since?Array.from(await gr.gitUtils.fetchChangedWorkspaces({ref:this.since,project:n})):[c,...this.from.length>0?c.getRecursiveWorkspaceChildren():[]],m=g=>Oe.default.isMatch(Y.structUtils.stringifyIdent(g.locator),this.from),h=this.from.length>0?p.filter(m):p,R=new Set([...h,...h.map(g=>[...this.recursive?this.since?g.getRecursiveWorkspaceDependents():g.getRecursiveWorkspaceDependencies():g.getRecursiveWorkspaceChildren()]).flat()]),f=[],$=!1;if(a!=null&&a.includes(":")){for(let g of n.workspaces)if(g.manifest.scripts.has(a)&&($=!$,$===!1))break}for(let g of R)a&&!g.manifest.scripts.has(a)&&!$&&!(await ge.scriptUtils.getWorkspaceAccessibleBinaries(g)).has(a)||a===process.env.npm_lifecycle_event&&g.cwd===s.cwd||this.include.length>0&&!Oe.default.isMatch(Y.structUtils.stringifyIdent(g.locator),this.include)||this.exclude.length>0&&Oe.default.isMatch(Y.structUtils.stringifyIdent(g.locator),this.exclude)||this.publicOnly&&g.manifest.private===!0||f.push(g);let _=this.parallel?this.jobs==="unlimited"?1/0:Number(this.jobs)||Math.max(1,(0,Ar.cpus)().length/2):1,y=_===1?!1:this.parallel,E=y?this.interlaced:!0,S=(0,mr.default)(_),T=new Map,L=new Set,z=0,I=null,re=!1,K=await _e.StreamReport.start({configuration:t,stdout:this.context.stdout},async g=>{let v=async(k,{commandIndex:l})=>{if(re)return-1;!y&&this.verbose&&l>1&&g.reportSeparator();let H=Kn(k,{configuration:t,verbose:this.verbose,commandIndex:l}),[w,B]=dr(g,{prefix:H,interlaced:E}),[o,u]=dr(g,{prefix:H,interlaced:E});try{this.verbose&&g.reportInfo(null,`${H} Process started`);let M=Date.now(),b=await this.cli.run([this.commandName,...this.args],{cwd:k.cwd,stdout:w,stderr:o})||0;w.end(),o.end(),await B,await u;let V=Date.now();if(this.verbose){let J=t.get("enableTimers")?`, completed in ${Y.formatUtils.pretty(t,V-M,Y.formatUtils.Type.DURATION)}`:"";g.reportInfo(null,`${H} Process exited (exit code ${b})${J}`)}return b===130&&(re=!0,I=b),b}catch(M){throw w.end(),o.end(),await B,await u,M}};for(let k of f)T.set(k.anchoredLocator.locatorHash,k);for(;T.size>0&&!g.hasErrors();){let k=[];for(let[w,B]of T){if(L.has(B.anchoredDescriptor.descriptorHash))continue;let o=!0;if(this.topological||this.topologicalDev){let u=this.topologicalDev?new Map([...B.manifest.dependencies,...B.manifest.devDependencies]):B.manifest.dependencies;for(let M of u.values()){let b=n.tryWorkspaceByDescriptor(M);if(o=b===null||!T.has(b.anchoredLocator.locatorHash),!o)break}}if(!!o&&(L.add(B.anchoredDescriptor.descriptorHash),k.push(S(async()=>{let u=await v(B,{commandIndex:++z});return T.delete(w),L.delete(B.anchoredDescriptor.descriptorHash),u})),!y))break}if(k.length===0){let w=Array.from(T.values()).map(B=>Y.structUtils.prettyLocator(t,B.anchoredLocator)).join(", ");g.reportError(_e.MessageName.CYCLIC_DEPENDENCIES,`Dependency cycle detected (${w})`);return}let H=(await Promise.all(k)).find(w=>w!==0);I===null&&(I=typeof H<"u"?1:I),(this.topological||this.topologicalDev)&&typeof H<"u"&&g.reportError(_e.MessageName.UNNAMED,"The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph")}});return I!==null?I:K.exitCode()}};pe.paths=[["workspaces","foreach"]],pe.usage=U.Command.Usage({category:"Workspace-related commands",description:"run a command on all workspaces",details:"\n This command will run a given sub-command on current and all its descendant workspaces. Various flags can alter the exact behavior of the command:\n\n - If `-p,--parallel` is set, the commands will be ran in parallel; they'll by default be limited to a number of parallel tasks roughly equal to half your core number, but that can be overridden via `-j,--jobs`, or disabled by setting `-j unlimited`.\n\n - If `-p,--parallel` and `-i,--interlaced` are both set, Yarn will print the lines from the output as it receives them. If `-i,--interlaced` wasn't set, it would instead buffer the output from each process and print the resulting buffers only after their source processes have exited.\n\n - If `-t,--topological` is set, Yarn will only run the command after all workspaces that it depends on through the `dependencies` field have successfully finished executing. If `--topological-dev` is set, both the `dependencies` and `devDependencies` fields will be considered when figuring out the wait points.\n\n - If `-A,--all` is set, Yarn will run the command on all the workspaces of a project. By default yarn runs the command only on current and all its descendant workspaces.\n\n - If `-R,--recursive` is set, Yarn will find workspaces to run the command on by recursively evaluating `dependencies` and `devDependencies` fields, instead of looking at the `workspaces` fields.\n\n - If `--from` is set, Yarn will use the packages matching the 'from' glob as the starting point for any recursive search.\n\n - If `--since` is set, Yarn will only run the command on workspaces that have been modified since the specified ref. By default Yarn will use the refs specified by the `changesetBaseRefs` configuration option.\n\n - The command may apply to only some workspaces through the use of `--include` which acts as a whitelist. The `--exclude` flag will do the opposite and will be a list of packages that mustn't execute the script. Both flags accept glob patterns (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n Adding the `-v,--verbose` flag will cause Yarn to print more information; in particular the name of the workspace that generated the output will be printed at the front of each line.\n\n If the command is `run` and the script being run does not exist the child workspace will be skipped without error.\n ",examples:[["Publish current and all descendant packages","yarn workspaces foreach npm publish --tolerate-republish"],["Run build script on current and all descendant packages","yarn workspaces foreach run build"],["Run build script on current and all descendant packages in parallel, building package dependencies first","yarn workspaces foreach -pt run build"],["Run build script on several packages and all their dependencies, building dependencies first","yarn workspaces foreach -ptR --from '{workspace-a,workspace-b}' run build"]]});function dr(e,{prefix:r,interlaced:t}){let n=e.createStreamReporter(r),s=new Y.miscUtils.DefaultStream;s.pipe(n,{end:!1}),s.on("finish",()=>{n.end()});let i=new Promise(c=>{n.on("finish",()=>{c(s.active)})});if(t)return[s,i];let a=new Y.miscUtils.BufferStream;return a.pipe(s,{end:!1}),a.on("finish",()=>{s.end()}),[a,i]}function Kn(e,{configuration:r,commandIndex:t,verbose:n}){if(!n)return null;let i=`[${Y.structUtils.stringifyIdent(e.locator)}]:`,a=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],c=a[t%a.length];return Y.formatUtils.pretty(r,i,c)}var Wn={commands:[ce,pe]},jn=Wn;return Sr(Fn);})();
|
8 |
+
/*!
|
9 |
+
* fill-range <https://github.com/jonschlinkert/fill-range>
|
10 |
+
*
|
11 |
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
12 |
+
* Licensed under the MIT License.
|
13 |
+
*/
|
14 |
+
/*!
|
15 |
+
* is-number <https://github.com/jonschlinkert/is-number>
|
16 |
+
*
|
17 |
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
18 |
+
* Released under the MIT License.
|
19 |
+
*/
|
20 |
+
/*!
|
21 |
+
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
22 |
+
*
|
23 |
+
* Copyright (c) 2015-present, Jon Schlinkert.
|
24 |
+
* Released under the MIT License.
|
25 |
+
*/
|
26 |
+
return plugin;
|
27 |
+
}
|
28 |
+
};
|
.yarn/releases/yarn-3.3.1.cjs
ADDED
The diff for this file is too large to render.
See raw diff
|
|
.yarnrc.yml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
nodeLinker: node-modules
|
2 |
+
|
3 |
+
plugins:
|
4 |
+
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
5 |
+
spec: "@yarnpkg/plugin-interactive-tools"
|
6 |
+
- path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
|
7 |
+
spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js"
|
8 |
+
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
|
9 |
+
spec: "@yarnpkg/plugin-workspace-tools"
|
10 |
+
|
11 |
+
yarnPath: .yarn/releases/yarn-3.3.1.cjs
|
CLA.md
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# Contributor Assignment and License Grant
|
3 |
+
|
4 |
+
### Introduction
|
5 |
+
|
6 |
+
This Contributor Assignment and License Grant("Agreement") outlines the terms under which Contributions may be made by the Contributor (“You” or “Your”)and MERCENARIES.AI PTE. LTD. (“Mercenaries” or "mercenaries.ai").
|
7 |
+
|
8 |
+
### Scope
|
9 |
+
|
10 |
+
This Agreement exclusively governs Contributions made to the Core Product and Core Extensions associated with Omnitool.ai. Contributions will be made publicly available under the terms of the GNU Affero General Public License version 3 (AGPLv3), as detailed in the LICENSE.md file. A commercial license option from mercenaries.ai is anticipated to be made available under a dual-licensing model.
|
11 |
+
|
12 |
+
**Please note that this Agreement does not apply to Non-Core Extensions, which are governed by their separate terms and conditions as specified in the respective extensions or projects.**
|
13 |
+
|
14 |
+
## DEFINITIONS
|
15 |
+
|
16 |
+
**Mercenaries** or **mercenaries.ai** or **MERCENARIES.AI PTE. LTD.**: Refers to the entity managing this Agreement and the Core Product, including its successors, assigns, and affiliates. For this Agreement, successors and assigns shall include, but not be limited to, any corporate entity that acquires all or substantially all of the assets or business of mercenaries.ai, any corporate entity into which mercenaries.ai may be merged or consolidated, and any corporate entity under common control with mercenaries.ai. Additionally, this definition encompasses any entity or organization, for-profit or non-profit, to which mercenaries.ai transfers its rights and obligations under this Agreement.
|
17 |
+
Omnitool.ai refers to the software project managed, owned, or operated by mercenaries.ai with genesis in the current repository found at `github.com/omnitool-ai`, irrespective of any future branding, trademark changes, or repository locations.
|
18 |
+
|
19 |
+
**"Core Product"** is defined as the code and assets integral to the functionality, operability, or user experience of Omnitool.ai, as identified by mercenaries.ai as “Core” in official documentation, repositories, or other authoritative communications. This encompasses, but is not limited to, source code, binary code, associated libraries, data sets, APIs, documentation, user interfaces, graphics, designs, algorithms, and other components. The Core Product includes updates, upgrades, patches, revisions, and associated intellectual property rights.
|
20 |
+
|
21 |
+
**“Core Extensions”** are any extension, plugin, or add-on integral to the functionality, operability, or user experience of Omnitool.ai, as identified by mercenaries.ai as “Core” in official documentation, repositories, or other authoritative communications. This encompasses, but is not limited to, source code, binary code, associated libraries, data sets, APIs, documentation, user interfaces, graphics, designs, algorithms, and other components. Core Extensions include updates, upgrades, patches, revisions, and associated intellectual property rights.
|
22 |
+
For this Agreement, "integral" refers to any components, features, or elements essential for the basic functioning or usability of Omnitool.ai as reasonably determined by mercenaries.ai.
|
23 |
+
|
24 |
+
**Non-Core Extensions**: Refers to any extensions, plugins, or add-ons developed or managed by third parties that are not integral to the basic functionality, operability, or user experience of Omnitool.ai. Non-Core Extensions are subject to licensing and contributor terms specified by those individual projects or extensions.
|
25 |
+
|
26 |
+
**Contributor**, You, Your: The individual or entity contributing to the Core Product or Core Extensions as defined herein.
|
27 |
+
Contributions: Any modifications, enhancements, algorithms, data sets, ideas, feedback, or additions related to the Core Product or Core Extensions that you Submit to Omnitool.ai. This encompasses source code, binary code, documentation, design elements, algorithms, feature requests, issue reports, and any other materials or intellectual property that can be used to improve, expand, or maintain the Core Product or Core Extensions.
|
28 |
+
Submit: Any act of transmitting, sharing, or otherwise making available Contributions to Omnitool.ai, whether through pull requests, merge requests, issue tracking systems, emails, code, repositories, data sets, documentation, or any other communication channels or platforms recognized by mercenaries.ai for such purposes.
|
29 |
+
|
30 |
+
**Effective Date**: The date You execute this Agreement or the date You first Submit a Contribution to Us, whichever is earlier. This is the date this Agreement takes legal effect.
|
31 |
+
|
32 |
+
## TERMS
|
33 |
+
|
34 |
+
### Copyright Assignment and Patent License Grant
|
35 |
+
|
36 |
+
mercenaries.ai manages the Core Product and Core Extensions for this project under a dual licensing model, incorporating the AGPL for the open-source license while leaving open the option for future commercial licensing. This approach aims to foster innovation and adoption within open-source and corporate communities. We incorporate a copyright transfer from contributors, coupled with a 'License Back' provision, to achieve these objectives while ensuring that You retain the flexibility to utilize Your Contributions in any manner You deem appropriate.
|
37 |
+
|
38 |
+
- **Copyright Assignment**
|
39 |
+
You hereby irrevocably assign, transfer, and convey to mercenaries.ai all rights, title, and interests in and to Your Contributions, including all copyrights and copyrightable materials therein, all moral and neighboring rights worldwide and beyond, in perpetuity. This assignment includes the right to initiate legal action for past or future infringement, misappropriation, or violation of these rights. Moral Rights remain unaffected to the extent they are recognized and not waivable by applicable law.
|
40 |
+
|
41 |
+
- **Patent License**
|
42 |
+
You hereby grant to mercenaries.ai a perpetual, worldwide, non-exclusive, no-charge, royalty-free, sublicensable license under any patents owned or controlled by You to make, have made, use, offer to sell, sell, import, and otherwise transfer Your Contributions and any derivative works thereof. mercenaries.ai is entitled to sublicense any patent rights to Your Contributions under the same licensing terms as the Core Product.
|
43 |
+
You reserve the right to revoke the patent license granted in this Section if mercenaries.ai initiates any patent infringement claims targeted explicitly at your Contributions and not asserted for a Defensive Purpose. For this Agreement, an assertion of patent claims shall be deemed for a 'Defensive Purpose' if such claims are asserted against an entity that has filed, maintained, threatened, or voluntarily participated in a patent infringement lawsuit against mercenaries.ai or any of its licensees.
|
44 |
+
|
45 |
+
- **License Back**
|
46 |
+
Notwithstanding the foregoing assignment of rights, title, and interests, mercenaries.ai hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, sublicensable license under any intellectual property rights covering Your Contributions to make, have made, use, offer to sell, sell, import, and otherwise transfer Your Contributions and derivative works thereof. This license back does not extend to the Core Product, Core Extensions, or other third-party contributions.
|
47 |
+
|
48 |
+
### Use of Contributions
|
49 |
+
|
50 |
+
You acknowledge that mercenaries.ai is not obligated to use Your Contributions.
|
51 |
+
|
52 |
+
### Contributor Warranties
|
53 |
+
|
54 |
+
You warrant that:
|
55 |
+
- You have the legal authority to enter into this Agreement,
|
56 |
+
- You are the author of and have the legal right to make the Contributions,
|
57 |
+
- Your Contributions do not violate any laws, and
|
58 |
+
- Your Contributions do not infringe upon any third party intellectual property rights.
|
59 |
+
You agree to indemnify, defend, and hold harmless mercenaries.ai and its directors, officers, employees, and agents from and against any claims, damages, losses, liabilities, costs, and expenses, including reasonable attorney's fees, arising out of or in connection with any breach by You of Your warranties as outlined in this Agreement.
|
60 |
+
|
61 |
+
### Third-Party Rights
|
62 |
+
|
63 |
+
You shall provide documentation that lists all third-party assets, all respective licenses as part of any Contribution.
|
64 |
+
|
65 |
+
### Intellectual Property Notification
|
66 |
+
|
67 |
+
Should You become aware of any intellectual property rights that the existing Core Product or any Core Extensions infringes upon, you must promptly notify mercenaries.ai in writing.
|
68 |
+
|
69 |
+
### Employment and Other Agreements
|
70 |
+
|
71 |
+
You affirm that Your Contributions to the Core Product and any Core Extensions do not conflict with employment or other contractual obligations.
|
72 |
+
|
73 |
+
### Disclaimer of Warranty
|
74 |
+
|
75 |
+
Except for the representations and other obligations herein, Your Contributions are provided "as is" without warranty, either express or implied.
|
76 |
+
|
77 |
+
### Limitation of Liability
|
78 |
+
|
79 |
+
Except as explicitly provided herein, You shall not be liable for any claims, damages, or other liability arising from using Your Contributions.
|
80 |
+
|
81 |
+
### Consequential Damage Waiver
|
82 |
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL EITHER PARTY BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF ANTICIPATED SAVINGS, LOSS OF DATA, INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL AND EXEMPLARY DAMAGES ARISING OUT OF THIS AGREEMENT REGARDLESS OF THE LEGAL OR EQUITABLE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH THE CLAIM IS BASED.
|
83 |
+
|
84 |
+
### Assignment
|
85 |
+
|
86 |
+
Mercenaries may, at its option, assign the rights or obligations received through this Agreement to a third party provided that the third party agrees in writing to abide by all the rights and obligations in the Agreement.
|
87 |
+
|
88 |
+
### Forking Clause
|
89 |
+
|
90 |
+
This Agreement and all its terms, including but not limited to the assignment of copyrights and patent licenses, shall extend to any fork of the original Omnitool.ai repository that is managed, owned, or operated by mercenaries.ai or its successors, assigns, and affiliates. Contributions to such forked repositories shall be treated as Contributions to the original Omnitool.ai project for this Agreement. Contributors to any such fork acknowledge and agree that their Contributions to the fork are subject to all terms and conditions of this Agreement.
|
91 |
+
This Agreement does not extend to forks to Omnitool.ai that are not managed, owned, or operated by mercenaries.ai or its successors, assigns, and affiliates. Contributions to such third-party forks are not subject to this Agreement, and individuals making Contributions to those forks do so at their own risk unless otherwise agreed upon in writing by mercenaries.ai.
|
92 |
+
Contributions previously made to forks not managed, owned, or operated by mercenaries.ai or its successors, assigns, and affiliates must be identified and approved by mercenaries.ai before submission or as part of the submission to Omnitool.ai.
|
93 |
+
|
94 |
+
### Execution of Documents
|
95 |
+
|
96 |
+
You agree to execute any additional documents necessary to effectuate the purpose of this Agreement at mercenaries.ai's request.
|
97 |
+
|
98 |
+
### Governing Law and Jurisdiction
|
99 |
+
|
100 |
+
- **Claims Made Against mercenaries.ai.** This Agreement is governed by the laws of Singapore, without regard to its conflict of laws principles. Any disputes, controversies, or differences (each instance being a “Dispute”) brought against mercenaries.ai, including any question regarding its existence, validity, or termination, will be settled amicably by the parties wherever practicable. Any Dispute brought against mercenaries.ai that cannot be resolved will be referred to and finally resolved by arbitration administered by the Singapore International Arbitration Centre (“SIAC”) under the Arbitration Rules of the Singapore International Arbitration Centre (“SIAC Rules”) for the time being in force, which rules are deemed to be incorporated by reference in this clause. The governing law of the arbitration will be Singapore law. The seat of the arbitration for Disputes brought against mercenaries.ai will be Singapore. The venue of the arbitration will be Singapore or any other location (including by teleconference or videoconference) otherwise agreed between the Tribunal and the Parties. The Tribunal will consist of 1 arbitrator, to be appointed by the President of the Court of Arbitration of the SIAC. The language of the arbitration will be English.
|
101 |
+
- **Claims Made by mercenaries.ai.** "For claims initiated by mercenaries.ai against You, mercenaries.ai reserves the right to determine the forum for dispute resolution. mercenaries.ai may either (a) initiate legal proceedings in the jurisdiction where You are domiciled or conduct business or (b) pursue arbitration in Singapore at its sole discretion. Should mercenaries.ai choose to initiate legal proceedings in a jurisdiction where You are domiciled or conduct business, mercenaries.ai further reserves the right to elect the governing law for such proceedings, choosing either Singaporean law or the law of the jurisdiction where You are domiciled or conduct business."
|
102 |
+
|
103 |
+
### Signatures
|
104 |
+
|
105 |
+
By affixing Your signatures below, both parties acknowledge Your acceptance of the terms of this Agreement.
|
106 |
+
> Contributor Signature:
|
107 |
+
Date:
|
108 |
+
|
109 |
+
> MERCENARIES.AI PTE. LTD. Signature:
|
110 |
+
Date:
|
CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# Contributor Covenant Code of Conduct
|
3 |
+
|
4 |
+
## Our Pledge
|
5 |
+
|
6 |
+
We as members, contributors, and leaders pledge to make participation in our
|
7 |
+
community a harassment-free experience for everyone, regardless of age, body
|
8 |
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
9 |
+
identity and expression, level of experience, education, socio-economic status,
|
10 |
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
11 |
+
identity and orientation.
|
12 |
+
|
13 |
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
14 |
+
diverse, inclusive, and healthy community.
|
15 |
+
|
16 |
+
## Our Standards
|
17 |
+
|
18 |
+
Examples of behavior that contributes to a positive environment for our
|
19 |
+
community include:
|
20 |
+
|
21 |
+
* Demonstrating empathy and kindness toward other people
|
22 |
+
* Being respectful of differing opinions, viewpoints, and experiences
|
23 |
+
* Giving and gracefully accepting constructive feedback
|
24 |
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
25 |
+
and learning from the experience
|
26 |
+
* Focusing on what is best not just for us as individuals, but for the overall
|
27 |
+
community
|
28 |
+
|
29 |
+
Examples of unacceptable behavior include:
|
30 |
+
|
31 |
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
32 |
+
any kind
|
33 |
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
34 |
+
* Public or private harassment
|
35 |
+
* Publishing others' private information, such as a physical or email address,
|
36 |
+
without their explicit permission
|
37 |
+
* Other conduct which could reasonably be considered inappropriate in a
|
38 |
+
professional setting
|
39 |
+
|
40 |
+
## Enforcement Responsibilities
|
41 |
+
|
42 |
+
Community leaders are responsible for clarifying and enforcing our standards of
|
43 |
+
acceptable behavior and will take appropriate and fair corrective action in
|
44 |
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
45 |
+
or harmful.
|
46 |
+
|
47 |
+
Community leaders have the right and responsibility to remove, edit, or reject
|
48 |
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
49 |
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
50 |
+
decisions when appropriate.
|
51 |
+
|
52 |
+
## Scope
|
53 |
+
|
54 |
+
This Code of Conduct applies within all community spaces, and also applies when
|
55 |
+
an individual is officially representing the community in public spaces.
|
56 |
+
Examples of representing our community include using an official e-mail address,
|
57 |
+
posting via an official social media account, or acting as an appointed
|
58 |
+
representative at an online or offline event.
|
59 |
+
|
60 |
+
## Enforcement
|
61 |
+
|
62 |
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
63 |
+
reported to the community leaders responsible for enforcement at conduct at omnitool.ai
|
64 |
+
All complaints will be reviewed and investigated promptly and fairly.
|
65 |
+
|
66 |
+
All community leaders are obligated to respect the privacy and security of the
|
67 |
+
reporter of any incident.
|
68 |
+
|
69 |
+
## Enforcement Guidelines
|
70 |
+
|
71 |
+
Community leaders will follow these Community Impact Guidelines in determining
|
72 |
+
the consequences for any action they deem in violation of this Code of Conduct:
|
73 |
+
|
74 |
+
### 1. Correction
|
75 |
+
|
76 |
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
77 |
+
unprofessional or unwelcome in the community.
|
78 |
+
|
79 |
+
**Consequence**: A private, written warning from community leaders, providing
|
80 |
+
clarity around the nature of the violation and an explanation of why the
|
81 |
+
behavior was inappropriate. A public apology may be requested.
|
82 |
+
|
83 |
+
### 2. Warning
|
84 |
+
|
85 |
+
**Community Impact**: A violation through a single incident or series of
|
86 |
+
actions.
|
87 |
+
|
88 |
+
**Consequence**: A warning with consequences for continued behavior. No
|
89 |
+
interaction with the people involved, including unsolicited interaction with
|
90 |
+
those enforcing the Code of Conduct, for a specified period of time. This
|
91 |
+
includes avoiding interactions in community spaces as well as external channels
|
92 |
+
like social media. Violating these terms may lead to a temporary or permanent
|
93 |
+
ban.
|
94 |
+
|
95 |
+
### 3. Temporary Ban
|
96 |
+
|
97 |
+
**Community Impact**: A serious violation of community standards, including
|
98 |
+
sustained inappropriate behavior.
|
99 |
+
|
100 |
+
**Consequence**: A temporary ban from any sort of interaction or public
|
101 |
+
communication with the community for a specified period of time. No public or
|
102 |
+
private interaction with the people involved, including unsolicited interaction
|
103 |
+
with those enforcing the Code of Conduct, is allowed during this period.
|
104 |
+
Violating these terms may lead to a permanent ban.
|
105 |
+
|
106 |
+
### 4. Permanent Ban
|
107 |
+
|
108 |
+
**Community Impact**: Demonstrating a pattern of violation of community
|
109 |
+
standards, including sustained inappropriate behavior, harassment of an
|
110 |
+
individual, or aggression toward or disparagement of classes of individuals.
|
111 |
+
|
112 |
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
113 |
+
community.
|
114 |
+
|
115 |
+
## Attribution
|
116 |
+
|
117 |
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
118 |
+
version 2.1, available at
|
119 |
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
120 |
+
|
121 |
+
Community Impact Guidelines were inspired by
|
122 |
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
123 |
+
|
124 |
+
For answers to common questions about this code of conduct, see the FAQ at
|
125 |
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
126 |
+
[https://www.contributor-covenant.org/translations][translations].
|
127 |
+
|
128 |
+
[homepage]: https://www.contributor-covenant.org
|
129 |
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
130 |
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
131 |
+
[FAQ]: https://www.contributor-covenant.org/faq
|
132 |
+
[translations]: https://www.contributor-covenant.org/translations
|
COPYRIGHT.md
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
|
2 |
+
All rights reserved.
|
Dockerfile
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM node:20.6.1
|
2 |
+
|
3 |
+
USER node
|
4 |
+
WORKDIR /app
|
5 |
+
|
6 |
+
RUN mkdir -p /app/node_modules
|
7 |
+
RUN chmod 777 /app
|
8 |
+
RUN chmod 777 /app/node_modules
|
9 |
+
|
10 |
+
COPY --chown=node package*.json /app
|
11 |
+
COPY --chown=node yarn.lock /app
|
12 |
+
COPY --chown=node . /app
|
13 |
+
|
14 |
+
# Get curl
|
15 |
+
#RUN apt-get update && apt-get install -y curl
|
16 |
+
# Download the file to a temporary location
|
17 |
+
RUN curl -L https://github.com/omnitool-ai/omnitool/raw/main/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/group1-shard1of1 -o _tempfile.bin
|
18 |
+
|
19 |
+
# Create the target directory
|
20 |
+
RUN mkdir -p /app/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/
|
21 |
+
RUN chmod 777 /app/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/
|
22 |
+
|
23 |
+
# Move the file to the desired directory
|
24 |
+
RUN mv _tempfile.bin /app/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/group1-shard1of1 && chown -R node /app/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/group1-shard1of1
|
25 |
+
RUN chmod 777 /app/packages/omni-server/config.default/models/nsfwjs/mobilenet-v2-quant/group1-shard1of1
|
26 |
+
|
27 |
+
RUN chown -Rh $user:$user /app
|
28 |
+
|
29 |
+
# Copy application source code along with main.py and run.sh
|
30 |
+
COPY --chown=node . /app
|
31 |
+
|
32 |
+
# Give execution rights to the shell script
|
33 |
+
# RUN chmod +x $HOME/app/start.sh
|
34 |
+
|
35 |
+
RUN yarn install
|
36 |
+
|
37 |
+
# Create a new service container using the `yarn-app` image as a builder
|
38 |
+
EXPOSE 7860
|
39 |
+
|
40 |
+
CMD [ "node", "launch.js" ]
|
41 |
+
#CMD [ "yarn", "start","-u","-rb" ]
|
42 |
+
# CMD ["/app/run.sh"]
|
LICENSE.md
ADDED
@@ -0,0 +1,667 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
|
2 |
+
All rights reserved.
|
3 |
+
|
4 |
+
Unless you have obtained this software directly from MERCENARIES.AI PTE. LTD. under the terms of a specific commercial license agreement, Omnitool.ai is provided to you under the GNU Affero General Public License version 3 (a.k.a. AGPLv3) license, the full text of which is included below. Information on accessing the source code for this distribution is detailed in the SOURCE.md file.
|
5 |
+
Omnitool.ai incorporates various open-source software components, the license terms of which are documented in the NOTICE.md file.
|
6 |
+
Additionally, the Windows and Mac versions of Omnitool.ai are bundled with binary copies of several utilities, the licensing terms for these are available in the SOURCE.md file.
|
7 |
+
|
8 |
+
# GNU AFFERO GENERAL PUBLIC LICENSE
|
9 |
+
|
10 |
+
Version 3, 19 November 2007
|
11 |
+
|
12 |
+
Copyright (C) 2007 Free Software Foundation, Inc.
|
13 |
+
<https://fsf.org/>
|
14 |
+
|
15 |
+
Everyone is permitted to copy and distribute verbatim copies of this
|
16 |
+
license document, but changing it is not allowed.
|
17 |
+
|
18 |
+
## Preamble
|
19 |
+
|
20 |
+
The GNU Affero General Public License is a free, copyleft license for
|
21 |
+
software and other kinds of works, specifically designed to ensure
|
22 |
+
cooperation with the community in the case of network server software.
|
23 |
+
|
24 |
+
The licenses for most software and other practical works are designed
|
25 |
+
to take away your freedom to share and change the works. By contrast,
|
26 |
+
our General Public Licenses are intended to guarantee your freedom to
|
27 |
+
share and change all versions of a program--to make sure it remains
|
28 |
+
free software for all its users.
|
29 |
+
|
30 |
+
When we speak of free software, we are referring to freedom, not
|
31 |
+
price. Our General Public Licenses are designed to make sure that you
|
32 |
+
have the freedom to distribute copies of free software (and charge for
|
33 |
+
them if you wish), that you receive source code or can get it if you
|
34 |
+
want it, that you can change the software or use pieces of it in new
|
35 |
+
free programs, and that you know you can do these things.
|
36 |
+
|
37 |
+
Developers that use our General Public Licenses protect your rights
|
38 |
+
with two steps: (1) assert copyright on the software, and (2) offer
|
39 |
+
you this License which gives you legal permission to copy, distribute
|
40 |
+
and/or modify the software.
|
41 |
+
|
42 |
+
A secondary benefit of defending all users' freedom is that
|
43 |
+
improvements made in alternate versions of the program, if they
|
44 |
+
receive widespread use, become available for other developers to
|
45 |
+
incorporate. Many developers of free software are heartened and
|
46 |
+
encouraged by the resulting cooperation. However, in the case of
|
47 |
+
software used on network servers, this result may fail to come about.
|
48 |
+
The GNU General Public License permits making a modified version and
|
49 |
+
letting the public access it on a server without ever releasing its
|
50 |
+
source code to the public.
|
51 |
+
|
52 |
+
The GNU Affero General Public License is designed specifically to
|
53 |
+
ensure that, in such cases, the modified source code becomes available
|
54 |
+
to the community. It requires the operator of a network server to
|
55 |
+
provide the source code of the modified version running there to the
|
56 |
+
users of that server. Therefore, public use of a modified version, on
|
57 |
+
a publicly accessible server, gives the public access to the source
|
58 |
+
code of the modified version.
|
59 |
+
|
60 |
+
An older license, called the Affero General Public License and
|
61 |
+
published by Affero, was designed to accomplish similar goals. This is
|
62 |
+
a different license, not a version of the Affero GPL, but Affero has
|
63 |
+
released a new version of the Affero GPL which permits relicensing
|
64 |
+
under this license.
|
65 |
+
|
66 |
+
The precise terms and conditions for copying, distribution and
|
67 |
+
modification follow.
|
68 |
+
|
69 |
+
## TERMS AND CONDITIONS
|
70 |
+
|
71 |
+
### 0. Definitions.
|
72 |
+
|
73 |
+
"This License" refers to version 3 of the GNU Affero General Public
|
74 |
+
License.
|
75 |
+
|
76 |
+
"Copyright" also means copyright-like laws that apply to other kinds
|
77 |
+
of works, such as semiconductor masks.
|
78 |
+
|
79 |
+
"The Program" refers to any copyrightable work licensed under this
|
80 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
81 |
+
"recipients" may be individuals or organizations.
|
82 |
+
|
83 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
84 |
+
in a fashion requiring copyright permission, other than the making of
|
85 |
+
an exact copy. The resulting work is called a "modified version" of
|
86 |
+
the earlier work or a work "based on" the earlier work.
|
87 |
+
|
88 |
+
A "covered work" means either the unmodified Program or a work based
|
89 |
+
on the Program.
|
90 |
+
|
91 |
+
To "propagate" a work means to do anything with it that, without
|
92 |
+
permission, would make you directly or secondarily liable for
|
93 |
+
infringement under applicable copyright law, except executing it on a
|
94 |
+
computer or modifying a private copy. Propagation includes copying,
|
95 |
+
distribution (with or without modification), making available to the
|
96 |
+
public, and in some countries other activities as well.
|
97 |
+
|
98 |
+
To "convey" a work means any kind of propagation that enables other
|
99 |
+
parties to make or receive copies. Mere interaction with a user
|
100 |
+
through a computer network, with no transfer of a copy, is not
|
101 |
+
conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices" to
|
104 |
+
the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
### 1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work for
|
115 |
+
making modifications to it. "Object code" means any non-source form of
|
116 |
+
a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users can
|
148 |
+
regenerate automatically from other parts of the Corresponding Source.
|
149 |
+
|
150 |
+
The Corresponding Source for a work in source code form is that same
|
151 |
+
work.
|
152 |
+
|
153 |
+
### 2. Basic Permissions.
|
154 |
+
|
155 |
+
All rights granted under this License are granted for the term of
|
156 |
+
copyright on the Program, and are irrevocable provided the stated
|
157 |
+
conditions are met. This License explicitly affirms your unlimited
|
158 |
+
permission to run the unmodified Program. The output from running a
|
159 |
+
covered work is covered by this License only if the output, given its
|
160 |
+
content, constitutes a covered work. This License acknowledges your
|
161 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
162 |
+
|
163 |
+
You may make, run and propagate covered works that you do not convey,
|
164 |
+
without conditions so long as your license otherwise remains in force.
|
165 |
+
You may convey covered works to others for the sole purpose of having
|
166 |
+
them make modifications exclusively for you, or provide you with
|
167 |
+
facilities for running those works, provided that you comply with the
|
168 |
+
terms of this License in conveying all material for which you do not
|
169 |
+
control copyright. Those thus making or running the covered works for
|
170 |
+
you must do so exclusively on your behalf, under your direction and
|
171 |
+
control, on terms that prohibit them from making any copies of your
|
172 |
+
copyrighted material outside their relationship with you.
|
173 |
+
|
174 |
+
Conveying under any other circumstances is permitted solely under the
|
175 |
+
conditions stated below. Sublicensing is not allowed; section 10 makes
|
176 |
+
it unnecessary.
|
177 |
+
|
178 |
+
### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
179 |
+
|
180 |
+
No covered work shall be deemed part of an effective technological
|
181 |
+
measure under any applicable law fulfilling obligations under article
|
182 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
183 |
+
similar laws prohibiting or restricting circumvention of such
|
184 |
+
measures.
|
185 |
+
|
186 |
+
When you convey a covered work, you waive any legal power to forbid
|
187 |
+
circumvention of technological measures to the extent such
|
188 |
+
circumvention is effected by exercising rights under this License with
|
189 |
+
respect to the covered work, and you disclaim any intention to limit
|
190 |
+
operation or modification of the work as a means of enforcing, against
|
191 |
+
the work's users, your or third parties' legal rights to forbid
|
192 |
+
circumvention of technological measures.
|
193 |
+
|
194 |
+
### 4. Conveying Verbatim Copies.
|
195 |
+
|
196 |
+
You may convey verbatim copies of the Program's source code as you
|
197 |
+
receive it, in any medium, provided that you conspicuously and
|
198 |
+
appropriately publish on each copy an appropriate copyright notice;
|
199 |
+
keep intact all notices stating that this License and any
|
200 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
201 |
+
keep intact all notices of the absence of any warranty; and give all
|
202 |
+
recipients a copy of this License along with the Program.
|
203 |
+
|
204 |
+
You may charge any price or no price for each copy that you convey,
|
205 |
+
and you may offer support or warranty protection for a fee.
|
206 |
+
|
207 |
+
### 5. Conveying Modified Source Versions.
|
208 |
+
|
209 |
+
You may convey a work based on the Program, or the modifications to
|
210 |
+
produce it from the Program, in the form of source code under the
|
211 |
+
terms of section 4, provided that you also meet all of these
|
212 |
+
conditions:
|
213 |
+
|
214 |
+
- a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
- b) The work must carry prominent notices stating that it is
|
217 |
+
released under this License and any conditions added under
|
218 |
+
section 7. This requirement modifies the requirement in section 4
|
219 |
+
to "keep intact all notices".
|
220 |
+
- c) You must license the entire work, as a whole, under this
|
221 |
+
License to anyone who comes into possession of a copy. This
|
222 |
+
License will therefore apply, along with any applicable section 7
|
223 |
+
additional terms, to the whole of the work, and all its parts,
|
224 |
+
regardless of how they are packaged. This License gives no
|
225 |
+
permission to license the work in any other way, but it does not
|
226 |
+
invalidate such permission if you have separately received it.
|
227 |
+
- d) If the work has interactive user interfaces, each must display
|
228 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
229 |
+
interfaces that do not display Appropriate Legal Notices, your
|
230 |
+
work need not make them do so.
|
231 |
+
|
232 |
+
A compilation of a covered work with other separate and independent
|
233 |
+
works, which are not by their nature extensions of the covered work,
|
234 |
+
and which are not combined with it such as to form a larger program,
|
235 |
+
in or on a volume of a storage or distribution medium, is called an
|
236 |
+
"aggregate" if the compilation and its resulting copyright are not
|
237 |
+
used to limit the access or legal rights of the compilation's users
|
238 |
+
beyond what the individual works permit. Inclusion of a covered work
|
239 |
+
in an aggregate does not cause this License to apply to the other
|
240 |
+
parts of the aggregate.
|
241 |
+
|
242 |
+
### 6. Conveying Non-Source Forms.
|
243 |
+
|
244 |
+
You may convey a covered work in object code form under the terms of
|
245 |
+
sections 4 and 5, provided that you also convey the machine-readable
|
246 |
+
Corresponding Source under the terms of this License, in one of these
|
247 |
+
ways:
|
248 |
+
|
249 |
+
- a) Convey the object code in, or embodied in, a physical product
|
250 |
+
(including a physical distribution medium), accompanied by the
|
251 |
+
Corresponding Source fixed on a durable physical medium
|
252 |
+
customarily used for software interchange.
|
253 |
+
- b) Convey the object code in, or embodied in, a physical product
|
254 |
+
(including a physical distribution medium), accompanied by a
|
255 |
+
written offer, valid for at least three years and valid for as
|
256 |
+
long as you offer spare parts or customer support for that product
|
257 |
+
model, to give anyone who possesses the object code either (1) a
|
258 |
+
copy of the Corresponding Source for all the software in the
|
259 |
+
product that is covered by this License, on a durable physical
|
260 |
+
medium customarily used for software interchange, for a price no
|
261 |
+
more than your reasonable cost of physically performing this
|
262 |
+
conveying of source, or (2) access to copy the Corresponding
|
263 |
+
Source from a network server at no charge.
|
264 |
+
- c) Convey individual copies of the object code with a copy of the
|
265 |
+
written offer to provide the Corresponding Source. This
|
266 |
+
alternative is allowed only occasionally and noncommercially, and
|
267 |
+
only if you received the object code with such an offer, in accord
|
268 |
+
with subsection 6b.
|
269 |
+
- d) Convey the object code by offering access from a designated
|
270 |
+
place (gratis or for a charge), and offer equivalent access to the
|
271 |
+
Corresponding Source in the same way through the same place at no
|
272 |
+
further charge. You need not require recipients to copy the
|
273 |
+
Corresponding Source along with the object code. If the place to
|
274 |
+
copy the object code is a network server, the Corresponding Source
|
275 |
+
may be on a different server (operated by you or a third party)
|
276 |
+
that supports equivalent copying facilities, provided you maintain
|
277 |
+
clear directions next to the object code saying where to find the
|
278 |
+
Corresponding Source. Regardless of what server hosts the
|
279 |
+
Corresponding Source, you remain obligated to ensure that it is
|
280 |
+
available for as long as needed to satisfy these requirements.
|
281 |
+
- e) Convey the object code using peer-to-peer transmission,
|
282 |
+
provided you inform other peers where the object code and
|
283 |
+
Corresponding Source of the work are being offered to the general
|
284 |
+
public at no charge under subsection 6d.
|
285 |
+
|
286 |
+
A separable portion of the object code, whose source code is excluded
|
287 |
+
from the Corresponding Source as a System Library, need not be
|
288 |
+
included in conveying the object code work.
|
289 |
+
|
290 |
+
A "User Product" is either (1) a "consumer product", which means any
|
291 |
+
tangible personal property which is normally used for personal,
|
292 |
+
family, or household purposes, or (2) anything designed or sold for
|
293 |
+
incorporation into a dwelling. In determining whether a product is a
|
294 |
+
consumer product, doubtful cases shall be resolved in favor of
|
295 |
+
coverage. For a particular product received by a particular user,
|
296 |
+
"normally used" refers to a typical or common use of that class of
|
297 |
+
product, regardless of the status of the particular user or of the way
|
298 |
+
in which the particular user actually uses, or expects or is expected
|
299 |
+
to use, the product. A product is a consumer product regardless of
|
300 |
+
whether the product has substantial commercial, industrial or
|
301 |
+
non-consumer uses, unless such uses represent the only significant
|
302 |
+
mode of use of the product.
|
303 |
+
|
304 |
+
"Installation Information" for a User Product means any methods,
|
305 |
+
procedures, authorization keys, or other information required to
|
306 |
+
install and execute modified versions of a covered work in that User
|
307 |
+
Product from a modified version of its Corresponding Source. The
|
308 |
+
information must suffice to ensure that the continued functioning of
|
309 |
+
the modified object code is in no case prevented or interfered with
|
310 |
+
solely because modification has been made.
|
311 |
+
|
312 |
+
If you convey an object code work under this section in, or with, or
|
313 |
+
specifically for use in, a User Product, and the conveying occurs as
|
314 |
+
part of a transaction in which the right of possession and use of the
|
315 |
+
User Product is transferred to the recipient in perpetuity or for a
|
316 |
+
fixed term (regardless of how the transaction is characterized), the
|
317 |
+
Corresponding Source conveyed under this section must be accompanied
|
318 |
+
by the Installation Information. But this requirement does not apply
|
319 |
+
if neither you nor any third party retains the ability to install
|
320 |
+
modified object code on the User Product (for example, the work has
|
321 |
+
been installed in ROM).
|
322 |
+
|
323 |
+
The requirement to provide Installation Information does not include a
|
324 |
+
requirement to continue to provide support service, warranty, or
|
325 |
+
updates for a work that has been modified or installed by the
|
326 |
+
recipient, or for the User Product in which it has been modified or
|
327 |
+
installed. Access to a network may be denied when the modification
|
328 |
+
itself materially and adversely affects the operation of the network
|
329 |
+
or violates the rules and protocols for communication across the
|
330 |
+
network.
|
331 |
+
|
332 |
+
Corresponding Source conveyed, and Installation Information provided,
|
333 |
+
in accord with this section must be in a format that is publicly
|
334 |
+
documented (and with an implementation available to the public in
|
335 |
+
source code form), and must require no special password or key for
|
336 |
+
unpacking, reading or copying.
|
337 |
+
|
338 |
+
### 7. Additional Terms.
|
339 |
+
|
340 |
+
"Additional permissions" are terms that supplement the terms of this
|
341 |
+
License by making exceptions from one or more of its conditions.
|
342 |
+
Additional permissions that are applicable to the entire Program shall
|
343 |
+
be treated as though they were included in this License, to the extent
|
344 |
+
that they are valid under applicable law. If additional permissions
|
345 |
+
apply only to part of the Program, that part may be used separately
|
346 |
+
under those permissions, but the entire Program remains governed by
|
347 |
+
this License without regard to the additional permissions.
|
348 |
+
|
349 |
+
When you convey a copy of a covered work, you may at your option
|
350 |
+
remove any additional permissions from that copy, or from any part of
|
351 |
+
it. (Additional permissions may be written to require their own
|
352 |
+
removal in certain cases when you modify the work.) You may place
|
353 |
+
additional permissions on material, added by you to a covered work,
|
354 |
+
for which you have or can give appropriate copyright permission.
|
355 |
+
|
356 |
+
Notwithstanding any other provision of this License, for material you
|
357 |
+
add to a covered work, you may (if authorized by the copyright holders
|
358 |
+
of that material) supplement the terms of this License with terms:
|
359 |
+
|
360 |
+
- a) Disclaiming warranty or limiting liability differently from the
|
361 |
+
terms of sections 15 and 16 of this License; or
|
362 |
+
- b) Requiring preservation of specified reasonable legal notices or
|
363 |
+
author attributions in that material or in the Appropriate Legal
|
364 |
+
Notices displayed by works containing it; or
|
365 |
+
- c) Prohibiting misrepresentation of the origin of that material,
|
366 |
+
or requiring that modified versions of such material be marked in
|
367 |
+
reasonable ways as different from the original version; or
|
368 |
+
- d) Limiting the use for publicity purposes of names of licensors
|
369 |
+
or authors of the material; or
|
370 |
+
- e) Declining to grant rights under trademark law for use of some
|
371 |
+
trade names, trademarks, or service marks; or
|
372 |
+
- f) Requiring indemnification of licensors and authors of that
|
373 |
+
material by anyone who conveys the material (or modified versions
|
374 |
+
of it) with contractual assumptions of liability to the recipient,
|
375 |
+
for any liability that these contractual assumptions directly
|
376 |
+
impose on those licensors and authors.
|
377 |
+
|
378 |
+
All other non-permissive additional terms are considered "further
|
379 |
+
restrictions" within the meaning of section 10. If the Program as you
|
380 |
+
received it, or any part of it, contains a notice stating that it is
|
381 |
+
governed by this License along with a term that is a further
|
382 |
+
restriction, you may remove that term. If a license document contains
|
383 |
+
a further restriction but permits relicensing or conveying under this
|
384 |
+
License, you may add to a covered work material governed by the terms
|
385 |
+
of that license document, provided that the further restriction does
|
386 |
+
not survive such relicensing or conveying.
|
387 |
+
|
388 |
+
If you add terms to a covered work in accord with this section, you
|
389 |
+
must place, in the relevant source files, a statement of the
|
390 |
+
additional terms that apply to those files, or a notice indicating
|
391 |
+
where to find the applicable terms.
|
392 |
+
|
393 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
394 |
+
form of a separately written license, or stated as exceptions; the
|
395 |
+
above requirements apply either way.
|
396 |
+
|
397 |
+
### 8. Termination.
|
398 |
+
|
399 |
+
You may not propagate or modify a covered work except as expressly
|
400 |
+
provided under this License. Any attempt otherwise to propagate or
|
401 |
+
modify it is void, and will automatically terminate your rights under
|
402 |
+
this License (including any patent licenses granted under the third
|
403 |
+
paragraph of section 11).
|
404 |
+
|
405 |
+
However, if you cease all violation of this License, then your license
|
406 |
+
from a particular copyright holder is reinstated (a) provisionally,
|
407 |
+
unless and until the copyright holder explicitly and finally
|
408 |
+
terminates your license, and (b) permanently, if the copyright holder
|
409 |
+
fails to notify you of the violation by some reasonable means prior to
|
410 |
+
60 days after the cessation.
|
411 |
+
|
412 |
+
Moreover, your license from a particular copyright holder is
|
413 |
+
reinstated permanently if the copyright holder notifies you of the
|
414 |
+
violation by some reasonable means, this is the first time you have
|
415 |
+
received notice of violation of this License (for any work) from that
|
416 |
+
copyright holder, and you cure the violation prior to 30 days after
|
417 |
+
your receipt of the notice.
|
418 |
+
|
419 |
+
Termination of your rights under this section does not terminate the
|
420 |
+
licenses of parties who have received copies or rights from you under
|
421 |
+
this License. If your rights have been terminated and not permanently
|
422 |
+
reinstated, you do not qualify to receive new licenses for the same
|
423 |
+
material under section 10.
|
424 |
+
|
425 |
+
### 9. Acceptance Not Required for Having Copies.
|
426 |
+
|
427 |
+
You are not required to accept this License in order to receive or run
|
428 |
+
a copy of the Program. Ancillary propagation of a covered work
|
429 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
430 |
+
to receive a copy likewise does not require acceptance. However,
|
431 |
+
nothing other than this License grants you permission to propagate or
|
432 |
+
modify any covered work. These actions infringe copyright if you do
|
433 |
+
not accept this License. Therefore, by modifying or propagating a
|
434 |
+
covered work, you indicate your acceptance of this License to do so.
|
435 |
+
|
436 |
+
### 10. Automatic Licensing of Downstream Recipients.
|
437 |
+
|
438 |
+
Each time you convey a covered work, the recipient automatically
|
439 |
+
receives a license from the original licensors, to run, modify and
|
440 |
+
propagate that work, subject to this License. You are not responsible
|
441 |
+
for enforcing compliance by third parties with this License.
|
442 |
+
|
443 |
+
An "entity transaction" is a transaction transferring control of an
|
444 |
+
organization, or substantially all assets of one, or subdividing an
|
445 |
+
organization, or merging organizations. If propagation of a covered
|
446 |
+
work results from an entity transaction, each party to that
|
447 |
+
transaction who receives a copy of the work also receives whatever
|
448 |
+
licenses to the work the party's predecessor in interest had or could
|
449 |
+
give under the previous paragraph, plus a right to possession of the
|
450 |
+
Corresponding Source of the work from the predecessor in interest, if
|
451 |
+
the predecessor has it or can get it with reasonable efforts.
|
452 |
+
|
453 |
+
You may not impose any further restrictions on the exercise of the
|
454 |
+
rights granted or affirmed under this License. For example, you may
|
455 |
+
not impose a license fee, royalty, or other charge for exercise of
|
456 |
+
rights granted under this License, and you may not initiate litigation
|
457 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
458 |
+
any patent claim is infringed by making, using, selling, offering for
|
459 |
+
sale, or importing the Program or any portion of it.
|
460 |
+
|
461 |
+
### 11. Patents.
|
462 |
+
|
463 |
+
A "contributor" is a copyright holder who authorizes use under this
|
464 |
+
License of the Program or a work on which the Program is based. The
|
465 |
+
work thus licensed is called the contributor's "contributor version".
|
466 |
+
|
467 |
+
A contributor's "essential patent claims" are all patent claims owned
|
468 |
+
or controlled by the contributor, whether already acquired or
|
469 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
470 |
+
by this License, of making, using, or selling its contributor version,
|
471 |
+
but do not include claims that would be infringed only as a
|
472 |
+
consequence of further modification of the contributor version. For
|
473 |
+
purposes of this definition, "control" includes the right to grant
|
474 |
+
patent sublicenses in a manner consistent with the requirements of
|
475 |
+
this License.
|
476 |
+
|
477 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
478 |
+
patent license under the contributor's essential patent claims, to
|
479 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
480 |
+
propagate the contents of its contributor version.
|
481 |
+
|
482 |
+
In the following three paragraphs, a "patent license" is any express
|
483 |
+
agreement or commitment, however denominated, not to enforce a patent
|
484 |
+
(such as an express permission to practice a patent or covenant not to
|
485 |
+
sue for patent infringement). To "grant" such a patent license to a
|
486 |
+
party means to make such an agreement or commitment not to enforce a
|
487 |
+
patent against the party.
|
488 |
+
|
489 |
+
If you convey a covered work, knowingly relying on a patent license,
|
490 |
+
and the Corresponding Source of the work is not available for anyone
|
491 |
+
to copy, free of charge and under the terms of this License, through a
|
492 |
+
publicly available network server or other readily accessible means,
|
493 |
+
then you must either (1) cause the Corresponding Source to be so
|
494 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
495 |
+
patent license for this particular work, or (3) arrange, in a manner
|
496 |
+
consistent with the requirements of this License, to extend the patent
|
497 |
+
license to downstream recipients. "Knowingly relying" means you have
|
498 |
+
actual knowledge that, but for the patent license, your conveying the
|
499 |
+
covered work in a country, or your recipient's use of the covered work
|
500 |
+
in a country, would infringe one or more identifiable patents in that
|
501 |
+
country that you have reason to believe are valid.
|
502 |
+
|
503 |
+
If, pursuant to or in connection with a single transaction or
|
504 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
505 |
+
covered work, and grant a patent license to some of the parties
|
506 |
+
receiving the covered work authorizing them to use, propagate, modify
|
507 |
+
or convey a specific copy of the covered work, then the patent license
|
508 |
+
you grant is automatically extended to all recipients of the covered
|
509 |
+
work and works based on it.
|
510 |
+
|
511 |
+
A patent license is "discriminatory" if it does not include within the
|
512 |
+
scope of its coverage, prohibits the exercise of, or is conditioned on
|
513 |
+
the non-exercise of one or more of the rights that are specifically
|
514 |
+
granted under this License. You may not convey a covered work if you
|
515 |
+
are a party to an arrangement with a third party that is in the
|
516 |
+
business of distributing software, under which you make payment to the
|
517 |
+
third party based on the extent of your activity of conveying the
|
518 |
+
work, and under which the third party grants, to any of the parties
|
519 |
+
who would receive the covered work from you, a discriminatory patent
|
520 |
+
license (a) in connection with copies of the covered work conveyed by
|
521 |
+
you (or copies made from those copies), or (b) primarily for and in
|
522 |
+
connection with specific products or compilations that contain the
|
523 |
+
covered work, unless you entered into that arrangement, or that patent
|
524 |
+
license was granted, prior to 28 March 2007.
|
525 |
+
|
526 |
+
Nothing in this License shall be construed as excluding or limiting
|
527 |
+
any implied license or other defenses to infringement that may
|
528 |
+
otherwise be available to you under applicable patent law.
|
529 |
+
|
530 |
+
### 12. No Surrender of Others' Freedom.
|
531 |
+
|
532 |
+
If conditions are imposed on you (whether by court order, agreement or
|
533 |
+
otherwise) that contradict the conditions of this License, they do not
|
534 |
+
excuse you from the conditions of this License. If you cannot convey a
|
535 |
+
covered work so as to satisfy simultaneously your obligations under
|
536 |
+
this License and any other pertinent obligations, then as a
|
537 |
+
consequence you may not convey it at all. For example, if you agree to
|
538 |
+
terms that obligate you to collect a royalty for further conveying
|
539 |
+
from those to whom you convey the Program, the only way you could
|
540 |
+
satisfy both those terms and this License would be to refrain entirely
|
541 |
+
from conveying the Program.
|
542 |
+
|
543 |
+
### 13. Remote Network Interaction; Use with the GNU General Public License.
|
544 |
+
|
545 |
+
Notwithstanding any other provision of this License, if you modify the
|
546 |
+
Program, your modified version must prominently offer all users
|
547 |
+
interacting with it remotely through a computer network (if your
|
548 |
+
version supports such interaction) an opportunity to receive the
|
549 |
+
Corresponding Source of your version by providing access to the
|
550 |
+
Corresponding Source from a network server at no charge, through some
|
551 |
+
standard or customary means of facilitating copying of software. This
|
552 |
+
Corresponding Source shall include the Corresponding Source for any
|
553 |
+
work covered by version 3 of the GNU General Public License that is
|
554 |
+
incorporated pursuant to the following paragraph.
|
555 |
+
|
556 |
+
Notwithstanding any other provision of this License, you have
|
557 |
+
permission to link or combine any covered work with a work licensed
|
558 |
+
under version 3 of the GNU General Public License into a single
|
559 |
+
combined work, and to convey the resulting work. The terms of this
|
560 |
+
License will continue to apply to the part which is the covered work,
|
561 |
+
but the work with which it is combined will remain governed by version
|
562 |
+
3 of the GNU General Public License.
|
563 |
+
|
564 |
+
### 14. Revised Versions of this License.
|
565 |
+
|
566 |
+
The Free Software Foundation may publish revised and/or new versions
|
567 |
+
of the GNU Affero General Public License from time to time. Such new
|
568 |
+
versions will be similar in spirit to the present version, but may
|
569 |
+
differ in detail to address new problems or concerns.
|
570 |
+
|
571 |
+
Each version is given a distinguishing version number. If the Program
|
572 |
+
specifies that a certain numbered version of the GNU Affero General
|
573 |
+
Public License "or any later version" applies to it, you have the
|
574 |
+
option of following the terms and conditions either of that numbered
|
575 |
+
version or of any later version published by the Free Software
|
576 |
+
Foundation. If the Program does not specify a version number of the
|
577 |
+
GNU Affero General Public License, you may choose any version ever
|
578 |
+
published by the Free Software Foundation.
|
579 |
+
|
580 |
+
If the Program specifies that a proxy can decide which future versions
|
581 |
+
of the GNU Affero General Public License can be used, that proxy's
|
582 |
+
public statement of acceptance of a version permanently authorizes you
|
583 |
+
to choose that version for the Program.
|
584 |
+
|
585 |
+
Later license versions may give you additional or different
|
586 |
+
permissions. However, no additional obligations are imposed on any
|
587 |
+
author or copyright holder as a result of your choosing to follow a
|
588 |
+
later version.
|
589 |
+
|
590 |
+
### 15. Disclaimer of Warranty.
|
591 |
+
|
592 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
593 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
594 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
|
595 |
+
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
|
596 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
597 |
+
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
|
598 |
+
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
599 |
+
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
600 |
+
CORRECTION.
|
601 |
+
|
602 |
+
### 16. Limitation of Liability.
|
603 |
+
|
604 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
605 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
|
606 |
+
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
607 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
608 |
+
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
|
609 |
+
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
|
610 |
+
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
|
611 |
+
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
612 |
+
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
613 |
+
|
614 |
+
### 17. Interpretation of Sections 15 and 16.
|
615 |
+
|
616 |
+
If the disclaimer of warranty and limitation of liability provided
|
617 |
+
above cannot be given local legal effect according to their terms,
|
618 |
+
reviewing courts shall apply local law that most closely approximates
|
619 |
+
an absolute waiver of all civil liability in connection with the
|
620 |
+
Program, unless a warranty or assumption of liability accompanies a
|
621 |
+
copy of the Program in return for a fee.
|
622 |
+
|
623 |
+
END OF TERMS AND CONDITIONS
|
624 |
+
|
625 |
+
## How to Apply These Terms to Your New Programs
|
626 |
+
|
627 |
+
If you develop a new program, and you want it to be of the greatest
|
628 |
+
possible use to the public, the best way to achieve this is to make it
|
629 |
+
free software which everyone can redistribute and change under these
|
630 |
+
terms.
|
631 |
+
|
632 |
+
To do so, attach the following notices to the program. It is safest to
|
633 |
+
attach them to the start of each source file to most effectively state
|
634 |
+
the exclusion of warranty; and each file should have at least the
|
635 |
+
"copyright" line and a pointer to where the full notice is found.
|
636 |
+
|
637 |
+
<one line to give the program's name and a brief idea of what it does.>
|
638 |
+
Copyright (C) <year> <name of author>
|
639 |
+
|
640 |
+
This program is free software: you can redistribute it and/or modify
|
641 |
+
it under the terms of the GNU Affero General Public License as
|
642 |
+
published by the Free Software Foundation, either version 3 of the
|
643 |
+
License, or (at your option) any later version.
|
644 |
+
|
645 |
+
This program is distributed in the hope that it will be useful,
|
646 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
647 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
648 |
+
GNU Affero General Public License for more details.
|
649 |
+
|
650 |
+
You should have received a copy of the GNU Affero General Public License
|
651 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
652 |
+
|
653 |
+
Also add information on how to contact you by electronic and paper
|
654 |
+
mail.
|
655 |
+
|
656 |
+
If your software can interact with users remotely through a computer
|
657 |
+
network, you should also make sure that it provides a way for users to
|
658 |
+
get its source. For example, if your program is a web application, its
|
659 |
+
interface could display a "Source" link that leads users to an archive
|
660 |
+
of the code. There are many ways you could offer source, and different
|
661 |
+
solutions will be better for different programs; see section 13 for
|
662 |
+
the specific requirements.
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or
|
665 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
666 |
+
necessary. For more information on this, and how to apply and follow
|
667 |
+
the GNU AGPL, see <https://www.gnu.org/licenses/>.
|
NOTICE.md
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
Omnitool.ai utilizes a variety of open-source software components.
|
2 |
+
Presented in the file THIRD_PARTIES.md and, if present, THIRD_PARTIES_ADDITIONAL.md, is a list of these components, along with the complete texts of their corresponding license agreements.
|
3 |
+
Relevant information regarding the third-party vendors mentioned in THIRD_PARTIES.md and, if present, THIRD_PARTIES_ADDITIONAL.md has been gathered through common and reasonable methods.
|
ORIGIN.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
https://github.com/omnitool-ai/omnitool
|
README.md
CHANGED
@@ -7,5 +7,309 @@ sdk: docker
|
|
7 |
pinned: false
|
8 |
license: agpl-3.0
|
9 |
---
|
|
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
pinned: false
|
8 |
license: agpl-3.0
|
9 |
---
|
10 |
+
# Omnitool.ai - Your Open Source AI Desktop
|
11 |
|
12 |
+
*Discover, Learn, Evaluate and Build with thousands of Generative AI Models.*
|
13 |
+
|
14 |
+
Omnitool.ai is an open-source, downloadable "AI Lab in a box" built for learners, enthusiasts and anyone with interest in the current wave of AI innovation. It provides an extensible browser based desktop environment for streamlined, hands-on interacting with the latest AI models from OpenAI, replicate.com, Stable Diffusion, Google, or other leading providers through a single, unified interface.
|
15 |
+
|
16 |
+

|
17 |
+
|
18 |
+
Watch the [demo](https://tinyurl.com/omnitool-demo)! and see more [videos](https://www.youtube.com/@OmnitoolAI/videos) on our Youtube channel.
|
19 |
+
|
20 |
+
## Why Omnitool?
|
21 |
+
|
22 |
+
With thousands of preprints and countless "AI tools" released each week, it is incredibly challenging to stay on top of the rapidly evolving AI ecosystem, to separate hype and facts and to extract durable long term skills and learning. PapersWithCode and GitHub repositories attached to arXiv papers provide ability to hands-on validate and apply the latest discoveries, but the fragile nature of the Python ecosystem and often steep hardware requirments dramatically limits accessibility. Likewise implementing and testing cloud based models requires delving deep into API documentation and wrestling with connecting code.
|
23 |
+
|
24 |
+
We believe that is a serious problem. AI may represent the first large scale technological disruption unbounded by logistical challenges, scaling along existing wires, API infastructure and app delivery platforms. Meanwhile, market pressure to adopt AI is felt by many businesses and teams.
|
25 |
+
|
26 |
+
Without educated decision makers and technical experts, businesses and public organisations alike are at high risk of falling for hype and magical narratives and expensive misadventures.
|
27 |
+
|
28 |
+
Omnitool is our attempt to improve this situation: A **single, unified interface** capable of connecting with as many AI models as possible and to **reduce the "time to hands on AI" to an absolute minimum**.
|
29 |
+
|
30 |
+
Omnitool is **highly extensible and interoperable**. Most OpenAPI3 based services can be connected and turned into "blocks" without writing code. It's extension framework enables deeper integrations of anything from custom UIs (Like Stability Dream Studio) to Game Engines (like BabyonJS or Phaser) to [Image manipulation libraries](https://github.com/georgzoeller/omni-extension-sharp/blob/master/README.md).
|
31 |
+
|
32 |
+
|
33 |
+
## What Omnitool is NOT
|
34 |
+
|
35 |
+
- Omnitool is **not a multi-user cloud SaaS product**. It's a downloadable, locally installed product.
|
36 |
+
- Omnitool is **NOT a no-code solution** meant to replace coding or enable non engineers to code. It's focused on interacting with AI use cases, not writing general purpose software.
|
37 |
+
- Omnitool is **not production/enterprise software**. (Yet.) It's a lab optimizing for access to the latest technologies over stability and, as with any lab, things may blow up from time to time.
|
38 |
+
|
39 |
+
|
40 |
+
## Table of Contents
|
41 |
+
|
42 |
+
- [Key Features](#key-features)
|
43 |
+
- [Quickstart](#quickstart-guide)
|
44 |
+
- [Manual Install](#manual-install)
|
45 |
+
- [PocketBase DB Admin (ADVANCED)](#pocketbase-db-admin-advanced)
|
46 |
+
- [Next Steps](#next-steps)
|
47 |
+
- [Changelist](#changelist)
|
48 |
+
|
49 |
+
## Key Features
|
50 |
+
|
51 |
+
### Self-hosted and Open Source
|
52 |
+
|
53 |
+
* Omnitool is local self-hosted software that turns your machine into a powerful AI Lab.
|
54 |
+
|
55 |
+
* You install Omnitool and it runs on your Mac, Windows or Linux notebook, desktop or server, not cloud servers.
|
56 |
+
* Data stores it's data locally on your machine and is only transmitted to the third party provider APIs you choose to access. Updates are managed via github.
|
57 |
+
* A Docker Image is forthcoming.
|
58 |
+
* If you are interested in running Omnitool in the cloud, please get in touch with us at [email protected]
|
59 |
+
|
60 |
+
* Open Source and Open Standards
|
61 |
+
* Omnitool is licensed as open source software and heavily leverages open standards, such as OpenAPI, making it interoperable and extensible.
|
62 |
+
|
63 |
+
### Rapid Access to the world of generative AI without GPU, Managing Python installations and learning dozens of APIs and interfaces
|
64 |
+
|
65 |
+
* Minimal Time-to-AI: It allows you to try out models and services in minutes without having to study API docs, write boilerplate code, manage python venvs or figuring out new user interfaces. Because of it's integration of many leading AI platforms, the lag time between "paper with code" to hands on experimentation often is cut down to days.
|
66 |
+
|
67 |
+
* It presents the vast world of generative AI - image, video, audio, text, and classification APIS - through a single, unified user interface without oversimplifying or hiding the power of the APIs.
|
68 |
+
|
69 |
+
### Comprehensive AI Provider Support
|
70 |
+
* Seamlessly provides access to 1000s of AI model and utility APIs from an rapidly growing list leading AI providers and aggregators, exposing them all via interoperable blocks.
|
71 |
+
|
72 |
+
Currently supported (v. 0.5.3) :
|
73 |
+
* [Civitai.com](https://civitai.com) (Model metadata access)
|
74 |
+
* [Deepl.com](https://deepl.com) (Document translation)
|
75 |
+
* [ElevenLabs.io](https://elevenlabs.io) (Multilingual voice generation)
|
76 |
+
* Getimg.ai (Image generation and manipulation APIs)
|
77 |
+
* Github.com (Various)
|
78 |
+
* Google.com
|
79 |
+
* Gmail
|
80 |
+
* Vertex (AI)
|
81 |
+
* Google Translate
|
82 |
+
* Google TTS (Text to Speech)
|
83 |
+
* Google Vision (Computer Vision)
|
84 |
+
* [Huggingface.com](https://huggingface.com) (1000's of models, including free inference models)
|
85 |
+
* [OpenAI.com](https://openai.com) (Image/Text/Audio Generation including GPT3/4/Visual, Whisper, Dall-e 2, Dall-e 3, Moderation APIs and more)
|
86 |
+
* [OpenRouter.ai](https://OpenRouter.ai) (100s of LLM APIs)
|
87 |
+
* [Perplexity.ai](https://perplexity.ai) (Text Generation)
|
88 |
+
* [Stability.ai](https://stability.ai) (Image Generation and Manipulation APIs)
|
89 |
+
* [TextSynth.com](https://textsynth.com) (LLM, translation, and classification APIs)
|
90 |
+
* [Replicate.com](https://replicate.com/explore) (1000s of models across all modalities)
|
91 |
+
* [Uberduck.com](https://uberduck.com) (Voice Generation, Music centric offerings)
|
92 |
+
* [Unsplash.com](https://unsplash.com) (Stock imagery)
|
93 |
+
* with many more APIs in testing...
|
94 |
+
|
95 |
+
* Support for the following Open Source APIs is in the final stages of testing:
|
96 |
+
* Automatic1111/SDNext API
|
97 |
+
* Oobabooga Text Generation API
|
98 |
+
* Ollama API
|
99 |
+
|
100 |
+
* Omnitool is able to generate blocks from any openapi.json definitions via URL or directly supplied file. We support a number of custom x- annotations that can be added to openapi definitions to allow omnitool to guide the block generation. It also supports creating "patches" on top of existing APIs to create customized blocks. With integrated JSONATA support, it is possible to build powerful data processing blocks using pure data.
|
101 |
+
|
102 |
+
|
103 |
+
### Extensible Architecture
|
104 |
+
|
105 |
+
* Inspired by the common modding architecture found in video game toolsets, Omnitool is built, from the ground up, to be extensible via multiple mechanisms:
|
106 |
+
* Simple **Client and Server scripts** allowing addition of /commands that are hot-reloaded, so editing and building is a breeze.
|
107 |
+
* **Client Extensions** - any web-app/webpage can be turned into an extension and integrated directly on Omnitool's desktop via it's window system. Omnitool's client SDK exposes the full range of platform functionality to extensions, allowing you to write apps or tools using every API or recipe enabled in Omnitool.
|
108 |
+
* **Server Extensions** - Server extensions written in javascript that can add new blocks, API and core functionality.
|
109 |
+
|
110 |
+
* Some examples of currently available extensions:
|
111 |
+
* omni-core-replicate, a core extensions that allows import of any AI model on [replicate.com](https://replicate.com) into a ready to use block in Omnitool
|
112 |
+
* [omni-extension-sharp](https://github.com/omnitool-community/omni-extension-sharp), an extension adding an array of Image Manipulation blocks such as format conversion, masking, composition and more based on the powerful [sharp](https://github.com/lovell/sharp) image processing library.
|
113 |
+
* omni-extension-minipaint, a powerful [photo editing tool](https://github.com/viliusle/miniPaint) useful for quickly creating and editing images without switching out of the app.
|
114 |
+
* omni-extension-openpose, a [OpenPose based](https://github.com/CMU-Perceptual-Computing-Lab/openpose) pose estimation and generation toolkit useful for creating guidance images for controlnet/diffusion models.
|
115 |
+
* omni-extension-tldraw, a whiteboarding/sketching extension built on [TLDraw](https://github.com/tldraw/tldraw), useful for generating input for visual transformers and diffusion models
|
116 |
+
* omni-extension-wavacity, a [full wasm implementation](https://wavacity.com/) of Audacity, a state of the art audio recorder/editor useful for generating and editing audio content.
|
117 |
+
|
118 |
+
* Visit the Extension tab in app or see our [Omnitool Community Github](https://github.com/orgs/omnitool-community/repositories) for a list of currently available extensions
|
119 |
+
|
120 |
+
|
121 |
+
## Quickstart Guide
|
122 |
+
|
123 |
+
We are currently testing installers for Windows and macOS. Until those are publicly available, please follow the manual installation steps.
|
124 |
+
|
125 |
+
## Manual Install
|
126 |
+
|
127 |
+
This guide will help you download the Omnitool software, and then build and start the Omnitool server in a directory running from your local machine.
|
128 |
+
|
129 |
+
You can then access the Omnitool software from a web browser on your local machine.
|
130 |
+
|
131 |
+
1. **Prerequisites**
|
132 |
+
|
133 |
+
Ensure you have the latest versions of the following sofware installed:
|
134 |
+
|
135 |
+
* [Node.js](https://nodejs.org/en)
|
136 |
+
* [Yarn](https://yarnpkg.com)
|
137 |
+
* [Git](https://en.wikipedia.org/wiki/Git)
|
138 |
+
|
139 |
+
|
140 |
+
2. **Get the Source Code**
|
141 |
+
- Open a terminal
|
142 |
+
- Navigate to where you want Omnitool to be installed
|
143 |
+
- Use the following command:
|
144 |
+
```
|
145 |
+
git clone https://github.com/omnitool-ai/omnitool
|
146 |
+
```
|
147 |
+
|
148 |
+
This will create the `omnitool` folder.
|
149 |
+
|
150 |
+
- Now navigate inside Omnitool's folder. By default:
|
151 |
+
```
|
152 |
+
cd omnitool
|
153 |
+
```
|
154 |
+
|
155 |
+
3. **Install Source Dependencies**
|
156 |
+
|
157 |
+
Run the following command in the root of the repository to install the necessary dependencies:
|
158 |
+
```
|
159 |
+
yarn install
|
160 |
+
```
|
161 |
+
**Troubleshooting**
|
162 |
+
|
163 |
+
* **PYTHON 3.12** - some users are reporting a yarn install failure due to **a missing python module 'distutils'**. To resolve this, we recommend running our fix script to detect and autofix any potential issues and try again. Or you can manually pip install 'setuptools' from the terminal.
|
164 |
+
```
|
165 |
+
node setup\fix.js
|
166 |
+
```
|
167 |
+
|
168 |
+
4. **Build and Start the Server**
|
169 |
+
|
170 |
+
Now we will use `yarn` and `Node.js` to build the server software locally on your machine and then start it running.
|
171 |
+
|
172 |
+
Windows:
|
173 |
+
```
|
174 |
+
start.bat
|
175 |
+
```
|
176 |
+
|
177 |
+
MacOS/Linux:
|
178 |
+
```
|
179 |
+
./start.sh
|
180 |
+
```
|
181 |
+
|
182 |
+
When successful, you will see the following message:
|
183 |
+
|
184 |
+
```
|
185 |
+
◐ Booting Server
|
186 |
+
✔ Server has started and is ready to accept connections on http://127.0.0.1:1688.
|
187 |
+
✔ Ctrl-C to quit.
|
188 |
+
```
|
189 |
+
|
190 |
+
5. **Open Omnitool in a Web Browser**
|
191 |
+
|
192 |
+
Omnitool.ai can now be accessed from:
|
193 |
+
[127.0.0.1:1688](http://127.0.0.1:1688)
|
194 |
+
|
195 |
+
---
|
196 |
+
6. **Explore the Sample Recipes**
|
197 |
+
Use the "Load Recipe" button in the menu to explore different functionality of the platform.
|
198 |
+
|
199 |
+
---
|
200 |
+
7. **Explore the Code**
|
201 |
+
For a list of scripts we use internally, try running:
|
202 |
+
```
|
203 |
+
yarn run
|
204 |
+
```
|
205 |
+
|
206 |
+
## PocketBase DB Admin (ADVANCED)
|
207 |
+
Recipes and various cache data are stored in a [PocketBase](https://pocketbase.io) database.
|
208 |
+
|
209 |
+
If the database is currently running, you can access the default PocketBase admin interface by navigating to [127.0.0.1:8090/_](http://127.0.0.1:8090/_)
|
210 |
+
|
211 |
+
Alternatively, the admin interface can be accessed directly within omnitool. From the main menu, choose the `Database Admin` option and the same interface will open inside the omnitool browser window.
|
212 |
+
|
213 |
+
o log in to the database, use the credentials
|
214 |
+
* Email: **[email protected]**
|
215 |
+
* Password: **[email protected]**
|
216 |
+
|
217 |
+
Once logged in, you can directly modify records using the PocketBase admin interface. This is particularly useful for advanced configurations and troubleshooting.
|
218 |
+
|
219 |
+
### Reset Local PocketBase Storage (ADVANCED)
|
220 |
+
|
221 |
+
There may be occasions when you need to reset your local database, either to recover from an invalid state or to start with a fresh install.
|
222 |
+
|
223 |
+
For Linux:
|
224 |
+
```bash
|
225 |
+
rm -rf ./local.bin
|
226 |
+
yarn start
|
227 |
+
```
|
228 |
+
For Windows:
|
229 |
+
```cmd
|
230 |
+
rmdir /s /q .\local.bin
|
231 |
+
yarn start
|
232 |
+
```
|
233 |
+
|
234 |
+
- **Warning**:
|
235 |
+
- **ALL YOUR LOCAL RECIPES, GENERATED IMAGES, DOCUMENTS, AUDIO ETC, WILL BE PERMANENTLY ERASED**
|
236 |
+
|
237 |
+
## Generating a JWT Token
|
238 |
+
|
239 |
+
Our service allows you to generate a JWT by running a specific script designed for this purpose. The script's signature is as follows:
|
240 |
+
|
241 |
+
```
|
242 |
+
/generateJwtToken <action> <subject> <expires_in>
|
243 |
+
```
|
244 |
+
|
245 |
+
**Parameters**
|
246 |
+
|
247 |
+
- `<action>`: This is a string parameter identifying the intended action to be performed. In the context of running recipes, this should be set to exec.
|
248 |
+
- `<subject>`: This is a string parameter that specifies the subject of the JWT. This could be the recipe that you intend to execute.
|
249 |
+
- `<expires_in>`: This is an integer parameter that determines the token's validity period in milliseconds.
|
250 |
+
|
251 |
+
**Example**
|
252 |
+
|
253 |
+
To generate a JWT for executing a recipe with a validity of 30,000 milliseconds (or 30 seconds), you would run the following script:
|
254 |
+
|
255 |
+
```
|
256 |
+
/generateJwtToken exec Workflow 30000
|
257 |
+
```
|
258 |
+
|
259 |
+
**Output**
|
260 |
+
|
261 |
+
The script will output a JWT, which is a token string to be used in the authorization header for your API requests.
|
262 |
+
|
263 |
+
### Executing a recipe with JWT Authentication
|
264 |
+
|
265 |
+
Once you have your JWT, you can execute a recipe by making a POST request to the recipe execution API. This request must include the JWT in the Authorization header.
|
266 |
+
|
267 |
+
**Endpoint**
|
268 |
+
|
269 |
+
```
|
270 |
+
POST http://127.0.0.1:1688/api/v1/workflow/exec
|
271 |
+
```
|
272 |
+
|
273 |
+
**Header**
|
274 |
+
|
275 |
+
```
|
276 |
+
Authorization: Bearer <token>
|
277 |
+
```
|
278 |
+
|
279 |
+
`<token>` is the JWT acquired from the /generateJwtToken script.
|
280 |
+
|
281 |
+
**Curl Example**
|
282 |
+
|
283 |
+
To make the request using curl, you would use the following command, replacing <token> with your actual JWT:
|
284 |
+
|
285 |
+
```
|
286 |
+
curl -X POST http://127.0.0.1:1688/api/v1/workflow/exec -H "Authorization: Bearer <token>"
|
287 |
+
```
|
288 |
+
|
289 |
+
**Response**
|
290 |
+
|
291 |
+
Upon success, the API will initiate the specified recipe. You will receive a JSON response containing details about the recipe's execution status, including any outputs or errors.
|
292 |
+
|
293 |
+
**Security Considerations**
|
294 |
+
|
295 |
+
- Keep your JWT secure to prevent unauthorized access to your recipes.
|
296 |
+
- Always use a secure connection to interact with the APIs.
|
297 |
+
- Regularly rotate your tokens and use a short expiration time to minimize the impact of potential leaks.
|
298 |
+
|
299 |
+
**Troubleshooting**
|
300 |
+
|
301 |
+
* If you encounter authorization errors, ensure the JWT has not expired, is correctly set in the header, and was generated with the proper parameters.
|
302 |
+
|
303 |
+
## Next Steps
|
304 |
+
|
305 |
+
1. Join the Omnitool.ai Discord Community
|
306 |
+
|
307 |
+
Interact with fellow users, share your experiences, ask questions, and be a part of our active and growing community on [Discord](https://tinyurl.com/omnitool-discord).
|
308 |
+
|
309 |
+
2. Contribute to Omnitool.ai
|
310 |
+
|
311 |
+
As an open-source platform, we welcome contributions from users like you. Whether it's improving documentation, adding new features, or simply sharing your unique use cases, your input is invaluable to us. Simply send us a pull-request and we'll be in contact.
|
312 |
+
|
313 |
+
3. Feedback and Suggestions
|
314 |
+
|
315 |
+
Your feedback helps shape the future of Omnitool.ai. Send your feedback and suggestions to [[email protected]](mailto:[email protected]), or share them directly in our [Discord #feedback channel](https://tinyurl.com/omnitool-feedback).
|
SOURCE.md
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
Unless you have obtained this software directly from MERCENARIES PTE. LTD. under the terms of a specific commercial license agreement, Omnitool.ai is provided to you under the GNU Affero General Public License version 3 (a.k.a. AGPLv3) license, the full text of which is included in the LICENSE.md file.
|
2 |
+
The file ORIGIN.md lists the URL of the latest version of the source code of Omnitool.ai.
|
THIRD_PARTIES.md
ADDED
The diff for this file is too large to render.
See raw diff
|
|
THIRD_PARTIES_ADDITIONAL.md
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
https://github.com/feathericons/feather
|
2 |
+
|
3 |
+
The MIT License (MIT)
|
4 |
+
|
5 |
+
Copyright (c) 2013-2023 Cole Bemis
|
6 |
+
|
7 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8 |
+
of this software and associated documentation files (the "Software"), to deal
|
9 |
+
in the Software without restriction, including without limitation the rights
|
10 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11 |
+
copies of the Software, and to permit persons to whom the Software is
|
12 |
+
furnished to do so, subject to the following conditions:
|
13 |
+
|
14 |
+
The above copyright notice and this permission notice shall be included in all
|
15 |
+
copies or substantial portions of the Software.
|
16 |
+
|
17 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23 |
+
SOFTWARE.
|
24 |
+
|
25 |
+
---
|
docker_build.sh
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
docker build -t fastapi .
|
4 |
+
docker run -it -p 7860:7860 fastapi
|
launch.js
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const fastify = require('fastify')({ logger: true });
|
2 |
+
const http = require('http');
|
3 |
+
const { spawn } = require('child_process');
|
4 |
+
|
5 |
+
const PROXY_PORT = 7860; // Change this to a port different from 1688
|
6 |
+
const TARGET_HOST = '127.0.0.1';
|
7 |
+
const TARGET_PORT = 1688;
|
8 |
+
|
9 |
+
// Function to start the request forwarding server
|
10 |
+
async function startRequestForwardingServer() {
|
11 |
+
const server = http.createServer((req, res) => {
|
12 |
+
const options = {
|
13 |
+
hostname: TARGET_HOST,
|
14 |
+
port: TARGET_PORT,
|
15 |
+
path: req.url,
|
16 |
+
method: req.method,
|
17 |
+
headers: req.headers,
|
18 |
+
};
|
19 |
+
|
20 |
+
const proxy = http.request(options, (proxyRes) => {
|
21 |
+
res.writeHead(proxyRes.statusCode, proxyRes.headers);
|
22 |
+
proxyRes.pipe(res, { end: true });
|
23 |
+
});
|
24 |
+
|
25 |
+
req.pipe(proxy, { end: true });
|
26 |
+
});
|
27 |
+
|
28 |
+
server.listen(PROXY_PORT, '0.0.0.0');
|
29 |
+
console.log(`Request forwarding server listening on port ${PROXY_PORT}`);
|
30 |
+
}
|
31 |
+
|
32 |
+
// Function to start the background process
|
33 |
+
function startYarnStartProcess() {
|
34 |
+
const child = spawn('yarn', ['start'], {
|
35 |
+
detached: true,
|
36 |
+
stdio: 'ignore'
|
37 |
+
});
|
38 |
+
|
39 |
+
child.unref();
|
40 |
+
}
|
41 |
+
|
42 |
+
// Main function to start everything
|
43 |
+
async function startServers() {
|
44 |
+
try {
|
45 |
+
startYarnStartProcess();
|
46 |
+
await startRequestForwardingServer();
|
47 |
+
} catch (error) {
|
48 |
+
console.error('Failed to start servers:', error);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
// Start the servers
|
53 |
+
startServers();
|
omnitool_start.sh
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Set PATH explicitly
|
4 |
+
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
5 |
+
echo "Current PATH: $PATH"
|
6 |
+
/usr/local/bin/node -v
|
7 |
+
|
8 |
+
# Print the current user
|
9 |
+
echo "Current user: $(whoami)"
|
10 |
+
|
11 |
+
# Print environment variables
|
12 |
+
echo "Environment variables:"
|
13 |
+
printenv
|
14 |
+
|
15 |
+
git pull
|
16 |
+
|
17 |
+
# Run yarn commands
|
18 |
+
yarn start "$@" # Pass all arguments to yarn start
|
package.json
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "omnitool",
|
3 |
+
"version": "0.5.4",
|
4 |
+
"packageManager": "[email protected]",
|
5 |
+
"private": true,
|
6 |
+
"workspaces": [
|
7 |
+
"packages/omni-sdk",
|
8 |
+
"packages/omni-shared",
|
9 |
+
"packages/omni-sockets",
|
10 |
+
"packages/omni-ui/omni-*",
|
11 |
+
"packages/omni-server"
|
12 |
+
],
|
13 |
+
"engines": {
|
14 |
+
"node": ">=18.18.0",
|
15 |
+
"pocketbase": "0.16.6"
|
16 |
+
},
|
17 |
+
"scripts": {
|
18 |
+
"build:prod": "yarn workspaces foreach -t -v run build:prod",
|
19 |
+
"build": "yarn workspaces foreach -t -v run build",
|
20 |
+
"frontend": "yarn workspace omni-web dev",
|
21 |
+
"update": "git pull && yarn install && run clean && run build",
|
22 |
+
"dev": "cross-env NODE_ENV=development node setup/launcher.js -l 127.0.0.1 --viteProxy http://127.0.0.1:5173",
|
23 |
+
"start": "run build:prod && cross-env NODE_ENV=production node setup/launcher.js -l 127.0.0.1 -rb",
|
24 |
+
"clean": "yarn workspaces foreach -A -p -v run clean"
|
25 |
+
},
|
26 |
+
"dependenciesMeta": {
|
27 |
+
"[email protected]": {
|
28 |
+
"unplugged": true
|
29 |
+
}
|
30 |
+
},
|
31 |
+
"dependenciesBin": {
|
32 |
+
"updates_base_url": "https://github.com/omnitool-ai/omnitool/releases/download/latest",
|
33 |
+
"root_dir": ".local.bin",
|
34 |
+
"pocketbase": {
|
35 |
+
"admin": "[email protected]",
|
36 |
+
"base_url": "https://github.com/pocketbase/pocketbase/releases/download/v##version##",
|
37 |
+
"zipfile": {
|
38 |
+
"win32": {
|
39 |
+
"x64": "pocketbase_##version##_windows_amd64.zip",
|
40 |
+
"arm64": "pocketbase_##version##_windows_arm64.zip"
|
41 |
+
},
|
42 |
+
"darwin": {
|
43 |
+
"x64": "pocketbase_##version##_darwin_amd64.zip",
|
44 |
+
"arm64": "pocketbase_##version##_darwin_arm64.zip"
|
45 |
+
},
|
46 |
+
"linux": {
|
47 |
+
"x64": "pocketbase_##version##_linux_amd64.zip",
|
48 |
+
"arm64": "pocketbase_##version##_linux_arm64.zip"
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
},
|
53 |
+
"dependencies": {
|
54 |
+
"@ungap/structured-clone": "^1.2.0",
|
55 |
+
"adm-zip": "^0.5.10",
|
56 |
+
"compare-versions": "^6.1.0",
|
57 |
+
"cross-env": "^7.0.3",
|
58 |
+
"fs-extra": "^11.1.1"
|
59 |
+
},
|
60 |
+
"devDependencies": {
|
61 |
+
"eslint": "^8.53.0",
|
62 |
+
"eslint-config-prettier": "^9.0.0",
|
63 |
+
"eslint-plugin-prettier": "^5.0.1",
|
64 |
+
"prettier": "^3.0.3"
|
65 |
+
}
|
66 |
+
}
|
packages/omni-sdk/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
lib/
|
packages/omni-sdk/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Omni SDK
|
2 |
+
|
3 |
+
|
4 |
+
## Omni SDK Client (Use for extensions in the browser)
|
5 |
+
|
6 |
+
To use the client within an extension, add the following to the start of the
|
7 |
+
|
8 |
+
```javascript
|
9 |
+
const extensionId = "my-extension-id"
|
10 |
+
const sdk = new OmniSDKClient(extensionId).init();
|
11 |
+
```
|
12 |
+
|
13 |
+
|
14 |
+
### Running Scripts
|
15 |
+
|
16 |
+
Run an extension server script (`located in extensions\<extension-id>\scripts\server`), use `sdk.runExtensionScript`
|
17 |
+
|
18 |
+
|
19 |
+
```javascript
|
20 |
+
const scriptName = "myScript"
|
21 |
+
const result = await sdk.runExtensionScript(scriptName, {a: 1, b: "2"});
|
22 |
+
```
|
23 |
+
|
24 |
+
|
25 |
+
## Sending Chat Messages
|
26 |
+
|
27 |
+
To trigger a chat message to the user, use `sdk.sendChat`
|
28 |
+
|
29 |
+
```javascript
|
30 |
+
|
31 |
+
// Add a button that executes the /help command when pressed
|
32 |
+
const attachments =
|
33 |
+
{
|
34 |
+
commands: [
|
35 |
+
'title': 'Help'
|
36 |
+
'id': 'help'
|
37 |
+
],
|
38 |
+
images:
|
39 |
+
[
|
40 |
+
{ ...image object... }
|
41 |
+
]
|
42 |
+
}
|
43 |
+
|
44 |
+
const result = await sdk.sendChat('Message', 'text/markdown', attachments)
|
45 |
+
```
|
46 |
+
|
47 |
+
|
48 |
+
|
packages/omni-sdk/build.js
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
|
3 |
+
* All rights reserved.
|
4 |
+
*/
|
5 |
+
|
6 |
+
import esbuild from 'esbuild';
|
7 |
+
import assert from 'node:assert';
|
8 |
+
|
9 |
+
const environment = process.argv[2];
|
10 |
+
assert(environment === 'production' || environment === 'development', 'Invalid environment ' + environment);
|
11 |
+
|
12 |
+
console.log(`Building omni-sdk (${environment})...`);
|
13 |
+
esbuild
|
14 |
+
.build({
|
15 |
+
entryPoints: ['src/index.ts'],
|
16 |
+
outdir: 'lib',
|
17 |
+
format: 'esm',
|
18 |
+
bundle: true,
|
19 |
+
platform: 'node',
|
20 |
+
tsconfig: 'tsconfig.json',
|
21 |
+
logLevel: 'warning',
|
22 |
+
target: 'es2020',
|
23 |
+
minify: true,
|
24 |
+
sourcemap: true,
|
25 |
+
define: {
|
26 |
+
'process.env.NODE_ENV': `"${environment}"`
|
27 |
+
}
|
28 |
+
})
|
29 |
+
.then(() => console.log('Building omni-sdk done'))
|
30 |
+
.catch(() => process.exit(1));
|
packages/omni-sdk/package.json
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "omni-sdk",
|
3 |
+
"packageManager": "[email protected]",
|
4 |
+
"version": "0.5.4",
|
5 |
+
"type": "module",
|
6 |
+
"main": "./lib/index.js",
|
7 |
+
"types": "./lib/index.d.ts",
|
8 |
+
"include": [
|
9 |
+
"./src/**/*"
|
10 |
+
],
|
11 |
+
"files": [
|
12 |
+
"./lib/"
|
13 |
+
],
|
14 |
+
"devDependencies": {
|
15 |
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
16 |
+
"@typescript-eslint/parser": "^5.62.0",
|
17 |
+
"esbuild": "^0.19.5",
|
18 |
+
"eslint": "^8.53.0",
|
19 |
+
"eslint-config-standard-with-typescript": "^36.1.1",
|
20 |
+
"eslint-plugin-import": "^2.29.0",
|
21 |
+
"eslint-plugin-n": "^15.7.0",
|
22 |
+
"eslint-plugin-prettier": "^4.2.1",
|
23 |
+
"eslint-plugin-promise": "^6.1.1",
|
24 |
+
"prettier": "^3.0.3",
|
25 |
+
"typescript": "^5.2.2"
|
26 |
+
},
|
27 |
+
"scripts": {
|
28 |
+
"build": "node build.js development && yarn build:types",
|
29 |
+
"build:prod": "node build.js production && yarn build:types",
|
30 |
+
"build:types": "echo \"Building omni_sdk typescript declarations...\" && tsc --build --pretty --emitDeclarationOnly"
|
31 |
+
},
|
32 |
+
"dependencies": {
|
33 |
+
"emittery": "^1.0.1",
|
34 |
+
"handlebars": "^4.7.8",
|
35 |
+
"marked": "^9.1.5"
|
36 |
+
}
|
37 |
+
}
|
packages/omni-sdk/src/MarkdownEngine.ts
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
|
3 |
+
* All rights reserved.
|
4 |
+
*/
|
5 |
+
|
6 |
+
import Handlebars, { HelperDelegate } from 'handlebars';
|
7 |
+
import { marked } from 'marked';
|
8 |
+
|
9 |
+
const mdRenderer = new marked.Renderer();
|
10 |
+
mdRenderer.link = function (href, title, text) {
|
11 |
+
const link = marked.Renderer.prototype.link.apply(this, arguments as any);
|
12 |
+
return link.replace('<a', "<a target='_blank'");
|
13 |
+
};
|
14 |
+
|
15 |
+
class MarkdownEngine {
|
16 |
+
handlebars: typeof Handlebars;
|
17 |
+
SafeString: typeof Handlebars.SafeString = Handlebars.SafeString;
|
18 |
+
private asyncResolvers: { [directive: string]: (token: string) => Promise<any> } = {};
|
19 |
+
|
20 |
+
constructor() {
|
21 |
+
this.handlebars = Handlebars.create();
|
22 |
+
}
|
23 |
+
|
24 |
+
registerAsyncResolver(directive: string, resolverFunction: (token: string) => Promise<any>) {
|
25 |
+
this.asyncResolvers[directive] = resolverFunction;
|
26 |
+
}
|
27 |
+
|
28 |
+
registerToken(tokenName: string, resolver: HelperDelegate) {
|
29 |
+
this.handlebars.registerHelper(tokenName, resolver);
|
30 |
+
}
|
31 |
+
|
32 |
+
async getAsyncDataForDirective(directive: string, token: string): Promise<any> {
|
33 |
+
const resolver = await this.asyncResolvers[directive];
|
34 |
+
if (!resolver) {
|
35 |
+
throw new Error(`No resolver registered for directive: ${directive}`);
|
36 |
+
}
|
37 |
+
return await resolver(token);
|
38 |
+
}
|
39 |
+
|
40 |
+
extractDirectiveData(statement: any): { name?: string; param?: string } {
|
41 |
+
if (statement.type === 'MustacheStatement' || statement.type === 'BlockStatement') {
|
42 |
+
const name = statement.path?.original;
|
43 |
+
const param = statement.params?.[0]?.original;
|
44 |
+
|
45 |
+
return {
|
46 |
+
name,
|
47 |
+
param
|
48 |
+
};
|
49 |
+
}
|
50 |
+
|
51 |
+
return {};
|
52 |
+
}
|
53 |
+
|
54 |
+
async preprocessData(content: string, tokens: Map<string, string>): Promise<{ content: string; data: any }> {
|
55 |
+
let data: any = {};
|
56 |
+
|
57 |
+
for (const [placeholder, originalDirective] of tokens.entries()) {
|
58 |
+
const parsed = Handlebars.parse(originalDirective);
|
59 |
+
const directiveData = this.extractDirectiveData(parsed.body[0]);
|
60 |
+
const directive = directiveData?.name;
|
61 |
+
const token = directiveData?.param;
|
62 |
+
|
63 |
+
if (directive && token) {
|
64 |
+
/*const tokenData = await this.getAsyncDataForDirective(directive, token);
|
65 |
+
data[placeholder] = tokenData;*/
|
66 |
+
content = content.replace(placeholder, originalDirective);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
return { content, data };
|
71 |
+
}
|
72 |
+
|
73 |
+
extractTokens(content: string): { modifiedContent: string; tokens: Map<string, string> } {
|
74 |
+
//const tokenRegex = /{{([A-Z0-9]+)[^}]*}}/g;
|
75 |
+
const tokenRegex = /{{\s*([a-zA-Z0-9_-]+)\s*([^}]*)\s*}}/g;
|
76 |
+
const tokens = new Map<string, string>();
|
77 |
+
|
78 |
+
let counter = 0;
|
79 |
+
const modifiedContent = content.replace(tokenRegex, (match) => {
|
80 |
+
const placeholder = `TOKEN_${++counter}`;
|
81 |
+
tokens.set(placeholder, match);
|
82 |
+
return placeholder;
|
83 |
+
});
|
84 |
+
return { modifiedContent, tokens };
|
85 |
+
}
|
86 |
+
|
87 |
+
injectTokens(content: string, tokens: Map<string, string>): string {
|
88 |
+
let processedContent = content;
|
89 |
+
|
90 |
+
tokens.forEach((value, key) => {
|
91 |
+
processedContent = processedContent.replace(key, value);
|
92 |
+
});
|
93 |
+
|
94 |
+
return processedContent;
|
95 |
+
}
|
96 |
+
|
97 |
+
async render(markdownContent: string, context: any = {}): Promise<string> {
|
98 |
+
let { modifiedContent, tokens } = this.extractTokens(markdownContent);
|
99 |
+
|
100 |
+
const md = marked.parse(modifiedContent, { renderer: mdRenderer });
|
101 |
+
|
102 |
+
let { content, data } = await this.preprocessData(md, tokens);
|
103 |
+
content = this.injectTokens(content, tokens);
|
104 |
+
|
105 |
+
const replacedContent = this.handlebars.compile(content)(Object.assign({}, data, context));
|
106 |
+
|
107 |
+
return replacedContent;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
export { MarkdownEngine };
|
packages/omni-sdk/src/OmniSDKClient.ts
ADDED
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
|
3 |
+
* All rights reserved.
|
4 |
+
*/
|
5 |
+
|
6 |
+
import OmniSDKShared from './OmniSDKShared';
|
7 |
+
|
8 |
+
import {
|
9 |
+
OmniSDKClientEvents,
|
10 |
+
type IOmniCScriptResult,
|
11 |
+
type IOmniClientChatMessage,
|
12 |
+
type IOmniClientRunClientScript,
|
13 |
+
type IOmniClientSignalIntentMessage,
|
14 |
+
type IOmniClientWindowMessage,
|
15 |
+
type IOmniHostSyncData,
|
16 |
+
type IOmniMessage,
|
17 |
+
OmniSDKClientMessages,
|
18 |
+
OmniSDKHostMessages,
|
19 |
+
OmniSDKStorageKeys,
|
20 |
+
type IOmniClientShowToastMessage,
|
21 |
+
type IOmniHostCustomEventMessage,
|
22 |
+
type IOmniHostChatMessageReceived,
|
23 |
+
type IOmniClientShowExtensionMessage,
|
24 |
+
type IOmniClientLoadRecipeMessage,
|
25 |
+
type IOmniClientShowTopBannerMessage
|
26 |
+
} from './types';
|
27 |
+
|
28 |
+
export default class OmniSDKClient extends OmniSDKShared {
|
29 |
+
options: any;
|
30 |
+
args: any;
|
31 |
+
token: string;
|
32 |
+
_extensionId: string;
|
33 |
+
|
34 |
+
constructor(extensionId: string) {
|
35 |
+
super();
|
36 |
+
|
37 |
+
this._isClient = true; // Indicate that this is a client instance
|
38 |
+
|
39 |
+
this._extensionId = extensionId;
|
40 |
+
const args = new URLSearchParams(location.search);
|
41 |
+
this.options = JSON.parse(args.get('o') || '{}');
|
42 |
+
this.args = JSON.parse(args.get('q') || '{}');
|
43 |
+
if (args.has('omniHash')) {
|
44 |
+
this.token = args.get('omniHash')!;
|
45 |
+
} else {
|
46 |
+
console.warn('No omniHash found in the query string, this is not a window opened by OmniHost');
|
47 |
+
this.token = extensionId + new Date().getTime().toString();
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
public get extensionId(): string {
|
52 |
+
return this._extensionId;
|
53 |
+
}
|
54 |
+
|
55 |
+
public init( {subscriptions}: {subscriptions: OmniSDKHostMessages[]} = {subscriptions: []}) {
|
56 |
+
console.log('OmniSDKClient initialized for ' + this.extensionId + '.');
|
57 |
+
|
58 |
+
// Loading intentmap from local storage
|
59 |
+
const intentMapString = window.localStorage.getItem(OmniSDKStorageKeys.INTENT_MAP);
|
60 |
+
if (intentMapString) {
|
61 |
+
const intentMap = JSON.parse(intentMapString);
|
62 |
+
if (intentMap && intentMap.length > 0) {
|
63 |
+
this.intentMap = new Map(intentMap);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
this.addMessageHandler(OmniSDKHostMessages.CLIENT_SCRIPT_RESPONSE, this._handleClientScriptResponse);
|
68 |
+
this.addMessageHandler(OmniSDKHostMessages.SYNC_DATA, this._handleSyncData);
|
69 |
+
if (subscriptions.includes(OmniSDKHostMessages.CUSTOM_EVENT)) this.addMessageHandler(OmniSDKHostMessages.CUSTOM_EVENT, this._handleCustomEvent);
|
70 |
+
if (subscriptions.includes(OmniSDKHostMessages.CHAT_MESSAGE_RECEIVED)) this.addMessageHandler(OmniSDKHostMessages.CHAT_MESSAGE_RECEIVED, this._handleChatMessageReceived);
|
71 |
+
|
72 |
+
this.register();
|
73 |
+
return this;
|
74 |
+
}
|
75 |
+
|
76 |
+
public register(): void {
|
77 |
+
if (this.token) {
|
78 |
+
this.send({ type: OmniSDKClientMessages.REGISTRATION, token: this.token });
|
79 |
+
} else {
|
80 |
+
// Not a window opened by OmniHost`, messages won't be used.
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
public deregister(token: string): void {
|
85 |
+
this.send({ type: OmniSDKClientMessages.DEREGISTRATION, token: token });
|
86 |
+
}
|
87 |
+
|
88 |
+
public sendChatMessage(
|
89 |
+
content: string,
|
90 |
+
type: string = 'text/markdown',
|
91 |
+
attachments?: { [key: string]: any },
|
92 |
+
flags?: string[]
|
93 |
+
): void {
|
94 |
+
const message: IOmniClientChatMessage = {
|
95 |
+
type: OmniSDKClientMessages.SEND_CHAT_MESSAGE,
|
96 |
+
message: {
|
97 |
+
content,
|
98 |
+
type,
|
99 |
+
attachments,
|
100 |
+
flags
|
101 |
+
}
|
102 |
+
};
|
103 |
+
this.send(message);
|
104 |
+
}
|
105 |
+
|
106 |
+
// Runs a client script and responds with the result
|
107 |
+
public async runClientScript(scriptName: string, payload: any) {
|
108 |
+
const message: IOmniClientRunClientScript = {
|
109 |
+
type: OmniSDKClientMessages.RUN_CLIENT_SCRIPT,
|
110 |
+
script: scriptName,
|
111 |
+
args: payload,
|
112 |
+
invokeId: this.extensionId + new Date().getTime().toString()
|
113 |
+
};
|
114 |
+
return new Promise((resolve, reject) => {
|
115 |
+
this.send(message);
|
116 |
+
this.events.once(OmniSDKHostMessages.CLIENT_SCRIPT_RESPONSE + ':' + message.invokeId).then((result) => {
|
117 |
+
resolve(result);
|
118 |
+
});
|
119 |
+
});
|
120 |
+
}
|
121 |
+
|
122 |
+
private async _handleCustomEvent(message: IOmniMessage): Promise<void> {
|
123 |
+
if (message.type !== OmniSDKHostMessages.CUSTOM_EVENT) return;
|
124 |
+
const msg = message as IOmniHostCustomEventMessage;
|
125 |
+
|
126 |
+
if (msg.extensionId !== this.extensionId) return;
|
127 |
+
await this.events.emit(OmniSDKClientEvents.CUSTOM_EVENT, { eventId: msg.eventId, eventArgs: msg.eventArgs });
|
128 |
+
}
|
129 |
+
|
130 |
+
private async _handleSyncData(message: IOmniMessage): Promise<void> {
|
131 |
+
if (message.type !== OmniSDKHostMessages.SYNC_DATA) return; // type guard
|
132 |
+
const msg = message as IOmniHostSyncData;
|
133 |
+
this.intentMap = new Map(msg.frame);
|
134 |
+
await this.events.emit(OmniSDKClientEvents.DATA_UPDATED, [{ property: 'intentMap' }]);
|
135 |
+
}
|
136 |
+
|
137 |
+
private async _handleChatMessageReceived(message: IOmniMessage): Promise<void> {
|
138 |
+
if (message.type !== OmniSDKHostMessages.CHAT_MESSAGE_RECEIVED) return; // type guard
|
139 |
+
const msg = message as IOmniHostChatMessageReceived;
|
140 |
+
|
141 |
+
await this.events.emit(OmniSDKClientEvents.CHAT_MESSAGE_RECEIVED, [msg.message]);
|
142 |
+
}
|
143 |
+
|
144 |
+
private async _handleClientScriptResponse(message: IOmniMessage): Promise<void> {
|
145 |
+
if (message.type !== OmniSDKHostMessages.CLIENT_SCRIPT_RESPONSE) return; // type guard
|
146 |
+
|
147 |
+
const msg = message as IOmniCScriptResult;
|
148 |
+
|
149 |
+
await this.events.emit(OmniSDKHostMessages.CLIENT_SCRIPT_RESPONSE + ':' + msg.invokeId, msg.result);
|
150 |
+
}
|
151 |
+
|
152 |
+
public showExtension(
|
153 |
+
extensionId: string,
|
154 |
+
args: any,
|
155 |
+
page: string = '',
|
156 |
+
opts: any = {},
|
157 |
+
action: 'open' | 'close' = 'open'
|
158 |
+
) {
|
159 |
+
const msg: IOmniClientShowExtensionMessage = {
|
160 |
+
type: OmniSDKClientMessages.SHOW_EXTENSION,
|
161 |
+
extensionId,
|
162 |
+
action,
|
163 |
+
args,
|
164 |
+
page,
|
165 |
+
opts
|
166 |
+
};
|
167 |
+
this.send(msg);
|
168 |
+
}
|
169 |
+
|
170 |
+
public hide() {
|
171 |
+
const msg: IOmniClientWindowMessage = {
|
172 |
+
type: OmniSDKClientMessages.WINDOW_MESSAGE,
|
173 |
+
action: 'hide',
|
174 |
+
args: {}
|
175 |
+
};
|
176 |
+
this.send(msg);
|
177 |
+
}
|
178 |
+
|
179 |
+
public show() {
|
180 |
+
const msg: IOmniClientWindowMessage = {
|
181 |
+
type: OmniSDKClientMessages.WINDOW_MESSAGE,
|
182 |
+
action: 'show',
|
183 |
+
args: {}
|
184 |
+
};
|
185 |
+
this.send(msg);
|
186 |
+
}
|
187 |
+
|
188 |
+
public close() {
|
189 |
+
const msg: IOmniClientWindowMessage = {
|
190 |
+
type: OmniSDKClientMessages.WINDOW_MESSAGE,
|
191 |
+
action: 'close',
|
192 |
+
args: {}
|
193 |
+
};
|
194 |
+
this.send(msg);
|
195 |
+
}
|
196 |
+
|
197 |
+
public signalIntent(intent: 'show' | 'edit', target: string, payload: any, opts = {}): void {
|
198 |
+
const message: IOmniClientSignalIntentMessage = {
|
199 |
+
type: OmniSDKClientMessages.SIGNAL_INTENT,
|
200 |
+
intent,
|
201 |
+
target,
|
202 |
+
opts: opts || {},
|
203 |
+
payload
|
204 |
+
};
|
205 |
+
|
206 |
+
this.send(message);
|
207 |
+
}
|
208 |
+
|
209 |
+
public showToast(
|
210 |
+
message: string,
|
211 |
+
options: {
|
212 |
+
description?: string;
|
213 |
+
type?: 'default' | 'danger' | 'success' | 'warning' | 'info';
|
214 |
+
position?: string;
|
215 |
+
html?: string;
|
216 |
+
}
|
217 |
+
): void {
|
218 |
+
const msg: IOmniClientShowToastMessage = {
|
219 |
+
type: OmniSDKClientMessages.SHOW_TOAST,
|
220 |
+
message,
|
221 |
+
options
|
222 |
+
};
|
223 |
+
this.send(msg);
|
224 |
+
}
|
225 |
+
|
226 |
+
public showTopBanner(
|
227 |
+
bannerTitle: string,
|
228 |
+
bannerDescription: string,
|
229 |
+
options: {
|
230 |
+
link?: string;
|
231 |
+
}
|
232 |
+
): void {
|
233 |
+
const msg: IOmniClientShowTopBannerMessage = {
|
234 |
+
type: OmniSDKClientMessages.SHOW_TOP_BANNER,
|
235 |
+
bannerTitle,
|
236 |
+
bannerDescription,
|
237 |
+
options
|
238 |
+
};
|
239 |
+
this.send(msg);
|
240 |
+
}
|
241 |
+
|
242 |
+
public openRecipeInEditor(recipeId: string, recipeVersion: string): void {
|
243 |
+
const msg: IOmniClientLoadRecipeMessage = {
|
244 |
+
type: OmniSDKClientMessages.LOAD_RECIPE,
|
245 |
+
recipeId,
|
246 |
+
recipeVersion
|
247 |
+
};
|
248 |
+
this.send(msg);
|
249 |
+
}
|
250 |
+
|
251 |
+
public async runExtensionScript(scriptName: string, payload: any) {
|
252 |
+
const response = await this._httpClient.executeRequest(
|
253 |
+
`/api/v1/mercenaries/runscript/${this.extensionId}:` + scriptName,
|
254 |
+
{
|
255 |
+
method: 'POST',
|
256 |
+
headers: {
|
257 |
+
'Content-Type': 'application/json'
|
258 |
+
},
|
259 |
+
body: JSON.stringify(payload)
|
260 |
+
}
|
261 |
+
);
|
262 |
+
|
263 |
+
if (!response.ok) {
|
264 |
+
throw new Error('Server error: HTTP status ' + response.status);
|
265 |
+
}
|
266 |
+
|
267 |
+
const data = await response.json();
|
268 |
+
|
269 |
+
return data;
|
270 |
+
}
|
271 |
+
|
272 |
+
// You can add more handlers if required for other types of messages that the ClientSDK might receive from OmniHost
|
273 |
+
}
|
packages/omni-sdk/src/OmniSDKHost.ts
ADDED
@@ -0,0 +1,321 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
|
3 |
+
* All rights reserved.
|
4 |
+
*/
|
5 |
+
|
6 |
+
import OmniSDKShared from './OmniSDKShared';
|
7 |
+
import {
|
8 |
+
type IOmniMessage,
|
9 |
+
type IOmniClientDeregistrationMessage,
|
10 |
+
type IOmniClientRegistrationMessage,
|
11 |
+
type IOmniClientRunClientScript,
|
12 |
+
type IOmniClientWindowMessage,
|
13 |
+
type IOmniClientChatMessage,
|
14 |
+
type IOmniClientShowToastMessage,
|
15 |
+
OmniSDKClientMessages,
|
16 |
+
type IOmniCScriptResult,
|
17 |
+
OmniSDKHostMessages,
|
18 |
+
OmniSDKStorageKeys,
|
19 |
+
type IOmniClientSignalIntentMessage,
|
20 |
+
type IOmniHostCustomEventMessage,
|
21 |
+
type IOmniHostChatMessageReceived,
|
22 |
+
type IOmniClientShowExtensionMessage,
|
23 |
+
type IOmniClientLoadRecipeMessage,
|
24 |
+
type IOmniClientShowTopBannerMessage
|
25 |
+
} from './types';
|
26 |
+
|
27 |
+
import { type OmniBaseResource } from './Resources/OmniBaseResource';
|
28 |
+
|
29 |
+
interface IFrameInfo {
|
30 |
+
contentWindow: Window;
|
31 |
+
registeredAt: Date;
|
32 |
+
}
|
33 |
+
|
34 |
+
export default class OmniSDKHost<T> extends OmniSDKShared {
|
35 |
+
private registeredFrames: { [token: string]: IFrameInfo } = {};
|
36 |
+
|
37 |
+
private _app: T;
|
38 |
+
constructor(app: any) {
|
39 |
+
super();
|
40 |
+
this._app = app;
|
41 |
+
}
|
42 |
+
|
43 |
+
public get app(): T {
|
44 |
+
return this._app as T;
|
45 |
+
}
|
46 |
+
|
47 |
+
public init() {
|
48 |
+
console.log('OmniSDKHost initialized.');
|
49 |
+
this.addMessageHandler(OmniSDKClientMessages.REGISTRATION, this._handleRegistration);
|
50 |
+
this.addMessageHandler(OmniSDKClientMessages.DEREGISTRATION, this._handleDeregistration);
|
51 |
+
this.addMessageHandler(OmniSDKClientMessages.SEND_CHAT_MESSAGE, this._handleSendChatMessage);
|
52 |
+
this.addMessageHandler(OmniSDKClientMessages.RUN_CLIENT_SCRIPT, this._handleRunClientScript);
|
53 |
+
this.addMessageHandler(OmniSDKClientMessages.SIGNAL_INTENT, this._handleSignalIntent);
|
54 |
+
this.addMessageHandler(OmniSDKClientMessages.WINDOW_MESSAGE, this._handleWindowMessage);
|
55 |
+
this.addMessageHandler(OmniSDKClientMessages.SHOW_TOAST, this._handleShowToast);
|
56 |
+
this.addMessageHandler(OmniSDKClientMessages.SHOW_EXTENSION, this._handleShowExtension);
|
57 |
+
this.addMessageHandler(OmniSDKClientMessages.LOAD_RECIPE, this._handleLoadRecipe)
|
58 |
+
this.addMessageHandler(OmniSDKClientMessages.SHOW_TOP_BANNER, this._handleShowTopBanner);
|
59 |
+
|
60 |
+
return this;
|
61 |
+
}
|
62 |
+
|
63 |
+
public registerFileIntent(
|
64 |
+
intent: 'show' | 'edit',
|
65 |
+
mimeType: string,
|
66 |
+
handler: { extensionId: string; page: string; opts?: any }
|
67 |
+
) {
|
68 |
+
const key = `file:${intent}:${mimeType}`;
|
69 |
+
console.log(`Registering file intent ${key}, handler: `, handler);
|
70 |
+
if (this.intentMap.has(key)) {
|
71 |
+
this.intentMap.get(key).push(handler);
|
72 |
+
} else {
|
73 |
+
this.intentMap.set(key, [handler]);
|
74 |
+
}
|
75 |
+
window.localStorage.setItem(OmniSDKStorageKeys.INTENT_MAP, JSON.stringify(Array.from(this.intentMap.entries())));
|
76 |
+
}
|
77 |
+
|
78 |
+
public signalFileIntent(intent: 'show' | 'edit', file: OmniBaseResource, opts?: any) {
|
79 |
+
const mt = file.mimeType?.split(';')[0].trim();
|
80 |
+
|
81 |
+
let handlers = this.intentMap.get(`file:${intent}:${mt}`) || [];
|
82 |
+
|
83 |
+
// No direct hit, let's try partial
|
84 |
+
if (handlers.length == 0) {
|
85 |
+
handlers = Array.from(this.intentMap.entries())
|
86 |
+
.map(([key, value]) => {
|
87 |
+
const [type, action, mimeType] = key.split(':');
|
88 |
+
if (
|
89 |
+
type === 'file' &&
|
90 |
+
action === intent &&
|
91 |
+
mimeType.endsWith('*') &&
|
92 |
+
mt?.startsWith(mimeType.substring(0, mimeType.length - 1))
|
93 |
+
) {
|
94 |
+
return value[0];
|
95 |
+
} else {
|
96 |
+
return undefined;
|
97 |
+
}
|
98 |
+
})
|
99 |
+
.filter((v) => v !== undefined);
|
100 |
+
}
|
101 |
+
|
102 |
+
if (handlers.length > 0) {
|
103 |
+
console.log(handlers[0]);
|
104 |
+
|
105 |
+
const { extensionId, page, hOpts } = handlers[0];
|
106 |
+
console.log(`Showing ${intent} intent for ${mt} with extension ${extensionId} and page ${page}`);
|
107 |
+
//@ts-ignore
|
108 |
+
this.app.workbench.showExtension(extensionId, { file }, page, Object.assign({}, opts, hOpts));
|
109 |
+
} else {
|
110 |
+
console.warn(`No handler found for intent ${intent} and mime type ${file.mimeType}`);
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
public signalCustomEvent(extensionId: string, eventId: string, eventArgs: any) {
|
115 |
+
const message: IOmniHostCustomEventMessage = {
|
116 |
+
type: OmniSDKHostMessages.CUSTOM_EVENT,
|
117 |
+
extensionId,
|
118 |
+
eventId,
|
119 |
+
eventArgs
|
120 |
+
};
|
121 |
+
this.send(message);
|
122 |
+
}
|
123 |
+
|
124 |
+
|
125 |
+
public signalChatMessageReceived(message: any) {
|
126 |
+
if (!message.workflowId) {
|
127 |
+
message.workflowId = 'System';
|
128 |
+
}
|
129 |
+
|
130 |
+
const packet: IOmniHostChatMessageReceived = {
|
131 |
+
type: OmniSDKHostMessages.CHAT_MESSAGE_RECEIVED,
|
132 |
+
message
|
133 |
+
};
|
134 |
+
this.send(packet, '*');
|
135 |
+
}
|
136 |
+
|
137 |
+
public deregister(token: string): void {
|
138 |
+
if (token && this.registeredFrames[token]) {
|
139 |
+
console.log(`Iframe with token ${token} deregistered!`);
|
140 |
+
delete this.registeredFrames[token];
|
141 |
+
} else {
|
142 |
+
console.warn(`No registered frame with token ${token}`);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
private async _handleRunClientScript(message: IOmniMessage): Promise<any> {
|
147 |
+
if (message.type !== OmniSDKClientMessages.RUN_CLIENT_SCRIPT) return; // type guard
|
148 |
+
|
149 |
+
const scriptMessage = message as IOmniClientRunClientScript;
|
150 |
+
const script = scriptMessage.script;
|
151 |
+
const args = scriptMessage.args;
|
152 |
+
|
153 |
+
//@ts-ignore
|
154 |
+
const result = await this.app.runScript(script, args);
|
155 |
+
|
156 |
+
const response: IOmniCScriptResult = {
|
157 |
+
type: OmniSDKHostMessages.CLIENT_SCRIPT_RESPONSE,
|
158 |
+
invokeId: scriptMessage.invokeId,
|
159 |
+
result: result
|
160 |
+
};
|
161 |
+
|
162 |
+
this.send(response, message.token!);
|
163 |
+
}
|
164 |
+
|
165 |
+
private _handleWindowMessage(message: IOmniMessage): void {
|
166 |
+
if (message.type !== OmniSDKClientMessages.WINDOW_MESSAGE) return; // type guard
|
167 |
+
|
168 |
+
const windowMessage = message as IOmniClientWindowMessage;
|
169 |
+
const action = windowMessage.action;
|
170 |
+
const args = windowMessage.args;
|
171 |
+
const token = windowMessage.token;
|
172 |
+
|
173 |
+
if (action === 'close') {
|
174 |
+
//@ts-ignore
|
175 |
+
this.app.closeWindow(token);
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
public sendChatMessage(
|
180 |
+
content: string,
|
181 |
+
type: string = 'text/markdown',
|
182 |
+
attachments?: { [key: string]: any },
|
183 |
+
flags?: string[]
|
184 |
+
): void {
|
185 |
+
const message: IOmniClientChatMessage = {
|
186 |
+
type: OmniSDKClientMessages.SEND_CHAT_MESSAGE,
|
187 |
+
message: {
|
188 |
+
content,
|
189 |
+
type,
|
190 |
+
attachments,
|
191 |
+
flags
|
192 |
+
}
|
193 |
+
};
|
194 |
+
this._handleSendChatMessage(message)
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
private _handleSendChatMessage(message: IOmniMessage): void {
|
199 |
+
if (message.type !== OmniSDKClientMessages.SEND_CHAT_MESSAGE) return; // type guard
|
200 |
+
|
201 |
+
const body = (message as IOmniClientChatMessage).message;
|
202 |
+
//@ts-ignore
|
203 |
+
this.app.sendSystemMessage(body.content, body.type, body.attachments, body.flags);
|
204 |
+
}
|
205 |
+
|
206 |
+
private _handleShowExtension(message: IOmniMessage): void {
|
207 |
+
if (message.type !== OmniSDKClientMessages.SHOW_EXTENSION) return; // type guard
|
208 |
+
|
209 |
+
const showExtensionMessage = message as IOmniClientShowExtensionMessage;
|
210 |
+
const { action, args, extensionId, page, opts } = showExtensionMessage;
|
211 |
+
|
212 |
+
if (action === 'open') {
|
213 |
+
//@ts-ignore
|
214 |
+
this.app.workbench.showExtension(extensionId, args, page, opts);
|
215 |
+
} else if (action === 'close') {
|
216 |
+
alert('hideExtension Not implemented');
|
217 |
+
//@ts-ignore
|
218 |
+
//this.app.workbench.hideExtension(extensionId)
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
private _handleRegistration(message: IOmniMessage, source: MessageEventSource | null): void {
|
223 |
+
if (message.type !== OmniSDKClientMessages.REGISTRATION) return; // type guard
|
224 |
+
|
225 |
+
const regMessage = message as IOmniClientRegistrationMessage; // narrowing the type
|
226 |
+
|
227 |
+
if (source && regMessage.token && 'postMessage' in source && !this.registeredFrames[regMessage.token]) {
|
228 |
+
this.registeredFrames[regMessage.token] = {
|
229 |
+
contentWindow: source as Window,
|
230 |
+
registeredAt: new Date()
|
231 |
+
};
|
232 |
+
console.log(`Iframe with token ${regMessage.token} registered!`);
|
233 |
+
|
234 |
+
// Send the intent map to the newly registered iframe.
|
235 |
+
this.send(
|
236 |
+
{
|
237 |
+
type: OmniSDKHostMessages.SYNC_DATA,
|
238 |
+
packet: 'intentMap',
|
239 |
+
frame: Array.from(this.intentMap.entries())
|
240 |
+
},
|
241 |
+
regMessage.token
|
242 |
+
);
|
243 |
+
}
|
244 |
+
}
|
245 |
+
|
246 |
+
private _handleShowToast(clientMessage: IOmniMessage): void {
|
247 |
+
if (clientMessage.type !== OmniSDKClientMessages.SHOW_TOAST) return; // type guard
|
248 |
+
|
249 |
+
const toastMessage = clientMessage as IOmniClientShowToastMessage; // narrowing the type
|
250 |
+
const { message, options } = toastMessage;
|
251 |
+
|
252 |
+
// @ts-expect-error
|
253 |
+
this.app.showToast(message, options);
|
254 |
+
}
|
255 |
+
|
256 |
+
private _handleSignalIntent(message: IOmniMessage): void {
|
257 |
+
if (message.type !== OmniSDKClientMessages.SIGNAL_INTENT) return; // type guard
|
258 |
+
|
259 |
+
const intentMessage = message as IOmniClientSignalIntentMessage; // narrowing the type
|
260 |
+
|
261 |
+
if (intentMessage.payload?.fid || intentMessage.payload?.ticket?.fid) {
|
262 |
+
//@ts-ignore
|
263 |
+
this.signalFileIntent(intentMessage.intent, intentMessage.payload, intentMessage.opts);
|
264 |
+
return;
|
265 |
+
}
|
266 |
+
if (intentMessage.intent === 'show' || intentMessage.intent === 'edit') {
|
267 |
+
//@ts-ignore
|
268 |
+
this.app.workbench.showExtension(intentMessage.target, intentMessage.payload, undefined, intentMessage.opts);
|
269 |
+
} else if (intentMessage.intent === 'hide') {
|
270 |
+
//@ts-ignore
|
271 |
+
this.app.workbench.hideExtension(intentMessage.target);
|
272 |
+
} else {
|
273 |
+
console.warn(`Invalid intent ${intentMessage.intent}`, intentMessage);
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
private _handleDeregistration(message: IOmniMessage): void {
|
278 |
+
if (message.type !== OmniSDKClientMessages.DEREGISTRATION) return; // type guard
|
279 |
+
|
280 |
+
const deRegMessage = message as IOmniClientDeregistrationMessage; // narrowing the type
|
281 |
+
if (deRegMessage.token && this.registeredFrames[deRegMessage.token]) {
|
282 |
+
this.deregister(deRegMessage.token);
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
private _handleLoadRecipe(message: IOmniMessage): void {
|
287 |
+
if (message.type !== OmniSDKClientMessages.LOAD_RECIPE) return; // type guard
|
288 |
+
|
289 |
+
const loadRecipeMessage = message as IOmniClientLoadRecipeMessage; // narrowing the type
|
290 |
+
//@ts-ignore
|
291 |
+
this.app.workbench.loadRecipe(loadRecipeMessage.recipeId, loadRecipeMessage.recipeVersion);
|
292 |
+
}
|
293 |
+
|
294 |
+
private _handleShowTopBanner(message: IOmniMessage): void {
|
295 |
+
if (message.type !== OmniSDKClientMessages.SHOW_TOP_BANNER) return; // type guard
|
296 |
+
|
297 |
+
const showTopBannerMessage = message as IOmniClientShowTopBannerMessage; // narrowing the type
|
298 |
+
const { bannerTitle, bannerDescription, options } = showTopBannerMessage;
|
299 |
+
|
300 |
+
// @ts-expect-error
|
301 |
+
this.app.showTopBanner(bannerTitle, bannerDescription, options);
|
302 |
+
}
|
303 |
+
|
304 |
+
protected override send(message: any, token: string | '*' = '*') {
|
305 |
+
message.token = token;
|
306 |
+
message = JSON.parse(JSON.stringify(message)); // dereference and avoid functions/other objects from preventing the send
|
307 |
+
if (token === '*') {
|
308 |
+
// Broadcast to all registered iframes.
|
309 |
+
for (const frameInfo of Object.values(this.registeredFrames)) {
|
310 |
+
frameInfo.contentWindow.postMessage(message, '*');
|
311 |
+
}
|
312 |
+
} else {
|
313 |
+
const frameInfo = this.registeredFrames[token];
|
314 |
+
if (frameInfo) {
|
315 |
+
frameInfo.contentWindow.postMessage(message, '*');
|
316 |
+
} else {
|
317 |
+
console.warn(`No registered frame with token ${token}`);
|
318 |
+
}
|
319 |
+
}
|
320 |
+
}
|
321 |
+
}
|
packages/omni-sdk/src/OmniSDKShared.ts
ADDED
@@ -0,0 +1,307 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
|
3 |
+
* All rights reserved.
|
4 |
+
*/
|
5 |
+
|
6 |
+
import { type IOmniMessage, type OmniSDKClientMessages, type OmniSDKHostMessages } from './types';
|
7 |
+
|
8 |
+
import { OmniResource } from './Resources/OmniResource';
|
9 |
+
import { OmniBaseResource } from './Resources/OmniBaseResource';
|
10 |
+
import { HTTPClient } from './Utils/HttpClient';
|
11 |
+
|
12 |
+
import EventEmitter from 'emittery';
|
13 |
+
import type OmniSDKClient from './OmniSDKClient';
|
14 |
+
|
15 |
+
export default class OmniSDKShared {
|
16 |
+
protected messageHandlers: {
|
17 |
+
[key in OmniSDKClientMessages | OmniSDKHostMessages]?: (
|
18 |
+
message: IOmniMessage,
|
19 |
+
source: MessageEventSource | null
|
20 |
+
) => void;
|
21 |
+
} = {};
|
22 |
+
protected _isClient = false; // Default to false, meaning it's considered as host by default
|
23 |
+
|
24 |
+
public static Resource = OmniResource;
|
25 |
+
public Resource = OmniResource;
|
26 |
+
public events = new EventEmitter();
|
27 |
+
protected intentMap: Map<string, any> = new Map<string, any>();
|
28 |
+
|
29 |
+
protected _httpClient: HTTPClient;
|
30 |
+
|
31 |
+
constructor() {
|
32 |
+
this._initMessageListener();
|
33 |
+
this._httpClient = new HTTPClient();
|
34 |
+
}
|
35 |
+
|
36 |
+
public unload(): void {
|
37 |
+
window.removeEventListener('message', this._messageListenerHandler);
|
38 |
+
console.log('Message listener removed.');
|
39 |
+
}
|
40 |
+
|
41 |
+
protected _initMessageListener(): void {
|
42 |
+
window.addEventListener('message', this._messageListenerHandler, false);
|
43 |
+
console.log('Message listener initialized.');
|
44 |
+
}
|
45 |
+
|
46 |
+
protected addMessageHandler(
|
47 |
+
type: OmniSDKClientMessages | OmniSDKHostMessages,
|
48 |
+
handler: (message: IOmniMessage, source: MessageEventSource | null) => void
|
49 |
+
): void {
|
50 |
+
this.messageHandlers[type] = handler;
|
51 |
+
|
52 |
+
}
|
53 |
+
|
54 |
+
private _messageListenerHandler = (event: MessageEvent): void => {
|
55 |
+
if (event.origin !== window.location.origin) {
|
56 |
+
console.warn(`Dropping Message received from an unknown origin: ${event.origin}`);
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
try {
|
61 |
+
const data = event.data as IOmniMessage;
|
62 |
+
const handler = this.messageHandlers[data.type];
|
63 |
+
if (handler) {
|
64 |
+
handler.call(this, data, event.source);
|
65 |
+
} else {
|
66 |
+
console.warn(`No handler found for message type: ${data.type}`);
|
67 |
+
}
|
68 |
+
} catch (error) {
|
69 |
+
console.error('Error processing the message:', error);
|
70 |
+
}
|
71 |
+
};
|
72 |
+
|
73 |
+
|
74 |
+
public getLocalValue(key: string, value: any): any
|
75 |
+
{
|
76 |
+
|
77 |
+
let finalKey = key
|
78 |
+
// In an extensions
|
79 |
+
if (this._isClient)
|
80 |
+
{
|
81 |
+
finalKey = "omni/"+(this as unknown as OmniSDKClient)._extensionId + "/" + key
|
82 |
+
}
|
83 |
+
else
|
84 |
+
{
|
85 |
+
finalKey = "omni/host/" + key
|
86 |
+
}
|
87 |
+
|
88 |
+
let stored = globalThis.localStorage.getItem(finalKey)
|
89 |
+
|
90 |
+
if (stored !== null)
|
91 |
+
{
|
92 |
+
let record = JSON.parse(stored)
|
93 |
+
let value = record.value
|
94 |
+
|
95 |
+
switch (record.type)
|
96 |
+
{
|
97 |
+
case 'boolean': value = value === 'true' ? true : false; break;
|
98 |
+
case 'object':
|
99 |
+
case 'number':
|
100 |
+
case 'string': break;
|
101 |
+
default:
|
102 |
+
console.warn("Unsupported value type", record.type, "on", key)
|
103 |
+
return null
|
104 |
+
}
|
105 |
+
return value;
|
106 |
+
}
|
107 |
+
|
108 |
+
return null
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
public setLocalValue(key: string, value: any)
|
113 |
+
{
|
114 |
+
if (key == null || key.length == 0)
|
115 |
+
{
|
116 |
+
throw new Error("Invalid null Key passed into setLocalValue")
|
117 |
+
}
|
118 |
+
|
119 |
+
let finalKey = key
|
120 |
+
// In an extensions
|
121 |
+
if (this._isClient)
|
122 |
+
{
|
123 |
+
finalKey = "omni/"+(this as unknown as OmniSDKClient)._extensionId + "/" + key
|
124 |
+
}
|
125 |
+
else
|
126 |
+
{
|
127 |
+
finalKey = "omni/host/" + key
|
128 |
+
}
|
129 |
+
|
130 |
+
if (value === null || value === undefined)
|
131 |
+
{
|
132 |
+
globalThis.localStorage.removeItem(finalKey)
|
133 |
+
return
|
134 |
+
}
|
135 |
+
|
136 |
+
|
137 |
+
const valueType = typeof(value)
|
138 |
+
let finalValue = value
|
139 |
+
switch(valueType)
|
140 |
+
{
|
141 |
+
case 'number':
|
142 |
+
case 'string':
|
143 |
+
case 'object': break;
|
144 |
+
case 'boolean': finalValue = value ? "true" : "false"; break;
|
145 |
+
|
146 |
+
default:
|
147 |
+
console.warn("Unsupported value type", valueType, "on", key)
|
148 |
+
return;
|
149 |
+
}
|
150 |
+
|
151 |
+
globalThis.localStorage.setItem(finalKey, JSON.stringify({
|
152 |
+
type: valueType,
|
153 |
+
value
|
154 |
+
}))
|
155 |
+
|
156 |
+
}
|
157 |
+
|
158 |
+
protected send(message: IOmniMessage, token?: string) {
|
159 |
+
if (this._isClient) {
|
160 |
+
console.log('Sending message from client:', message);
|
161 |
+
//@ts-ignore
|
162 |
+
message.token = this.token;
|
163 |
+
message = JSON.parse(JSON.stringify(message));
|
164 |
+
window.parent.postMessage(message, '*');
|
165 |
+
} else {
|
166 |
+
// Host logic to send message is implemented in OmniHost.
|
167 |
+
console.warn('Attempted to send a message from the host without specifying a target.');
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
public async runServerScript(scriptName: string, payload: any) {
|
172 |
+
const response = await this._httpClient.executeRequest('/api/v1/mercenaries/runscript/' + scriptName, {
|
173 |
+
method: 'POST',
|
174 |
+
headers: {
|
175 |
+
'Content-Type': 'application/json'
|
176 |
+
},
|
177 |
+
body: JSON.stringify(payload)
|
178 |
+
});
|
179 |
+
|
180 |
+
const data = await response.json();
|
181 |
+
return data;
|
182 |
+
}
|
183 |
+
|
184 |
+
public canEditFile(file: OmniBaseResource) {
|
185 |
+
if (!file) {
|
186 |
+
return false;
|
187 |
+
}
|
188 |
+
return this.intentMap.has(`file:edit:${file.mimeType}`);
|
189 |
+
}
|
190 |
+
|
191 |
+
public canViewFile(file: OmniBaseResource) {
|
192 |
+
if (!file) {
|
193 |
+
return false;
|
194 |
+
}
|
195 |
+
return this.intentMap.has(`file:show:${file.mimeType}`);
|
196 |
+
}
|
197 |
+
|
198 |
+
public async getFileObject(fid: string): Promise<OmniBaseResource | null> {
|
199 |
+
try {
|
200 |
+
const response = await this._httpClient.executeRequest('/fid/' + fid + '?obj=true', {
|
201 |
+
method: 'GET',
|
202 |
+
headers: {
|
203 |
+
'Content-Type': 'application/json'
|
204 |
+
}
|
205 |
+
});
|
206 |
+
const data = await response.json();
|
207 |
+
if (data) {
|
208 |
+
console.log('getFileObject', data);
|
209 |
+
return new OmniBaseResource(data);
|
210 |
+
} else {
|
211 |
+
console.warn(`No valid file object found for fid ${fid}`);
|
212 |
+
return null;
|
213 |
+
}
|
214 |
+
} catch (ex) {
|
215 |
+
console.error(ex);
|
216 |
+
return null;
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
public async getFileBlob(fid: string): Promise<Blob | null> {
|
221 |
+
try {
|
222 |
+
const response = await this._httpClient.executeRequest('/fid/' + fid + '?download=true');
|
223 |
+
const blob = await response.blob();
|
224 |
+
return blob;
|
225 |
+
} catch (ex) {
|
226 |
+
console.error(ex);
|
227 |
+
return null;
|
228 |
+
}
|
229 |
+
}
|
230 |
+
|
231 |
+
public async uploadFiles(files: FileList, storageType: 'temporary' | 'permanent' = 'temporary') {
|
232 |
+
if (files?.length > 0) {
|
233 |
+
let result = await Promise.all(
|
234 |
+
Array.from(files).map(async (file) => {
|
235 |
+
const form = new FormData();
|
236 |
+
form.append('storageType', storageType);
|
237 |
+
form.append('file', file, file.name || Date.now().toString());
|
238 |
+
|
239 |
+
try {
|
240 |
+
const response = await fetch('/fid', {
|
241 |
+
method: 'POST',
|
242 |
+
body: form
|
243 |
+
});
|
244 |
+
|
245 |
+
if (response.ok) {
|
246 |
+
const data = await response.json();
|
247 |
+
|
248 |
+
if (data.length > 0 && data[0].ticket && data[0].fid) {
|
249 |
+
return data[0];
|
250 |
+
} else {
|
251 |
+
console.warn('Failed to upload file', { data, file });
|
252 |
+
return null;
|
253 |
+
}
|
254 |
+
} else {
|
255 |
+
console.warn('Failed to upload file', { response, file });
|
256 |
+
return null;
|
257 |
+
}
|
258 |
+
} catch (error) {
|
259 |
+
console.error('Failed to upload file', { error, file });
|
260 |
+
return null;
|
261 |
+
}
|
262 |
+
})
|
263 |
+
);
|
264 |
+
|
265 |
+
result = result.filter((r) => r);
|
266 |
+
return result;
|
267 |
+
} else {
|
268 |
+
return [];
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
public async startRecipe(id: string, args: any) {
|
273 |
+
const response = await fetch('/api/v1/workflow/exec', {
|
274 |
+
method: 'POST',
|
275 |
+
credentials: 'include',
|
276 |
+
headers: {
|
277 |
+
'Content-Type': 'application/json'
|
278 |
+
},
|
279 |
+
body: JSON.stringify({ workflow: id, args })
|
280 |
+
});
|
281 |
+
|
282 |
+
const data = await response.json();
|
283 |
+
|
284 |
+
if (data.status === 'JOB_STARTED') {
|
285 |
+
return { ...data }; /* jobId: result.jobId,*/
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
public async downloadFile(fileObject: OmniBaseResource, fileName?: string): Promise<void> {
|
290 |
+
const fid = fileObject.fid;
|
291 |
+
const filename = fileName || fileObject.fileName;
|
292 |
+
|
293 |
+
fetch('/fid/' + fid + '?download=true')
|
294 |
+
.then((response) => response.blob())
|
295 |
+
.then((blob) => {
|
296 |
+
const url = URL.createObjectURL(blob);
|
297 |
+
const link = document.createElement('a');
|
298 |
+
link.href = url;
|
299 |
+
link.download = filename;
|
300 |
+
|
301 |
+
document.body.appendChild(link);
|
302 |
+
link.click();
|
303 |
+
document.body.removeChild(link);
|
304 |
+
})
|
305 |
+
.catch((error) => console.error(error));
|
306 |
+
}
|
307 |
+
}
|
packages/omni-sdk/src/Resources/OmniBaseResource.ts
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
|
3 |
+
* All rights reserved.
|
4 |
+
*/
|
5 |
+
|
6 |
+
import { EOmniFileTypes, ICdnResource } from '../types.js';
|
7 |
+
|
8 |
+
export class OmniBaseResource {
|
9 |
+
fid: string;
|
10 |
+
ticket: {
|
11 |
+
fid: string;
|
12 |
+
};
|
13 |
+
fileName: string;
|
14 |
+
size: number;
|
15 |
+
data?: any; //Buffer | string | ReadStream | FileResult
|
16 |
+
url: string;
|
17 |
+
furl: string;
|
18 |
+
expires?: number;
|
19 |
+
mimeType?: string;
|
20 |
+
fileType: EOmniFileTypes;
|
21 |
+
meta: {
|
22 |
+
type?: string;
|
23 |
+
dimensions?: { width: number; height: number };
|
24 |
+
created?: number;
|
25 |
+
creator?: string;
|
26 |
+
nsfw?: any;
|
27 |
+
};
|
28 |
+
|
29 |
+
constructor(resource: ICdnResource) {
|
30 |
+
this.fid = resource.fid || resource.ticket?.fid;
|
31 |
+
if (!this.fid) throw new Error('Invalid resource, fid missing');
|
32 |
+
this.ticket = resource.ticket;
|
33 |
+
this.fileName = resource.fileName;
|
34 |
+
this.size = resource.size;
|
35 |
+
this.data = resource.data;
|
36 |
+
this.url = resource.url;
|
37 |
+
this.mimeType = resource.mimeType;
|
38 |
+
this.expires = resource.expires;
|
39 |
+
this.meta = resource.meta || {};
|
40 |
+
this.meta.created = this.meta.created || Date.now();
|
41 |
+
let ext = this.fileName.split('.').pop();
|
42 |
+
this.furl = `fid://${this.fid}.${ext}`;
|
43 |
+
this.fileType =
|
44 |
+
OmniBaseResource.determineFileTypeFromMimeType(this.mimeType) || resource.fileType || EOmniFileTypes.file;
|
45 |
+
}
|
46 |
+
|
47 |
+
static determineFileTypeFromMimeType(mimeType?: string): EOmniFileTypes | undefined {
|
48 |
+
const validFileTypes = [
|
49 |
+
EOmniFileTypes.audio,
|
50 |
+
EOmniFileTypes.document,
|
51 |
+
EOmniFileTypes.image,
|
52 |
+
EOmniFileTypes.video,
|
53 |
+
EOmniFileTypes.file
|
54 |
+
];
|
55 |
+
|
56 |
+
if (mimeType) {
|
57 |
+
let ft = mimeType.split('/')[0];
|
58 |
+
|
59 |
+
if (validFileTypes.includes(ft as EOmniFileTypes)) {
|
60 |
+
return ft as EOmniFileTypes;
|
61 |
+
}
|
62 |
+
|
63 |
+
if (ft.startsWith('text/')) {
|
64 |
+
return EOmniFileTypes.document;
|
65 |
+
}
|
66 |
+
|
67 |
+
if (ft === 'application/ogg') {
|
68 |
+
return EOmniFileTypes.audio;
|
69 |
+
}
|
70 |
+
|
71 |
+
if (ft === 'application/pdf') {
|
72 |
+
return EOmniFileTypes.document;
|
73 |
+
}
|
74 |
+
|
75 |
+
if (ft === 'video/') {
|
76 |
+
return EOmniFileTypes.video;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
return undefined;
|
81 |
+
}
|
82 |
+
|
83 |
+
isAudio(): boolean {
|
84 |
+
if (this.fileType === EOmniFileTypes.audio) {
|
85 |
+
return true;
|
86 |
+
}
|
87 |
+
if (this.mimeType) {
|
88 |
+
return this.mimeType?.startsWith('audio/') || this.mimeType?.startsWith('application/ogg');
|
89 |
+
}
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
|
93 |
+
isVideo(): boolean {
|
94 |
+
if (this.fileType === EOmniFileTypes.video) {
|
95 |
+
return true;
|
96 |
+
}
|
97 |
+
if (this.mimeType) {
|
98 |
+
return this.mimeType?.startsWith('video/');
|
99 |
+
}
|
100 |
+
return false;
|
101 |
+
}
|
102 |
+
|
103 |
+
isImage(): boolean {
|
104 |
+
if (this.fileType === EOmniFileTypes.image) {
|
105 |
+
return true;
|
106 |
+
}
|
107 |
+
if (this.mimeType) {
|
108 |
+
return this.mimeType?.startsWith('image/');
|
109 |
+
}
|
110 |
+
return false;
|
111 |
+
}
|
112 |
+
isDocument(): boolean {
|
113 |
+
if (this.fileType === EOmniFileTypes.document) {
|
114 |
+
return true;
|
115 |
+
}
|
116 |
+
if (this.mimeType) {
|
117 |
+
return this.mimeType?.startsWith('text/') || this.mimeType?.startsWith('application/pdf');
|
118 |
+
}
|
119 |
+
return false;
|
120 |
+
}
|
121 |
+
|
122 |
+
asBase64(addHeader?: boolean): string | undefined {
|
123 |
+
if (this.data instanceof Buffer) {
|
124 |
+
if (addHeader) {
|
125 |
+
return `data:${this.mimeType};base64,${this.data.toString('base64')}`;
|
126 |
+
} else {
|
127 |
+
return this.data.toString('base64');
|
128 |
+
}
|
129 |
+
} else if (typeof this.data === 'string') {
|
130 |
+
return this.data;
|
131 |
+
}
|
132 |
+
}
|
133 |
+
}
|
packages/omni-sdk/src/Resources/OmniResource.ts
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
|
3 |
+
* All rights reserved.
|
4 |
+
*/
|
5 |
+
|
6 |
+
class OmniResource {
|
7 |
+
static isPlaceholder(obj: any) {
|
8 |
+
return obj?.onclick != null;
|
9 |
+
}
|
10 |
+
|
11 |
+
static isAudio(obj: any) {
|
12 |
+
return (
|
13 |
+
(obj && !OmniResource.isPlaceholder(obj) && obj?.mimeType?.startsWith('audio/')) ||
|
14 |
+
obj.mimeType == 'application/ogg'
|
15 |
+
);
|
16 |
+
}
|
17 |
+
|
18 |
+
static isImage(obj: any) {
|
19 |
+
return obj && !OmniResource.isPlaceholder(obj) && obj?.mimeType?.startsWith('image/');
|
20 |
+
}
|
21 |
+
|
22 |
+
static isDocument(obj: any) {
|
23 |
+
return (
|
24 |
+
obj &&
|
25 |
+
!OmniResource.isPlaceholder(obj) &&
|
26 |
+
(obj?.mimeType?.startsWith('text/') || obj?.mimeType?.startsWith('application/pdf'))
|
27 |
+
);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
export { OmniResource };
|
packages/omni-sdk/src/Utils/HttpClient.ts
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
|
3 |
+
* All rights reserved.
|
4 |
+
*/
|
5 |
+
|
6 |
+
export class HTTPClient {
|
7 |
+
fetch: Function;
|
8 |
+
constructor(
|
9 |
+
fetchFn: Function = (input: RequestInfo | URL, init?: RequestInit | undefined): Promise<Response> =>
|
10 |
+
window.fetch(input, init)
|
11 |
+
) {
|
12 |
+
this.fetch = fetchFn;
|
13 |
+
}
|
14 |
+
|
15 |
+
async executeRequest(input: RequestInfo | URL, init?: RequestInit | undefined) {
|
16 |
+
return await this.fetch(input, init);
|
17 |
+
}
|
18 |
+
}
|
packages/omni-sdk/src/index.ts
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
|
3 |
+
* All rights reserved.
|
4 |
+
*/
|
5 |
+
|
6 |
+
import OmniSDKClient from './OmniSDKClient';
|
7 |
+
import OmniSDKHost from './OmniSDKHost';
|
8 |
+
export * from './types';
|
9 |
+
export * from './MarkdownEngine';
|
10 |
+
export { OmniSDKHost, OmniSDKClient };
|
11 |
+
export * from './Resources/OmniBaseResource';
|
packages/omni-sdk/src/types.ts
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
|
3 |
+
* All rights reserved.
|
4 |
+
*/
|
5 |
+
|
6 |
+
export const OMNI_SDK_VERSION = '0.9.5';
|
7 |
+
|
8 |
+
export enum OmniSDKClientMessages {
|
9 |
+
REGISTRATION = 'client_registration',
|
10 |
+
DEREGISTRATION = 'client_deregistration',
|
11 |
+
SEND_CHAT_MESSAGE = 'client_send_chat',
|
12 |
+
RUN_CLIENT_SCRIPT = 'client_run_cscript',
|
13 |
+
SIGNAL_INTENT = 'client_signal_intent',
|
14 |
+
WINDOW_MESSAGE = 'client_window_message',
|
15 |
+
SHOW_TOAST = 'client_show_toast',
|
16 |
+
SHOW_EXTENSION = 'client_show_extension',
|
17 |
+
LOAD_RECIPE = 'client_load_recipe',
|
18 |
+
SHOW_TOP_BANNER = 'client_show_top_banner',
|
19 |
+
}
|
20 |
+
|
21 |
+
export enum OmniSDKStorageKeys {
|
22 |
+
INTENT_MAP = 'omni-intentMap'
|
23 |
+
}
|
24 |
+
|
25 |
+
export enum OmniSDKClientEvents {
|
26 |
+
DATA_UPDATED = 'data_updated',
|
27 |
+
CUSTOM_EVENT = 'custom_event',
|
28 |
+
CHAT_MESSAGE_RECEIVED = 'chat_message_received'
|
29 |
+
}
|
30 |
+
|
31 |
+
export enum OmniSDKHostMessages {
|
32 |
+
ACKNOWLEDGE = 'host_acknowledge',
|
33 |
+
CLIENT_SCRIPT_RESPONSE = 'host_cscript_response',
|
34 |
+
SYNC_DATA = 'host_sync_data',
|
35 |
+
CHAT_COMMAND = 'host_chat_command',
|
36 |
+
CHAT_MESSAGE_RECEIVED = 'host_chat_message_received',
|
37 |
+
CUSTOM_EVENT = 'custom_extension_event'
|
38 |
+
// ... any other host-specific messages
|
39 |
+
}
|
40 |
+
|
41 |
+
export interface IOmniMessage {
|
42 |
+
type: OmniSDKClientMessages | OmniSDKHostMessages;
|
43 |
+
token?: string;
|
44 |
+
}
|
45 |
+
|
46 |
+
export interface IOmniClientWindowMessage extends IOmniMessage {
|
47 |
+
type: OmniSDKClientMessages.WINDOW_MESSAGE;
|
48 |
+
action: 'hide' | 'show' | 'close';
|
49 |
+
args: any;
|
50 |
+
}
|
51 |
+
|
52 |
+
export interface IOmniHostCustomEventMessage extends IOmniMessage {
|
53 |
+
type: OmniSDKHostMessages.CUSTOM_EVENT;
|
54 |
+
extensionId: string;
|
55 |
+
eventId: string;
|
56 |
+
eventArgs: any;
|
57 |
+
}
|
58 |
+
|
59 |
+
export interface IOmniClientRegistrationMessage extends IOmniMessage {
|
60 |
+
type: OmniSDKClientMessages.REGISTRATION;
|
61 |
+
}
|
62 |
+
|
63 |
+
export interface IOmniClientDeregistrationMessage extends IOmniMessage {
|
64 |
+
type: OmniSDKClientMessages.DEREGISTRATION;
|
65 |
+
}
|
66 |
+
|
67 |
+
export interface IOmniClientSignalIntentMessage extends IOmniMessage {
|
68 |
+
type: OmniSDKClientMessages.SIGNAL_INTENT;
|
69 |
+
intent: 'show' | 'edit' | 'hide';
|
70 |
+
target: string;
|
71 |
+
payload: any;
|
72 |
+
opts: any;
|
73 |
+
}
|
74 |
+
|
75 |
+
export interface IOmniClientShowExtensionMessage extends IOmniMessage {
|
76 |
+
type: OmniSDKClientMessages.SHOW_EXTENSION;
|
77 |
+
action: 'open' | 'close';
|
78 |
+
extensionId: string;
|
79 |
+
args?: any;
|
80 |
+
page?: string;
|
81 |
+
opts?: any;
|
82 |
+
}
|
83 |
+
|
84 |
+
export interface IOmniClientLoadRecipeMessage extends IOmniMessage {
|
85 |
+
type: OmniSDKClientMessages.LOAD_RECIPE;
|
86 |
+
recipeId: string;
|
87 |
+
recipeVersion: string;
|
88 |
+
}
|
89 |
+
|
90 |
+
export interface IOmniClientRunClientScript extends IOmniMessage {
|
91 |
+
type: OmniSDKClientMessages.RUN_CLIENT_SCRIPT;
|
92 |
+
script: string;
|
93 |
+
args: any;
|
94 |
+
invokeId: string;
|
95 |
+
}
|
96 |
+
|
97 |
+
export interface IOmniClientShowToastMessage extends IOmniMessage {
|
98 |
+
type: OmniSDKClientMessages.SHOW_TOAST;
|
99 |
+
message: string;
|
100 |
+
options?: { description?: string; type?: string; position?: string; html?: string };
|
101 |
+
}
|
102 |
+
|
103 |
+
export interface IOmniClientShowTopBannerMessage extends IOmniMessage {
|
104 |
+
type: OmniSDKClientMessages.SHOW_TOP_BANNER;
|
105 |
+
bannerTitle: string;
|
106 |
+
bannerDescription: string;
|
107 |
+
options?: { link?: string; };
|
108 |
+
}
|
109 |
+
|
110 |
+
export interface IOmniClientChatMessage extends IOmniMessage {
|
111 |
+
type: OmniSDKClientMessages.SEND_CHAT_MESSAGE;
|
112 |
+
message: {
|
113 |
+
content: string;
|
114 |
+
type: string;
|
115 |
+
attachments?: any;
|
116 |
+
flags?: string[];
|
117 |
+
};
|
118 |
+
}
|
119 |
+
|
120 |
+
export interface IOmniHostSyncData extends IOmniMessage {
|
121 |
+
type: OmniSDKHostMessages.SYNC_DATA;
|
122 |
+
packet: 'intentMap';
|
123 |
+
frame: any;
|
124 |
+
}
|
125 |
+
|
126 |
+
export interface IOmniHostChatMessageReceived extends IOmniMessage {
|
127 |
+
type: OmniSDKHostMessages.CHAT_MESSAGE_RECEIVED;
|
128 |
+
message: any;
|
129 |
+
}
|
130 |
+
|
131 |
+
export interface IOmniCScriptResult extends IOmniMessage {
|
132 |
+
type: OmniSDKHostMessages.CLIENT_SCRIPT_RESPONSE;
|
133 |
+
result: any;
|
134 |
+
invokeId: string;
|
135 |
+
}
|
136 |
+
|
137 |
+
export interface ICdnResource {
|
138 |
+
fid: string;
|
139 |
+
ticket: {
|
140 |
+
fid: string;
|
141 |
+
};
|
142 |
+
fileName: string;
|
143 |
+
size: number;
|
144 |
+
data?: any; //Buffer | string | ReadStream | FileResult
|
145 |
+
url: string;
|
146 |
+
furl: string;
|
147 |
+
expires?: number;
|
148 |
+
mimeType?: string;
|
149 |
+
fileType: EOmniFileTypes;
|
150 |
+
meta: {};
|
151 |
+
}
|
152 |
+
|
153 |
+
export enum EOmniFileTypes {
|
154 |
+
image = 'image',
|
155 |
+
audio = 'audio',
|
156 |
+
document = 'document',
|
157 |
+
video = 'video',
|
158 |
+
file = 'file'
|
159 |
+
}
|
packages/omni-sdk/tsconfig.json
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"include": ["src", "../omni-shared/global.d.ts"],
|
3 |
+
"compilerOptions": {
|
4 |
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
5 |
+
|
6 |
+
/* Projects */
|
7 |
+
"incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
8 |
+
"composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
9 |
+
"tsBuildInfoFile": "./tsconfig.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
10 |
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
11 |
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
12 |
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
13 |
+
|
14 |
+
/* Language and Environment */
|
15 |
+
"target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
16 |
+
"lib": ["es2020", "dom"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
17 |
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
18 |
+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
19 |
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
20 |
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
21 |
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
22 |
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
23 |
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
24 |
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
25 |
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
26 |
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
27 |
+
|
28 |
+
/* Modules */
|
29 |
+
"module": "ES2020", /* Specify what module code is generated. */
|
30 |
+
"rootDir": "./src", /* Specify the root folder within your source files. */
|
31 |
+
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
32 |
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
33 |
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
34 |
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
35 |
+
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
36 |
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
37 |
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
38 |
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
39 |
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
40 |
+
"noResolve": false, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
41 |
+
|
42 |
+
/* JavaScript Support */
|
43 |
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
44 |
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
45 |
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
46 |
+
|
47 |
+
/* Emit */
|
48 |
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
49 |
+
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
50 |
+
"emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
51 |
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
52 |
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
53 |
+
"outDir": "./lib", /* Specify an output folder for all emitted files. */
|
54 |
+
// "removeComments": true, /* Disable emitting comments. */
|
55 |
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
56 |
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
57 |
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
58 |
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
59 |
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
60 |
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
61 |
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
62 |
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
63 |
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
64 |
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
65 |
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
66 |
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
67 |
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
68 |
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
69 |
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
70 |
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
71 |
+
|
72 |
+
/* Interop Constraints */
|
73 |
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
74 |
+
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
75 |
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
76 |
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
77 |
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
78 |
+
|
79 |
+
/* Type Checking */
|
80 |
+
"strict": true, /* Enable all strict type-checking options. */
|
81 |
+
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
82 |
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
83 |
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
84 |
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
85 |
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
86 |
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
87 |
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
88 |
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
89 |
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
90 |
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
91 |
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
92 |
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
93 |
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
94 |
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
95 |
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
96 |
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
97 |
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
98 |
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
99 |
+
|
100 |
+
/* Completeness */
|
101 |
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
102 |
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
103 |
+
},
|
104 |
+
}
|
packages/omni-server/.editorconfig
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
root = true
|
2 |
+
|
3 |
+
[*]
|
4 |
+
end_of_line = lf
|
5 |
+
insert_final_newline = true
|
6 |
+
|
7 |
+
[*.{js,json,yml}]
|
8 |
+
charset = utf-8
|
9 |
+
indent_style = space
|
10 |
+
indent_size = 2
|
packages/omni-server/.gitignore
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
public/*
|
2 |
+
etc/keystore/*
|
3 |
+
etc/db/*
|
4 |
+
etc/registry/.cache/*
|
5 |
+
etc/*/recipes/*
|
6 |
+
etc/wasm/*
|
7 |
+
etc/models/nsfwjs/inception-v3
|
8 |
+
extensions/*
|
9 |
+
tenants/*
|
10 |
+
dist/*
|
11 |
+
var/**/*
|
12 |
+
usr/**/*
|
13 |
+
data.local/**/*
|
14 |
+
config.local/**/*
|
15 |
+
!data.local/README.md
|
16 |
+
!config.local/README.md
|
17 |
+
!usr/README.md
|
packages/omni-server/.npmignore
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
public/*
|
2 |
+
etc/keystore/*
|
3 |
+
etc/db/*
|
4 |
+
etc/registry/.cache/*
|
5 |
+
etc/*/recipes/*
|
6 |
+
etc/wasm/*
|
7 |
+
etc/models/nsfwjs/inception-v3
|
8 |
+
extensions/*
|
9 |
+
tenants/*
|
10 |
+
dist/*
|
11 |
+
var/**/*
|
12 |
+
usr/**/*
|
13 |
+
data.local/
|
14 |
+
config.local/
|
15 |
+
!data.local/README.md
|
16 |
+
!config.local/README.md
|
packages/omni-server/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# Server
|
3 |
+
|
4 |
+
## Building
|
5 |
+
|
6 |
+
- Yarn build in the server directory will build.
|
7 |
+
- The codebase for server, shared and client is 90% typescript
|
8 |
+
- The compiler will reject any failed typing by default. Ideally errors should be fixed.
|
9 |
+
- In some situations //@ts-ignore is permissible which disables errors on the succeeding line
|
10 |
+
- On the server, we are targeting the latest ESM standard as there's no drawback or compatibility challenges
|
11 |
+
- On the client, ES2020 is the current target.
|
12 |
+
- To successfull pick up changes from omni-shared and other shared packages, yarn build has to be run.
|
13 |
+
|
14 |
+
|
15 |
+
## Server Architecture
|
16 |
+
|
17 |
+
- Server is started via src/run.ts
|
18 |
+
- Configuration is read from the monorepro root, merging .mercs.yaml with .mercs.local.yaml
|
19 |
+
|
20 |
+
- The server uses the omni-shared/app framework which runs on both node and browser and includes basic convenience functions like
|
21 |
+
- logging (consola based)
|
22 |
+
- event messaging (eventEmitter3)
|
23 |
+
- service infrastructure
|
24 |
+
- integrations infrastructure
|
25 |
+
|
26 |
+
- Services and integrations both inherit from Manageable.
|
27 |
+
- They are managed in the appy by a Manager for each type.
|
28 |
+
- Services provide constant functionality (e.g. web server, database, etc)
|
29 |
+
- Integrations provide smaller scoped feature functionality (such as API routes)
|
30 |
+
|
31 |
+
- Unversal services that could run on both server or client should be in mercs_hared/src/services
|
32 |
+
- Services that have significant overlap between client and server should inherit from a base service there
|
33 |
+
- Integrations will likely not have shared elements?
|
34 |
+
|
35 |
+
## Internal startup sequence
|
36 |
+
|
37 |
+
- server.instantiated
|
38 |
+
- server.use() called for any service or integration that needs to registered. Order matters.
|
39 |
+
- server.load() called
|
40 |
+
- server.onConfigure hook fires to allow modification of configuration at runtime (optional)
|
41 |
+
- all services are created()
|
42 |
+
- all services are loaded()
|
43 |
+
- app: loaded
|
44 |
+
- all integration are created()
|
45 |
+
- all integrations are loaded()
|
46 |
+
- all services are started()
|
47 |
+
- all integrations are started()
|
48 |
+
- app: started
|
49 |
+
- interrupt received
|
50 |
+
- all integrations are stopped()
|
51 |
+
- all services are stopped()
|
52 |
+
- app: stopped
|
53 |
+
|
54 |
+
|
55 |
+
## RPC
|
56 |
+
- The only way currently to communicate from client to server is through API routes
|
57 |
+
- The server can continously send events to the client leveraging the Server-side-event channel provided by the MercenariesDefaultIntegration.
|
58 |
+
|
59 |
+
## Integrations
|
60 |
+
|
61 |
+
Currently the only server integrations are APIIntegrations which have plumbing to automatically register routes and proxy routes from mercs.yaml.
|
62 |
+
|
63 |
+
## Managing credentials
|
64 |
+
|
65 |
+
To avoid confidential things ending up in a github repro, use .mercs.yaml.local for that for now.
|
66 |
+
|
67 |
+
## Client Startup
|
68 |
+
|
69 |
+
- The client is basically identical to the server in architecture as they use the same shared app framework.
|
70 |
+
|
71 |
+
## Tips and tricks
|
72 |
+
|
73 |
+
- Consola logging on the server can be adjusted in mercs.yaml > server > logger
|
74 |
+
- Consola logging on the client currently is changed in the constructor in vite-frontend/app.ts
|
75 |
+
|
76 |
+
|
77 |
+
|
packages/omni-server/build.js
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
|
3 |
+
* All rights reserved.
|
4 |
+
*/
|
5 |
+
|
6 |
+
import esbuild from 'esbuild';
|
7 |
+
import assert from 'node:assert';
|
8 |
+
import { execSync } from 'node:child_process';
|
9 |
+
|
10 |
+
const environment = process.argv[2];
|
11 |
+
assert(environment === 'production' || environment === 'development', 'Invalid environment ' + environment);
|
12 |
+
|
13 |
+
console.log(`Building omni-server (${environment})...`);
|
14 |
+
switch(environment) {
|
15 |
+
case 'production':
|
16 |
+
esbuild
|
17 |
+
.build({
|
18 |
+
entryPoints: ['src/run.ts'],
|
19 |
+
outdir: 'dist',
|
20 |
+
color: true,
|
21 |
+
bundle: true,
|
22 |
+
platform: 'node',
|
23 |
+
format: 'esm',
|
24 |
+
tsconfig: 'tsconfig.json',
|
25 |
+
logLevel: 'warning',
|
26 |
+
packages: 'external',
|
27 |
+
define: {
|
28 |
+
'process.env.NODE_ENV': `"${environment}"`
|
29 |
+
},
|
30 |
+
sourcemap: false,
|
31 |
+
external: ['sharp', 'better-sqlite3']
|
32 |
+
})
|
33 |
+
.then(() => console.log('Building omni-server done'))
|
34 |
+
.catch(() => process.exit(1));
|
35 |
+
break;
|
36 |
+
case 'development':
|
37 |
+
execSync('tsc --build', { stdio: 'inherit' });
|
38 |
+
break;
|
39 |
+
}
|
packages/omni-server/config.default/README.md
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# server/etc
|
2 |
+
|
3 |
+
This directory holds omnitool default configuration data.
|
4 |
+
|
5 |
+
./blocks/ - Custom api namespace and block defintions that are loaded in addition to official omnitool block
|
packages/omni-server/config.default/extensions/known_extensions.yaml
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
core_extensions:
|
2 |
+
- title: Blocks Registry
|
3 |
+
id: omni-core-blocks
|
4 |
+
url: https://raw.githubusercontent.com/omnitool-ai/omni-core-blocks/main/extension.yaml
|
5 |
+
- title: File Manager
|
6 |
+
id: omni-core-filemanager
|
7 |
+
url: https://raw.githubusercontent.com/omnitool-ai/omni-core-filemanager/master/extension.yaml
|
8 |
+
- title: Core Viewers
|
9 |
+
id: omni-core-viewers
|
10 |
+
url: https://raw.githubusercontent.com/omnitool-ai/omni-core-viewers/master/extension.yaml
|
11 |
+
- title: Collection Manager
|
12 |
+
id: omni-core-collectionmanager
|
13 |
+
url: https://raw.githubusercontent.com/omnitool-ai/omni-core-collectionmanager/main/extension.yaml
|
14 |
+
- title: Recipe Hub
|
15 |
+
id: omni-core-recipes
|
16 |
+
url: https://raw.githubusercontent.com/omnitool-ai/omni-core-recipes/main/extension.yaml
|
17 |
+
- title: LLMs Support
|
18 |
+
id: omni-core-llms
|
19 |
+
url: https://raw.githubusercontent.com/omnitool-ai/omni-core-llms/main/extension.yaml
|
20 |
+
- title: Replicate.com Support
|
21 |
+
id: omni-core-replicate
|
22 |
+
url: https://raw.githubusercontent.com/omnitool-ai/omni-core-replicate/master/extension.yaml
|
23 |
+
- title: FormIO Recipe UIs
|
24 |
+
id: omni-core-formio
|
25 |
+
url: https://raw.githubusercontent.com/omnitool-ai/omni-core-formio/main/extension.yaml
|
26 |
+
- title: Web UI
|
27 |
+
id: omni-core-web
|
28 |
+
url: https://raw.githubusercontent.com/omnitool-ai/omni-core-web/main/extension.yaml
|
29 |
+
|
30 |
+
known_extensions:
|
31 |
+
- title: Minipaint
|
32 |
+
id: omni-extension-minipaint
|
33 |
+
url: https://raw.githubusercontent.com/omnitool-community/omni-extension-minipaint/master/extension.yaml
|
34 |
+
- title: Sharp Image Processing
|
35 |
+
id: omni-extension-sharp
|
36 |
+
url: https://raw.githubusercontent.com/omnitool-community/omni-extension-sharp/master/extension.yaml
|
37 |
+
- title: Document Processing
|
38 |
+
id: omni-extension-document_processing
|
39 |
+
url: https://raw.githubusercontent.com/omnitool-community/omni-extension-document_processing/main/extension.yaml
|
40 |
+
- title: OpenPose 3D Editor
|
41 |
+
id: omni-extension-openpose-editor
|
42 |
+
url: https://raw.githubusercontent.com/omnitool-community/omni-extension-openpose-editor/master/extension.yaml
|
43 |
+
- title: Plyr Audio player
|
44 |
+
id: omni-extension-plyr
|
45 |
+
url: https://raw.githubusercontent.com/omnitool-community/omni-extension-plyr/master/extension.yaml
|
46 |
+
- title: PDF to Document Conversion
|
47 |
+
id: omni-extension-pdftodoc
|
48 |
+
url: https://raw.githubusercontent.com/omnitool-community/omni-extension-pdf2doc/main/extension.yaml
|
49 |
+
- title: Wavacity Audio Editor
|
50 |
+
id: omni-extension-wavacity
|
51 |
+
url: https://raw.githubusercontent.com/omnitool-community/omni-extension-wavacity/master/extension.yaml
|
52 |
+
- title: Web Crawler
|
53 |
+
id: omni-extension-webcrawler
|
54 |
+
url: https://raw.githubusercontent.com/omnitool-community/omni-extension-webcrawler/main/extension.yaml
|
55 |
+
- title: BabylonJs (Demo)
|
56 |
+
id: omni-extension-babylonjs
|
57 |
+
url: https://raw.githubusercontent.com/omnitool-community/omni-extension-babylonjs/master/extension.yaml
|
58 |
+
- title: WA-Like Chat UI (WIP)
|
59 |
+
id: omni-extension-wa-chat-ui
|
60 |
+
url: https://raw.githubusercontent.com/omnitool-community/omni-extension-wa-chat-ui/master/extension.yaml
|
61 |
+
- title: Omni Debugger
|
62 |
+
id: omni-extension-log-viewer
|
63 |
+
url: https://raw.githubusercontent.com/omnitool-community/omni-extension-log-viewer/main/extension.yaml
|
64 |
+
- title: TLDraw (Beta)
|
65 |
+
id: omni-extension-tldraw
|
66 |
+
url: https://raw.githubusercontent.com/omnitool-community/omni-extension-tldraw/master/extension.yaml
|
67 |
+
|
68 |
+
|
69 |
+
in_development:
|
70 |
+
- title: Feed Reader
|
71 |
+
id: omni-extension-feed
|
72 |
+
url: https://raw.githubusercontent.com/huntersjq/omni-extension-feed/main/extension.yaml
|
73 |
+
- title: Stability AI Support
|
74 |
+
id: omni-extension-stability
|
75 |
+
url: https://raw.githubusercontent.com/georgzoeller/omni-extension-stability/master/extension.yaml
|
76 |
+
- title: Doom
|
77 |
+
id: omni-extension-doom
|
78 |
+
url: https://raw.githubusercontent.com/georgzoeller/omni-extension-doom/master/extension.yaml
|
79 |
+
- title: PII Scrubber
|
80 |
+
id: omni-extension-pii-scrubber
|
81 |
+
url: https://raw.githubusercontent.com/georgzoeller/omni-extension-pii-scrubber/master/extension.yaml
|
82 |
+
- title: Flipbook
|
83 |
+
id: omni-extension-flipbook
|
84 |
+
url: https://raw.githubusercontent.com/georgzoeller/omni-extension-flipbook/master/extension.yaml
|
85 |
+
- title: UserDB Extension
|
86 |
+
id: omni-extension-userdb
|
87 |
+
url: https://raw.githubusercontent.com/georgzoeller/omni-extension-userdb/master/extension.yaml
|
88 |
+
- title: Invoice Generator
|
89 |
+
deprecated: true
|
90 |
+
id: omni-extension-invoice
|
91 |
+
url: https://raw.githubusercontent.com/georgzoeller/omni-extension-invoice/master/extension.yaml
|
92 |
+
- title: Local LLMs - Oobabooga Support (a.k.a. text-generation-webui)
|
93 |
+
id: omni-extension-oobabooga
|
94 |
+
url: https://raw.githubusercontent.com/manu-sapiens/omni-extension-oobabooga/main/extension.yaml
|
95 |
+
- title: Automatic1111 Support
|
96 |
+
id: omni-extension-automatic1111
|
97 |
+
url: https://raw.githubusercontent.com/georgzoeller/omni-extension-automatic1111/master/extension.yaml
|
98 |
+
- title: Local LLMs - LM Studio Support
|
99 |
+
id: omni-extension-lm-studio
|
100 |
+
url: https://raw.githubusercontent.com/manu-sapiens/omni-extension-lm-studio/main/extension.yaml
|
101 |
+
- title: ChatGPT UI
|
102 |
+
id: omnitool-extension-chatgpt-ui
|
103 |
+
url: https://raw.githubusercontent.com/georgzoeller/omnitool-chatgpt-ui/main/extension.yaml
|
104 |
+
deprecated: true
|
105 |
+
- title: 3D Texture Playground
|
106 |
+
id: omni-extension-texture-playground
|
107 |
+
url: https://raw.githubusercontent.com/georgzoeller/omni-extension-texture-playground/master/extension.yaml
|
108 |
+
deprecated: true
|
109 |
+
- title: Common Utilities
|
110 |
+
id: omni-extension-common-utils
|
111 |
+
url: https://raw.githubusercontent.com/georgzoeller/omni-extension-common-utils/master/extension.yaml
|