@pome-sh/cli 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-info.json +3 -3
- package/dist/src/doctor/checks.js +2 -2
- package/node_modules/@pome-sh/sdk/dist/db.d.ts +4 -4
- package/node_modules/@pome-sh/sdk/dist/db.js +93 -25
- package/node_modules/@pome-sh/sdk/dist/db.js.map +1 -1
- package/node_modules/@pome-sh/sdk/package.json +2 -6
- package/node_modules/@pome-sh/twin-github/README.md +2 -1
- package/node_modules/@pome-sh/twin-github/package.json +2 -3
- package/node_modules/@pome-sh/twin-slack/package.json +2 -3
- package/node_modules/@pome-sh/twin-stripe/README.md +2 -2
- package/node_modules/@pome-sh/twin-stripe/package.json +2 -3
- package/package.json +6 -7
- package/dist/src/recorder/verdictArtifact.d.ts +0 -71
- package/dist/src/recorder/verdictArtifact.js +0 -207
- package/dist/src/score/view.d.ts +0 -38
- package/dist/src/score/view.js +0 -59
- package/dist/src/twin/github/app.d.ts +0 -10
- package/dist/src/twin/github/app.js +0 -316
- package/dist/src/twin/github/db/migrations.d.ts +0 -2
- package/dist/src/twin/github/db/migrations.js +0 -64
- package/dist/src/twin/github/db/openDatabase.d.ts +0 -2
- package/dist/src/twin/github/db/openDatabase.js +0 -13
- package/dist/src/twin/github/db/queries.d.ts +0 -77
- package/dist/src/twin/github/db/queries.js +0 -93
- package/dist/src/twin/github/domain/seed.d.ts +0 -74
- package/dist/src/twin/github/domain/seed.js +0 -104
- package/dist/src/twin/github/domain/serializers.d.ts +0 -113
- package/dist/src/twin/github/domain/serializers.js +0 -76
- package/dist/src/twin/github/types.d.ts +0 -66
- package/dist/src/twin/github/types.js +0 -1
- package/dist/src/twin-github/app.d.ts +0 -9
- package/dist/src/twin-github/app.js +0 -327
- package/dist/src/twin-github/auth.d.ts +0 -16
- package/dist/src/twin-github/auth.js +0 -142
- package/dist/src/twin-github/build-info.d.ts +0 -7
- package/dist/src/twin-github/build-info.js +0 -52
- package/dist/src/twin-github/db.d.ts +0 -4
- package/dist/src/twin-github/db.js +0 -362
- package/dist/src/twin-github/domain.d.ts +0 -1649
- package/dist/src/twin-github/domain.js +0 -957
- package/dist/src/twin-github/errors.d.ts +0 -14
- package/dist/src/twin-github/errors.js +0 -34
- package/dist/src/twin-github/index.d.ts +0 -9
- package/dist/src/twin-github/index.js +0 -7
- package/dist/src/twin-github/mcp.d.ts +0 -17
- package/dist/src/twin-github/mcp.js +0 -281
- package/dist/src/twin-github/recorder.d.ts +0 -2
- package/dist/src/twin-github/recorder.js +0 -29
- package/dist/src/twin-github/seed.d.ts +0 -74
- package/dist/src/twin-github/seed.js +0 -107
- package/dist/src/twin-github/serializers.d.ts +0 -449
- package/dist/src/twin-github/serializers.js +0 -429
- package/dist/src/twin-github/server.d.ts +0 -1
- package/dist/src/twin-github/server.js +0 -34
- package/dist/src/twin-github/tools.d.ts +0 -1545
- package/dist/src/twin-github/tools.js +0 -347
- package/dist/src/twin-github/types.d.ts +0 -198
- package/dist/src/twin-github/types.js +0 -1
- package/dist/src/twin-github/unsupported-envelope.d.ts +0 -10
- package/dist/src/twin-github/unsupported-envelope.js +0 -29
- package/dist/src/twin-github/util.d.ts +0 -13
- package/dist/src/twin-github/util.js +0 -61
- package/dist/src/twin-slack/app.d.ts +0 -17
- package/dist/src/twin-slack/app.js +0 -683
- package/dist/src/twin-slack/auth.d.ts +0 -38
- package/dist/src/twin-slack/auth.js +0 -219
- package/dist/src/twin-slack/build-info.d.ts +0 -7
- package/dist/src/twin-slack/build-info.js +0 -9
- package/dist/src/twin-slack/db.d.ts +0 -4
- package/dist/src/twin-slack/db.js +0 -213
- package/dist/src/twin-slack/domain.d.ts +0 -236
- package/dist/src/twin-slack/domain.js +0 -1293
- package/dist/src/twin-slack/errors.d.ts +0 -16
- package/dist/src/twin-slack/errors.js +0 -60
- package/dist/src/twin-slack/index.d.ts +0 -8
- package/dist/src/twin-slack/index.js +0 -8
- package/dist/src/twin-slack/mcp.d.ts +0 -17
- package/dist/src/twin-slack/mcp.js +0 -226
- package/dist/src/twin-slack/recorder.d.ts +0 -2
- package/dist/src/twin-slack/recorder.js +0 -15
- package/dist/src/twin-slack/seed.d.ts +0 -49
- package/dist/src/twin-slack/seed.js +0 -139
- package/dist/src/twin-slack/serializers.d.ts +0 -141
- package/dist/src/twin-slack/serializers.js +0 -377
- package/dist/src/twin-slack/tools.d.ts +0 -97
- package/dist/src/twin-slack/tools.js +0 -171
- package/dist/src/twin-slack/types.d.ts +0 -164
- package/dist/src/twin-slack/types.js +0 -1
- package/dist/src/twin-slack/unsupported-envelope.d.ts +0 -12
- package/dist/src/twin-slack/unsupported-envelope.js +0 -61
- package/dist/src/twin-slack/upstream-types.d.ts +0 -19
- package/dist/src/twin-slack/upstream-types.js +0 -1
- package/dist/src/twin-slack/util.d.ts +0 -31
- package/dist/src/twin-slack/util.js +0 -136
- package/node_modules/base64-js/LICENSE +0 -21
- package/node_modules/base64-js/README.md +0 -34
- package/node_modules/base64-js/base64js.min.js +0 -1
- package/node_modules/base64-js/index.d.ts +0 -3
- package/node_modules/base64-js/index.js +0 -150
- package/node_modules/base64-js/package.json +0 -47
- package/node_modules/better-sqlite3/LICENSE +0 -21
- package/node_modules/better-sqlite3/README.md +0 -99
- package/node_modules/better-sqlite3/binding.gyp +0 -38
- package/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
- package/node_modules/better-sqlite3/deps/common.gypi +0 -68
- package/node_modules/better-sqlite3/deps/copy.js +0 -31
- package/node_modules/better-sqlite3/deps/defines.gypi +0 -42
- package/node_modules/better-sqlite3/deps/download.sh +0 -123
- package/node_modules/better-sqlite3/deps/patches/1208.patch +0 -15
- package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.c +0 -269395
- package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.h +0 -14347
- package/node_modules/better-sqlite3/deps/sqlite3/sqlite3ext.h +0 -739
- package/node_modules/better-sqlite3/deps/sqlite3.gyp +0 -80
- package/node_modules/better-sqlite3/deps/test_extension.c +0 -21
- package/node_modules/better-sqlite3/lib/database.js +0 -90
- package/node_modules/better-sqlite3/lib/index.js +0 -3
- package/node_modules/better-sqlite3/lib/methods/aggregate.js +0 -43
- package/node_modules/better-sqlite3/lib/methods/backup.js +0 -67
- package/node_modules/better-sqlite3/lib/methods/function.js +0 -31
- package/node_modules/better-sqlite3/lib/methods/inspect.js +0 -7
- package/node_modules/better-sqlite3/lib/methods/pragma.js +0 -12
- package/node_modules/better-sqlite3/lib/methods/serialize.js +0 -16
- package/node_modules/better-sqlite3/lib/methods/table.js +0 -189
- package/node_modules/better-sqlite3/lib/methods/transaction.js +0 -78
- package/node_modules/better-sqlite3/lib/methods/wrappers.js +0 -54
- package/node_modules/better-sqlite3/lib/sqlite-error.js +0 -20
- package/node_modules/better-sqlite3/lib/util.js +0 -12
- package/node_modules/better-sqlite3/package.json +0 -59
- package/node_modules/better-sqlite3/src/addon.cpp +0 -47
- package/node_modules/better-sqlite3/src/better_sqlite3.cpp +0 -74
- package/node_modules/better-sqlite3/src/objects/backup.cpp +0 -120
- package/node_modules/better-sqlite3/src/objects/backup.hpp +0 -36
- package/node_modules/better-sqlite3/src/objects/database.cpp +0 -417
- package/node_modules/better-sqlite3/src/objects/database.hpp +0 -103
- package/node_modules/better-sqlite3/src/objects/statement-iterator.cpp +0 -113
- package/node_modules/better-sqlite3/src/objects/statement-iterator.hpp +0 -50
- package/node_modules/better-sqlite3/src/objects/statement.cpp +0 -383
- package/node_modules/better-sqlite3/src/objects/statement.hpp +0 -58
- package/node_modules/better-sqlite3/src/util/bind-map.cpp +0 -73
- package/node_modules/better-sqlite3/src/util/binder.cpp +0 -193
- package/node_modules/better-sqlite3/src/util/constants.cpp +0 -172
- package/node_modules/better-sqlite3/src/util/custom-aggregate.cpp +0 -121
- package/node_modules/better-sqlite3/src/util/custom-function.cpp +0 -59
- package/node_modules/better-sqlite3/src/util/custom-table.cpp +0 -409
- package/node_modules/better-sqlite3/src/util/data-converter.cpp +0 -17
- package/node_modules/better-sqlite3/src/util/data.cpp +0 -194
- package/node_modules/better-sqlite3/src/util/helpers.cpp +0 -109
- package/node_modules/better-sqlite3/src/util/macros.cpp +0 -90
- package/node_modules/better-sqlite3/src/util/query-macros.cpp +0 -71
- package/node_modules/better-sqlite3/src/util/row-builder.cpp +0 -49
- package/node_modules/bindings/LICENSE.md +0 -22
- package/node_modules/bindings/README.md +0 -98
- package/node_modules/bindings/bindings.js +0 -221
- package/node_modules/bindings/package.json +0 -28
- package/node_modules/bl/.travis.yml +0 -17
- package/node_modules/bl/BufferList.js +0 -396
- package/node_modules/bl/LICENSE.md +0 -13
- package/node_modules/bl/README.md +0 -247
- package/node_modules/bl/bl.js +0 -84
- package/node_modules/bl/package.json +0 -37
- package/node_modules/bl/test/convert.js +0 -21
- package/node_modules/bl/test/indexOf.js +0 -492
- package/node_modules/bl/test/isBufferList.js +0 -32
- package/node_modules/bl/test/test.js +0 -869
- package/node_modules/buffer/AUTHORS.md +0 -70
- package/node_modules/buffer/LICENSE +0 -21
- package/node_modules/buffer/README.md +0 -410
- package/node_modules/buffer/index.d.ts +0 -186
- package/node_modules/buffer/index.js +0 -1817
- package/node_modules/buffer/package.json +0 -96
- package/node_modules/chownr/LICENSE +0 -15
- package/node_modules/chownr/README.md +0 -3
- package/node_modules/chownr/chownr.js +0 -167
- package/node_modules/chownr/package.json +0 -29
- package/node_modules/decompress-response/index.d.ts +0 -22
- package/node_modules/decompress-response/index.js +0 -58
- package/node_modules/decompress-response/license +0 -9
- package/node_modules/decompress-response/package.json +0 -56
- package/node_modules/decompress-response/readme.md +0 -48
- package/node_modules/deep-extend/CHANGELOG.md +0 -46
- package/node_modules/deep-extend/LICENSE +0 -20
- package/node_modules/deep-extend/README.md +0 -91
- package/node_modules/deep-extend/index.js +0 -1
- package/node_modules/deep-extend/lib/deep-extend.js +0 -150
- package/node_modules/deep-extend/package.json +0 -62
- package/node_modules/detect-libc/LICENSE +0 -201
- package/node_modules/detect-libc/README.md +0 -163
- package/node_modules/detect-libc/index.d.ts +0 -14
- package/node_modules/detect-libc/lib/detect-libc.js +0 -313
- package/node_modules/detect-libc/lib/elf.js +0 -39
- package/node_modules/detect-libc/lib/filesystem.js +0 -51
- package/node_modules/detect-libc/lib/process.js +0 -24
- package/node_modules/detect-libc/package.json +0 -44
- package/node_modules/end-of-stream/LICENSE +0 -21
- package/node_modules/end-of-stream/README.md +0 -54
- package/node_modules/end-of-stream/index.js +0 -96
- package/node_modules/end-of-stream/package.json +0 -37
- package/node_modules/expand-template/.travis.yml +0 -6
- package/node_modules/expand-template/LICENSE +0 -21
- package/node_modules/expand-template/README.md +0 -43
- package/node_modules/expand-template/index.js +0 -26
- package/node_modules/expand-template/package.json +0 -29
- package/node_modules/expand-template/test.js +0 -67
- package/node_modules/file-uri-to-path/.npmignore +0 -1
- package/node_modules/file-uri-to-path/.travis.yml +0 -30
- package/node_modules/file-uri-to-path/History.md +0 -21
- package/node_modules/file-uri-to-path/LICENSE +0 -20
- package/node_modules/file-uri-to-path/README.md +0 -74
- package/node_modules/file-uri-to-path/index.d.ts +0 -2
- package/node_modules/file-uri-to-path/index.js +0 -66
- package/node_modules/file-uri-to-path/package.json +0 -32
- package/node_modules/file-uri-to-path/test/test.js +0 -24
- package/node_modules/file-uri-to-path/test/tests.json +0 -13
- package/node_modules/fs-constants/LICENSE +0 -21
- package/node_modules/fs-constants/README.md +0 -26
- package/node_modules/fs-constants/browser.js +0 -1
- package/node_modules/fs-constants/index.js +0 -1
- package/node_modules/fs-constants/package.json +0 -19
- package/node_modules/github-from-package/.travis.yml +0 -4
- package/node_modules/github-from-package/LICENSE +0 -18
- package/node_modules/github-from-package/example/package.json +0 -8
- package/node_modules/github-from-package/example/url.js +0 -3
- package/node_modules/github-from-package/index.js +0 -17
- package/node_modules/github-from-package/package.json +0 -30
- package/node_modules/github-from-package/readme.markdown +0 -53
- package/node_modules/github-from-package/test/a.json +0 -8
- package/node_modules/github-from-package/test/b.json +0 -5
- package/node_modules/github-from-package/test/c.json +0 -5
- package/node_modules/github-from-package/test/d.json +0 -7
- package/node_modules/github-from-package/test/e.json +0 -5
- package/node_modules/github-from-package/test/url.js +0 -19
- package/node_modules/ieee754/LICENSE +0 -11
- package/node_modules/ieee754/README.md +0 -51
- package/node_modules/ieee754/index.d.ts +0 -10
- package/node_modules/ieee754/index.js +0 -85
- package/node_modules/ieee754/package.json +0 -52
- package/node_modules/inherits/LICENSE +0 -16
- package/node_modules/inherits/README.md +0 -42
- package/node_modules/inherits/inherits.js +0 -9
- package/node_modules/inherits/inherits_browser.js +0 -27
- package/node_modules/inherits/package.json +0 -29
- package/node_modules/ini/LICENSE +0 -15
- package/node_modules/ini/README.md +0 -102
- package/node_modules/ini/ini.js +0 -206
- package/node_modules/ini/package.json +0 -33
- package/node_modules/mimic-response/index.d.ts +0 -17
- package/node_modules/mimic-response/index.js +0 -77
- package/node_modules/mimic-response/license +0 -9
- package/node_modules/mimic-response/package.json +0 -42
- package/node_modules/mimic-response/readme.md +0 -78
- package/node_modules/minimist/.eslintrc +0 -29
- package/node_modules/minimist/.github/FUNDING.yml +0 -12
- package/node_modules/minimist/.nycrc +0 -14
- package/node_modules/minimist/CHANGELOG.md +0 -298
- package/node_modules/minimist/LICENSE +0 -18
- package/node_modules/minimist/README.md +0 -121
- package/node_modules/minimist/example/parse.js +0 -4
- package/node_modules/minimist/index.js +0 -263
- package/node_modules/minimist/package.json +0 -75
- package/node_modules/minimist/test/all_bool.js +0 -34
- package/node_modules/minimist/test/bool.js +0 -177
- package/node_modules/minimist/test/dash.js +0 -43
- package/node_modules/minimist/test/default_bool.js +0 -37
- package/node_modules/minimist/test/dotted.js +0 -24
- package/node_modules/minimist/test/kv_short.js +0 -32
- package/node_modules/minimist/test/long.js +0 -33
- package/node_modules/minimist/test/num.js +0 -38
- package/node_modules/minimist/test/parse.js +0 -209
- package/node_modules/minimist/test/parse_modified.js +0 -11
- package/node_modules/minimist/test/proto.js +0 -64
- package/node_modules/minimist/test/short.js +0 -69
- package/node_modules/minimist/test/stop_early.js +0 -17
- package/node_modules/minimist/test/unknown.js +0 -104
- package/node_modules/minimist/test/whitespace.js +0 -10
- package/node_modules/mkdirp-classic/LICENSE +0 -21
- package/node_modules/mkdirp-classic/README.md +0 -18
- package/node_modules/mkdirp-classic/index.js +0 -98
- package/node_modules/mkdirp-classic/package.json +0 -18
- package/node_modules/napi-build-utils/.github/workflows/run-npm-tests.yml +0 -31
- package/node_modules/napi-build-utils/LICENSE +0 -21
- package/node_modules/napi-build-utils/README.md +0 -52
- package/node_modules/napi-build-utils/index.js +0 -214
- package/node_modules/napi-build-utils/index.md +0 -0
- package/node_modules/napi-build-utils/package.json +0 -42
- package/node_modules/node-abi/LICENSE +0 -21
- package/node_modules/node-abi/README.md +0 -54
- package/node_modules/node-abi/abi_registry.json +0 -453
- package/node_modules/node-abi/index.js +0 -179
- package/node_modules/node-abi/package.json +0 -45
- package/node_modules/once/LICENSE +0 -15
- package/node_modules/once/README.md +0 -79
- package/node_modules/once/once.js +0 -42
- package/node_modules/once/package.json +0 -33
- package/node_modules/prebuild-install/CHANGELOG.md +0 -131
- package/node_modules/prebuild-install/CONTRIBUTING.md +0 -6
- package/node_modules/prebuild-install/LICENSE +0 -21
- package/node_modules/prebuild-install/README.md +0 -163
- package/node_modules/prebuild-install/asset.js +0 -44
- package/node_modules/prebuild-install/bin.js +0 -78
- package/node_modules/prebuild-install/download.js +0 -142
- package/node_modules/prebuild-install/error.js +0 -14
- package/node_modules/prebuild-install/help.txt +0 -16
- package/node_modules/prebuild-install/index.js +0 -1
- package/node_modules/prebuild-install/log.js +0 -33
- package/node_modules/prebuild-install/package.json +0 -67
- package/node_modules/prebuild-install/proxy.js +0 -35
- package/node_modules/prebuild-install/rc.js +0 -64
- package/node_modules/prebuild-install/util.js +0 -143
- package/node_modules/pump/.github/FUNDING.yml +0 -2
- package/node_modules/pump/.travis.yml +0 -5
- package/node_modules/pump/LICENSE +0 -21
- package/node_modules/pump/README.md +0 -74
- package/node_modules/pump/SECURITY.md +0 -5
- package/node_modules/pump/empty.js +0 -1
- package/node_modules/pump/index.js +0 -86
- package/node_modules/pump/package.json +0 -30
- package/node_modules/pump/test-browser.js +0 -66
- package/node_modules/pump/test-node.js +0 -53
- package/node_modules/rc/LICENSE.APACHE2 +0 -15
- package/node_modules/rc/LICENSE.BSD +0 -26
- package/node_modules/rc/LICENSE.MIT +0 -24
- package/node_modules/rc/README.md +0 -227
- package/node_modules/rc/browser.js +0 -7
- package/node_modules/rc/cli.js +0 -4
- package/node_modules/rc/index.js +0 -53
- package/node_modules/rc/lib/utils.js +0 -104
- package/node_modules/rc/package.json +0 -29
- package/node_modules/rc/test/ini.js +0 -16
- package/node_modules/rc/test/nested-env-vars.js +0 -50
- package/node_modules/rc/test/test.js +0 -59
- package/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- package/node_modules/readable-stream/GOVERNANCE.md +0 -136
- package/node_modules/readable-stream/LICENSE +0 -47
- package/node_modules/readable-stream/README.md +0 -106
- package/node_modules/readable-stream/errors-browser.js +0 -127
- package/node_modules/readable-stream/errors.js +0 -116
- package/node_modules/readable-stream/experimentalWarning.js +0 -17
- package/node_modules/readable-stream/lib/_stream_duplex.js +0 -126
- package/node_modules/readable-stream/lib/_stream_passthrough.js +0 -37
- package/node_modules/readable-stream/lib/_stream_readable.js +0 -1027
- package/node_modules/readable-stream/lib/_stream_transform.js +0 -190
- package/node_modules/readable-stream/lib/_stream_writable.js +0 -641
- package/node_modules/readable-stream/lib/internal/streams/async_iterator.js +0 -180
- package/node_modules/readable-stream/lib/internal/streams/buffer_list.js +0 -183
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -96
- package/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +0 -86
- package/node_modules/readable-stream/lib/internal/streams/from-browser.js +0 -3
- package/node_modules/readable-stream/lib/internal/streams/from.js +0 -52
- package/node_modules/readable-stream/lib/internal/streams/pipeline.js +0 -86
- package/node_modules/readable-stream/lib/internal/streams/state.js +0 -22
- package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- package/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- package/node_modules/readable-stream/package.json +0 -68
- package/node_modules/readable-stream/readable-browser.js +0 -9
- package/node_modules/readable-stream/readable.js +0 -16
- package/node_modules/safe-buffer/LICENSE +0 -21
- package/node_modules/safe-buffer/README.md +0 -584
- package/node_modules/safe-buffer/index.d.ts +0 -187
- package/node_modules/safe-buffer/index.js +0 -65
- package/node_modules/safe-buffer/package.json +0 -51
- package/node_modules/semver/LICENSE +0 -15
- package/node_modules/semver/README.md +0 -680
- package/node_modules/semver/bin/semver.js +0 -195
- package/node_modules/semver/classes/comparator.js +0 -143
- package/node_modules/semver/classes/index.js +0 -7
- package/node_modules/semver/classes/range.js +0 -577
- package/node_modules/semver/classes/semver.js +0 -350
- package/node_modules/semver/functions/clean.js +0 -8
- package/node_modules/semver/functions/cmp.js +0 -54
- package/node_modules/semver/functions/coerce.js +0 -62
- package/node_modules/semver/functions/compare-build.js +0 -9
- package/node_modules/semver/functions/compare-loose.js +0 -5
- package/node_modules/semver/functions/compare.js +0 -7
- package/node_modules/semver/functions/diff.js +0 -60
- package/node_modules/semver/functions/eq.js +0 -5
- package/node_modules/semver/functions/gt.js +0 -5
- package/node_modules/semver/functions/gte.js +0 -5
- package/node_modules/semver/functions/inc.js +0 -21
- package/node_modules/semver/functions/lt.js +0 -5
- package/node_modules/semver/functions/lte.js +0 -5
- package/node_modules/semver/functions/major.js +0 -5
- package/node_modules/semver/functions/minor.js +0 -5
- package/node_modules/semver/functions/neq.js +0 -5
- package/node_modules/semver/functions/parse.js +0 -18
- package/node_modules/semver/functions/patch.js +0 -5
- package/node_modules/semver/functions/prerelease.js +0 -8
- package/node_modules/semver/functions/rcompare.js +0 -5
- package/node_modules/semver/functions/rsort.js +0 -5
- package/node_modules/semver/functions/satisfies.js +0 -12
- package/node_modules/semver/functions/sort.js +0 -5
- package/node_modules/semver/functions/truncate.js +0 -48
- package/node_modules/semver/functions/valid.js +0 -8
- package/node_modules/semver/index.js +0 -93
- package/node_modules/semver/internal/constants.js +0 -37
- package/node_modules/semver/internal/debug.js +0 -11
- package/node_modules/semver/internal/identifiers.js +0 -29
- package/node_modules/semver/internal/lrucache.js +0 -42
- package/node_modules/semver/internal/parse-options.js +0 -17
- package/node_modules/semver/internal/re.js +0 -223
- package/node_modules/semver/package.json +0 -78
- package/node_modules/semver/preload.js +0 -4
- package/node_modules/semver/range.bnf +0 -17
- package/node_modules/semver/ranges/gtr.js +0 -6
- package/node_modules/semver/ranges/intersects.js +0 -9
- package/node_modules/semver/ranges/ltr.js +0 -6
- package/node_modules/semver/ranges/max-satisfying.js +0 -27
- package/node_modules/semver/ranges/min-satisfying.js +0 -26
- package/node_modules/semver/ranges/min-version.js +0 -63
- package/node_modules/semver/ranges/outside.js +0 -82
- package/node_modules/semver/ranges/simplify.js +0 -49
- package/node_modules/semver/ranges/subset.js +0 -249
- package/node_modules/semver/ranges/to-comparators.js +0 -10
- package/node_modules/semver/ranges/valid.js +0 -13
- package/node_modules/simple-concat/.travis.yml +0 -3
- package/node_modules/simple-concat/LICENSE +0 -20
- package/node_modules/simple-concat/README.md +0 -44
- package/node_modules/simple-concat/index.js +0 -15
- package/node_modules/simple-concat/package.json +0 -47
- package/node_modules/simple-concat/test/basic.js +0 -41
- package/node_modules/simple-get/.github/dependabot.yml +0 -15
- package/node_modules/simple-get/.github/workflows/ci.yml +0 -23
- package/node_modules/simple-get/LICENSE +0 -20
- package/node_modules/simple-get/README.md +0 -333
- package/node_modules/simple-get/index.js +0 -108
- package/node_modules/simple-get/package.json +0 -67
- package/node_modules/string_decoder/LICENSE +0 -48
- package/node_modules/string_decoder/README.md +0 -47
- package/node_modules/string_decoder/lib/string_decoder.js +0 -296
- package/node_modules/string_decoder/package.json +0 -34
- package/node_modules/strip-json-comments/index.js +0 -70
- package/node_modules/strip-json-comments/license +0 -21
- package/node_modules/strip-json-comments/package.json +0 -42
- package/node_modules/strip-json-comments/readme.md +0 -64
- package/node_modules/tar-fs/.travis.yml +0 -6
- package/node_modules/tar-fs/LICENSE +0 -21
- package/node_modules/tar-fs/README.md +0 -165
- package/node_modules/tar-fs/index.js +0 -392
- package/node_modules/tar-fs/package.json +0 -46
- package/node_modules/tar-fs/test/fixtures/a/hello.txt +0 -1
- package/node_modules/tar-fs/test/fixtures/b/a/test.txt +0 -1
- package/node_modules/tar-fs/test/fixtures/d/file1 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/file2 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-dir/file5 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-files/file3 +0 -0
- package/node_modules/tar-fs/test/fixtures/d/sub-files/file4 +0 -0
- package/node_modules/tar-fs/test/fixtures/e/directory/.ignore +0 -0
- package/node_modules/tar-fs/test/fixtures/e/file +0 -0
- package/node_modules/tar-fs/test/fixtures/invalid.tar +0 -0
- package/node_modules/tar-fs/test/index.js +0 -457
- package/node_modules/tar-stream/LICENSE +0 -21
- package/node_modules/tar-stream/README.md +0 -168
- package/node_modules/tar-stream/extract.js +0 -257
- package/node_modules/tar-stream/headers.js +0 -295
- package/node_modules/tar-stream/index.js +0 -2
- package/node_modules/tar-stream/pack.js +0 -255
- package/node_modules/tar-stream/package.json +0 -58
- package/node_modules/tar-stream/sandbox.js +0 -11
- package/node_modules/tunnel-agent/LICENSE +0 -55
- package/node_modules/tunnel-agent/README.md +0 -4
- package/node_modules/tunnel-agent/index.js +0 -244
- package/node_modules/tunnel-agent/package.json +0 -22
- package/node_modules/util-deprecate/History.md +0 -16
- package/node_modules/util-deprecate/LICENSE +0 -24
- package/node_modules/util-deprecate/README.md +0 -53
- package/node_modules/util-deprecate/browser.js +0 -67
- package/node_modules/util-deprecate/node.js +0 -6
- package/node_modules/util-deprecate/package.json +0 -27
- package/node_modules/wrappy/LICENSE +0 -15
- package/node_modules/wrappy/README.md +0 -36
- package/node_modules/wrappy/package.json +0 -29
- package/node_modules/wrappy/wrappy.js +0 -33
|
@@ -1,683 +0,0 @@
|
|
|
1
|
-
import { Hono } from "hono";
|
|
2
|
-
import { ZodError } from "zod";
|
|
3
|
-
import { bearerAuth, requireAdminAuth } from "./auth.js";
|
|
4
|
-
import { twinBuildInfo } from "./build-info.js";
|
|
5
|
-
import { openSlackTwinDatabase } from "./db.js";
|
|
6
|
-
import { SlackDomain } from "./domain.js";
|
|
7
|
-
import { TwinError, twinErrorFromSqliteConstraint } from "./errors.js";
|
|
8
|
-
import { handleMcpRequest, mcpMethodNotAllowed } from "./mcp.js";
|
|
9
|
-
import { defaultSeedState } from "./seed.js";
|
|
10
|
-
import { listTools, executeTool, isMutatingTool, toolDefinitions } from "./tools.js";
|
|
11
|
-
import { slackError, slackOk } from "./serializers.js";
|
|
12
|
-
import { unsupportedEnvelope } from "./unsupported-envelope.js";
|
|
13
|
-
import { asBool, asNumber, asString, asOptionalString, nowIso, parseFormOrJson, requestId } from "./util.js";
|
|
14
|
-
import { redactSecrets } from "../recorder/redaction.js";
|
|
15
|
-
export function createSlackTwinApp(opts = {}) {
|
|
16
|
-
const db = opts.db ?? openSlackTwinDatabase(":memory:");
|
|
17
|
-
const domain = opts.domain ?? new SlackDomain(db);
|
|
18
|
-
const recorder = opts.recorder;
|
|
19
|
-
const runId = opts.runId ?? "spawn";
|
|
20
|
-
const app = new Hono();
|
|
21
|
-
// Root health (no auth).
|
|
22
|
-
app.get("/healthz", (c) => {
|
|
23
|
-
return c.json({
|
|
24
|
-
ok: true,
|
|
25
|
-
twin: "slack",
|
|
26
|
-
implementation: "slack_clone",
|
|
27
|
-
tools: toolDefinitions.length,
|
|
28
|
-
runtime: twinBuildInfo(),
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
// Admin (localhost-only).
|
|
32
|
-
const admin = new Hono();
|
|
33
|
-
admin.use("*", requireAdminAuth());
|
|
34
|
-
admin.post("/reset", async (c) => {
|
|
35
|
-
return handleAdmin(c, recorder, runId, "admin/reset", async () => {
|
|
36
|
-
let delta = null;
|
|
37
|
-
domain.resetToDefault(defaultSeedState, (d) => {
|
|
38
|
-
delta = d;
|
|
39
|
-
});
|
|
40
|
-
return { ok: true, delta };
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
admin.post("/seed", async (c) => {
|
|
44
|
-
return handleAdmin(c, recorder, runId, "admin/seed", async () => {
|
|
45
|
-
const body = await parseFormOrJson(c);
|
|
46
|
-
let delta = null;
|
|
47
|
-
domain.applySeed(body.seed ?? body, (d) => {
|
|
48
|
-
delta = d;
|
|
49
|
-
});
|
|
50
|
-
return { ok: true, delta };
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
app.route("/admin", admin);
|
|
54
|
-
// Session-scoped routes — all require bearer JWT.
|
|
55
|
-
const session = new Hono();
|
|
56
|
-
session.use("*", bearerAuth());
|
|
57
|
-
session.get("/healthz", (c) => c.json({ ok: true, sid: c.req.param("sid") }));
|
|
58
|
-
session.get("/_pome/health", (c) => c.json({ ok: true, twin: "slack" }));
|
|
59
|
-
session.get("/_pome/state", (c) => c.json(redactSecrets(domain.exportState())));
|
|
60
|
-
session.get("/_pome/events", (c) => c.json(recorder ? recorder.events() : []));
|
|
61
|
-
// MCP — JSON-RPC 2.0 streamable HTTP.
|
|
62
|
-
session.post("/mcp", (c) => handleMcpRequest(c, { domain, recorder, runId }));
|
|
63
|
-
session.get("/mcp", (c) => mcpMethodNotAllowed(c));
|
|
64
|
-
session.delete("/mcp", (c) => mcpMethodNotAllowed(c));
|
|
65
|
-
// Legacy tool listing + dispatch.
|
|
66
|
-
session.get("/mcp/tools", (c) => c.json({ tools: listTools() }));
|
|
67
|
-
session.post("/mcp/call", async (c) => {
|
|
68
|
-
const body = await parseFormOrJson(c);
|
|
69
|
-
const name = asOptionalString(body.tool ?? body.name);
|
|
70
|
-
const args = (body.arguments ?? body.params ?? {});
|
|
71
|
-
if (!name)
|
|
72
|
-
return jsonSlackError(c, "invalid_arguments", 400);
|
|
73
|
-
if (!toolDefinitions.some((t) => t.name === name))
|
|
74
|
-
return jsonSlackError(c, "unknown_tool", 404);
|
|
75
|
-
return handle(c, recorder, runId, name, async () => {
|
|
76
|
-
let delta = null;
|
|
77
|
-
const result = executeTool(domain, name, args, (d) => {
|
|
78
|
-
delta = d;
|
|
79
|
-
}, actorFrom(c));
|
|
80
|
-
return { body: ensureOk(result), delta, mutation: isMutatingTool(name) };
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
84
|
-
// Auth
|
|
85
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
86
|
-
const handleAuthTest = async (c) => handle(c, recorder, runId, "auth.test", async () => {
|
|
87
|
-
const result = domain.authTest(actorFrom(c));
|
|
88
|
-
return { body: slackOk(result) };
|
|
89
|
-
});
|
|
90
|
-
session.get("/auth.test", handleAuthTest);
|
|
91
|
-
session.post("/auth.test", handleAuthTest);
|
|
92
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
93
|
-
// Conversations
|
|
94
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
95
|
-
const handleConversationsList = async (c) => handle(c, recorder, runId, "conversations.list", async () => {
|
|
96
|
-
const args = await readArgs(c);
|
|
97
|
-
const result = domain.conversationsList({
|
|
98
|
-
types: asOptionalString(args.types),
|
|
99
|
-
exclude_archived: asBool(args.exclude_archived, false),
|
|
100
|
-
limit: args.limit !== undefined ? asNumber(args.limit, 100) : undefined,
|
|
101
|
-
cursor: asOptionalString(args.cursor),
|
|
102
|
-
team_id: asOptionalString(args.team_id),
|
|
103
|
-
});
|
|
104
|
-
return { body: slackOk(result) };
|
|
105
|
-
});
|
|
106
|
-
session.get("/conversations.list", handleConversationsList);
|
|
107
|
-
session.post("/conversations.list", handleConversationsList);
|
|
108
|
-
const handleConversationsInfo = async (c) => handle(c, recorder, runId, "conversations.info", async () => {
|
|
109
|
-
const args = await readArgs(c);
|
|
110
|
-
const channel = asOptionalString(args.channel);
|
|
111
|
-
if (!channel)
|
|
112
|
-
throw new TwinError("channel_not_found", 400, "channel_not_found");
|
|
113
|
-
const result = domain.conversationsInfo({
|
|
114
|
-
channel,
|
|
115
|
-
include_num_members: asBool(args.include_num_members, false),
|
|
116
|
-
}, actorFrom(c));
|
|
117
|
-
return { body: slackOk(result) };
|
|
118
|
-
});
|
|
119
|
-
session.get("/conversations.info", handleConversationsInfo);
|
|
120
|
-
session.post("/conversations.info", handleConversationsInfo);
|
|
121
|
-
session.post("/conversations.create", async (c) => handle(c, recorder, runId, "conversations.create", async () => {
|
|
122
|
-
const args = await readArgs(c);
|
|
123
|
-
let delta = null;
|
|
124
|
-
const result = domain.conversationsCreate({
|
|
125
|
-
name: asString(args.name),
|
|
126
|
-
is_private: asBool(args.is_private, false),
|
|
127
|
-
team_id: asOptionalString(args.team_id),
|
|
128
|
-
}, actorFrom(c), (d) => {
|
|
129
|
-
delta = d;
|
|
130
|
-
});
|
|
131
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
132
|
-
}));
|
|
133
|
-
session.post("/conversations.archive", async (c) => handle(c, recorder, runId, "conversations.archive", async () => {
|
|
134
|
-
const args = await readArgs(c);
|
|
135
|
-
let delta = null;
|
|
136
|
-
const result = domain.conversationsArchive({ channel: asString(args.channel) }, actorFrom(c), (d) => {
|
|
137
|
-
delta = d;
|
|
138
|
-
});
|
|
139
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
140
|
-
}));
|
|
141
|
-
session.post("/conversations.invite", async (c) => handle(c, recorder, runId, "conversations.invite", async () => {
|
|
142
|
-
const args = await readArgs(c);
|
|
143
|
-
let delta = null;
|
|
144
|
-
const result = domain.conversationsInvite({ channel: asString(args.channel), users: asString(args.users) }, actorFrom(c), (d) => {
|
|
145
|
-
delta = d;
|
|
146
|
-
});
|
|
147
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
148
|
-
}));
|
|
149
|
-
session.post("/conversations.join", async (c) => handle(c, recorder, runId, "conversations.join", async () => {
|
|
150
|
-
const args = await readArgs(c);
|
|
151
|
-
let delta = null;
|
|
152
|
-
const result = domain.conversationsJoin({ channel: asString(args.channel) }, actorFrom(c), (d) => {
|
|
153
|
-
delta = d;
|
|
154
|
-
});
|
|
155
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
156
|
-
}));
|
|
157
|
-
session.post("/conversations.leave", async (c) => handle(c, recorder, runId, "conversations.leave", async () => {
|
|
158
|
-
const args = await readArgs(c);
|
|
159
|
-
let delta = null;
|
|
160
|
-
const result = domain.conversationsLeave({ channel: asString(args.channel) }, actorFrom(c), (d) => {
|
|
161
|
-
delta = d;
|
|
162
|
-
});
|
|
163
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
164
|
-
}));
|
|
165
|
-
session.post("/conversations.kick", async (c) => handle(c, recorder, runId, "conversations.kick", async () => {
|
|
166
|
-
const args = await readArgs(c);
|
|
167
|
-
let delta = null;
|
|
168
|
-
const result = domain.conversationsKick({ channel: asString(args.channel), user: asString(args.user) }, actorFrom(c), (d) => {
|
|
169
|
-
delta = d;
|
|
170
|
-
});
|
|
171
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
172
|
-
}));
|
|
173
|
-
const handleConversationsMembers = async (c) => handle(c, recorder, runId, "conversations.members", async () => {
|
|
174
|
-
const args = await readArgs(c);
|
|
175
|
-
const result = domain.conversationsMembers({
|
|
176
|
-
channel: asString(args.channel),
|
|
177
|
-
limit: args.limit !== undefined ? asNumber(args.limit, 100) : undefined,
|
|
178
|
-
cursor: asOptionalString(args.cursor),
|
|
179
|
-
}, actorFrom(c));
|
|
180
|
-
return { body: slackOk(result) };
|
|
181
|
-
});
|
|
182
|
-
session.get("/conversations.members", handleConversationsMembers);
|
|
183
|
-
session.post("/conversations.members", handleConversationsMembers);
|
|
184
|
-
const handleConversationsHistory = async (c) => handle(c, recorder, runId, "conversations.history", async () => {
|
|
185
|
-
const args = await readArgs(c);
|
|
186
|
-
const result = domain.conversationsHistory({
|
|
187
|
-
channel: asString(args.channel),
|
|
188
|
-
cursor: asOptionalString(args.cursor),
|
|
189
|
-
inclusive: asBool(args.inclusive, false),
|
|
190
|
-
latest: asOptionalString(args.latest),
|
|
191
|
-
limit: args.limit !== undefined ? asNumber(args.limit, 100) : undefined,
|
|
192
|
-
oldest: asOptionalString(args.oldest),
|
|
193
|
-
}, actorFrom(c));
|
|
194
|
-
return { body: slackOk(result) };
|
|
195
|
-
});
|
|
196
|
-
session.get("/conversations.history", handleConversationsHistory);
|
|
197
|
-
session.post("/conversations.history", handleConversationsHistory);
|
|
198
|
-
const handleConversationsReplies = async (c) => handle(c, recorder, runId, "conversations.replies", async () => {
|
|
199
|
-
const args = await readArgs(c);
|
|
200
|
-
const result = domain.conversationsReplies({
|
|
201
|
-
channel: asString(args.channel),
|
|
202
|
-
ts: asString(args.ts),
|
|
203
|
-
cursor: asOptionalString(args.cursor),
|
|
204
|
-
inclusive: asBool(args.inclusive, false),
|
|
205
|
-
latest: asOptionalString(args.latest),
|
|
206
|
-
limit: args.limit !== undefined ? asNumber(args.limit, 100) : undefined,
|
|
207
|
-
oldest: asOptionalString(args.oldest),
|
|
208
|
-
}, actorFrom(c));
|
|
209
|
-
return { body: slackOk(result) };
|
|
210
|
-
});
|
|
211
|
-
session.get("/conversations.replies", handleConversationsReplies);
|
|
212
|
-
session.post("/conversations.replies", handleConversationsReplies);
|
|
213
|
-
session.post("/conversations.open", async (c) => handle(c, recorder, runId, "conversations.open", async () => {
|
|
214
|
-
const args = await readArgs(c);
|
|
215
|
-
let delta = null;
|
|
216
|
-
const result = domain.conversationsOpen({
|
|
217
|
-
users: asOptionalString(args.users),
|
|
218
|
-
channel: asOptionalString(args.channel),
|
|
219
|
-
return_im: asBool(args.return_im, false),
|
|
220
|
-
}, actorFrom(c), (d) => {
|
|
221
|
-
delta = d;
|
|
222
|
-
});
|
|
223
|
-
return { body: slackOk(result), delta, mutation: !result.already_open };
|
|
224
|
-
}));
|
|
225
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
226
|
-
// Chat
|
|
227
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
228
|
-
session.post("/chat.postMessage", async (c) => handle(c, recorder, runId, "chat.postMessage", async () => {
|
|
229
|
-
const args = await readArgs(c);
|
|
230
|
-
let delta = null;
|
|
231
|
-
const result = domain.chatPostMessage({
|
|
232
|
-
channel: asString(args.channel),
|
|
233
|
-
text: asOptionalString(args.text),
|
|
234
|
-
blocks: asOptionalString(args.blocks),
|
|
235
|
-
attachments: asOptionalString(args.attachments),
|
|
236
|
-
thread_ts: asOptionalString(args.thread_ts),
|
|
237
|
-
reply_broadcast: asBool(args.reply_broadcast, false),
|
|
238
|
-
icon_emoji: asOptionalString(args.icon_emoji),
|
|
239
|
-
icon_url: asOptionalString(args.icon_url),
|
|
240
|
-
username: asOptionalString(args.username),
|
|
241
|
-
as_user: asBool(args.as_user, false),
|
|
242
|
-
}, actorFrom(c), (d) => {
|
|
243
|
-
delta = d;
|
|
244
|
-
});
|
|
245
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
246
|
-
}));
|
|
247
|
-
session.post("/chat.update", async (c) => handle(c, recorder, runId, "chat.update", async () => {
|
|
248
|
-
const args = await readArgs(c);
|
|
249
|
-
let delta = null;
|
|
250
|
-
const result = domain.chatUpdate({
|
|
251
|
-
channel: asString(args.channel),
|
|
252
|
-
ts: asString(args.ts),
|
|
253
|
-
text: asOptionalString(args.text),
|
|
254
|
-
blocks: asOptionalString(args.blocks),
|
|
255
|
-
attachments: asOptionalString(args.attachments),
|
|
256
|
-
}, actorFrom(c), (d) => {
|
|
257
|
-
delta = d;
|
|
258
|
-
});
|
|
259
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
260
|
-
}));
|
|
261
|
-
session.post("/chat.delete", async (c) => handle(c, recorder, runId, "chat.delete", async () => {
|
|
262
|
-
const args = await readArgs(c);
|
|
263
|
-
let delta = null;
|
|
264
|
-
const result = domain.chatDelete({ channel: asString(args.channel), ts: asString(args.ts) }, actorFrom(c), (d) => {
|
|
265
|
-
delta = d;
|
|
266
|
-
});
|
|
267
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
268
|
-
}));
|
|
269
|
-
session.post("/chat.scheduleMessage", async (c) => handle(c, recorder, runId, "chat.scheduleMessage", async () => {
|
|
270
|
-
const args = await readArgs(c);
|
|
271
|
-
let delta = null;
|
|
272
|
-
const result = domain.chatScheduleMessage({
|
|
273
|
-
channel: asString(args.channel),
|
|
274
|
-
text: asString(args.text),
|
|
275
|
-
post_at: asNumber(args.post_at, 0),
|
|
276
|
-
thread_ts: asOptionalString(args.thread_ts),
|
|
277
|
-
blocks: asOptionalString(args.blocks),
|
|
278
|
-
}, actorFrom(c), (d) => {
|
|
279
|
-
delta = d;
|
|
280
|
-
});
|
|
281
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
282
|
-
}));
|
|
283
|
-
session.post("/chat.deleteScheduledMessage", async (c) => handle(c, recorder, runId, "chat.deleteScheduledMessage", async () => {
|
|
284
|
-
const args = await readArgs(c);
|
|
285
|
-
let delta = null;
|
|
286
|
-
const result = domain.chatDeleteScheduledMessage({ channel: asString(args.channel), scheduled_message_id: asString(args.scheduled_message_id) }, actorFrom(c), (d) => {
|
|
287
|
-
delta = d;
|
|
288
|
-
});
|
|
289
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
290
|
-
}));
|
|
291
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
292
|
-
// Reactions
|
|
293
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
294
|
-
session.post("/reactions.add", async (c) => handle(c, recorder, runId, "reactions.add", async () => {
|
|
295
|
-
const args = await readArgs(c);
|
|
296
|
-
let delta = null;
|
|
297
|
-
const result = domain.reactionsAdd({
|
|
298
|
-
channel: asString(args.channel),
|
|
299
|
-
timestamp: asString(args.timestamp),
|
|
300
|
-
name: asString(args.name),
|
|
301
|
-
}, actorFrom(c), (d) => {
|
|
302
|
-
delta = d;
|
|
303
|
-
});
|
|
304
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
305
|
-
}));
|
|
306
|
-
session.post("/reactions.remove", async (c) => handle(c, recorder, runId, "reactions.remove", async () => {
|
|
307
|
-
const args = await readArgs(c);
|
|
308
|
-
let delta = null;
|
|
309
|
-
const result = domain.reactionsRemove({
|
|
310
|
-
channel: asString(args.channel),
|
|
311
|
-
timestamp: asString(args.timestamp),
|
|
312
|
-
name: asString(args.name),
|
|
313
|
-
}, actorFrom(c), (d) => {
|
|
314
|
-
delta = d;
|
|
315
|
-
});
|
|
316
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
317
|
-
}));
|
|
318
|
-
const handleReactionsGet = async (c) => handle(c, recorder, runId, "reactions.get", async () => {
|
|
319
|
-
const args = await readArgs(c);
|
|
320
|
-
const result = domain.reactionsGet({
|
|
321
|
-
channel: asString(args.channel),
|
|
322
|
-
timestamp: asString(args.timestamp),
|
|
323
|
-
full: asBool(args.full, false),
|
|
324
|
-
}, actorFrom(c));
|
|
325
|
-
return { body: slackOk(result) };
|
|
326
|
-
});
|
|
327
|
-
session.get("/reactions.get", handleReactionsGet);
|
|
328
|
-
session.post("/reactions.get", handleReactionsGet);
|
|
329
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
330
|
-
// Users
|
|
331
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
332
|
-
const handleUsersList = async (c) => handle(c, recorder, runId, "users.list", async () => {
|
|
333
|
-
const args = await readArgs(c);
|
|
334
|
-
const result = domain.usersList({
|
|
335
|
-
cursor: asOptionalString(args.cursor),
|
|
336
|
-
limit: args.limit !== undefined ? asNumber(args.limit, 100) : undefined,
|
|
337
|
-
include_locale: asBool(args.include_locale, false),
|
|
338
|
-
team_id: asOptionalString(args.team_id),
|
|
339
|
-
});
|
|
340
|
-
return { body: slackOk(result) };
|
|
341
|
-
});
|
|
342
|
-
session.get("/users.list", handleUsersList);
|
|
343
|
-
session.post("/users.list", handleUsersList);
|
|
344
|
-
const handleUsersInfo = async (c) => handle(c, recorder, runId, "users.info", async () => {
|
|
345
|
-
const args = await readArgs(c);
|
|
346
|
-
const result = domain.usersInfo({
|
|
347
|
-
user: asString(args.user),
|
|
348
|
-
include_locale: asBool(args.include_locale, false),
|
|
349
|
-
});
|
|
350
|
-
return { body: slackOk(result) };
|
|
351
|
-
});
|
|
352
|
-
session.get("/users.info", handleUsersInfo);
|
|
353
|
-
session.post("/users.info", handleUsersInfo);
|
|
354
|
-
const handleUsersLookupByEmail = async (c) => handle(c, recorder, runId, "users.lookupByEmail", async () => {
|
|
355
|
-
const args = await readArgs(c);
|
|
356
|
-
const result = domain.usersLookupByEmail({ email: asString(args.email) });
|
|
357
|
-
return { body: slackOk(result) };
|
|
358
|
-
});
|
|
359
|
-
session.get("/users.lookupByEmail", handleUsersLookupByEmail);
|
|
360
|
-
session.post("/users.lookupByEmail", handleUsersLookupByEmail);
|
|
361
|
-
const handleUsersProfileGet = async (c) => handle(c, recorder, runId, "users.profile.get", async () => {
|
|
362
|
-
const args = await readArgs(c);
|
|
363
|
-
const result = domain.usersProfileGet({
|
|
364
|
-
user: asOptionalString(args.user),
|
|
365
|
-
include_labels: asBool(args.include_labels, false),
|
|
366
|
-
}, actorFrom(c));
|
|
367
|
-
return { body: slackOk(result) };
|
|
368
|
-
});
|
|
369
|
-
session.get("/users.profile.get", handleUsersProfileGet);
|
|
370
|
-
session.post("/users.profile.get", handleUsersProfileGet);
|
|
371
|
-
session.post("/users.profile.set", async (c) => handle(c, recorder, runId, "users.profile.set", async () => {
|
|
372
|
-
const args = await readArgs(c);
|
|
373
|
-
let delta = null;
|
|
374
|
-
const result = domain.usersProfileSet({
|
|
375
|
-
user: asOptionalString(args.user),
|
|
376
|
-
profile: asOptionalString(args.profile),
|
|
377
|
-
name: asOptionalString(args.name),
|
|
378
|
-
value: asOptionalString(args.value),
|
|
379
|
-
}, actorFrom(c), (d) => {
|
|
380
|
-
delta = d;
|
|
381
|
-
});
|
|
382
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
383
|
-
}));
|
|
384
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
385
|
-
// Pins
|
|
386
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
387
|
-
session.post("/pins.add", async (c) => handle(c, recorder, runId, "pins.add", async () => {
|
|
388
|
-
const args = await readArgs(c);
|
|
389
|
-
let delta = null;
|
|
390
|
-
const result = domain.pinsAdd({ channel: asString(args.channel), timestamp: asString(args.timestamp) }, actorFrom(c), (d) => {
|
|
391
|
-
delta = d;
|
|
392
|
-
});
|
|
393
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
394
|
-
}));
|
|
395
|
-
session.post("/pins.remove", async (c) => handle(c, recorder, runId, "pins.remove", async () => {
|
|
396
|
-
const args = await readArgs(c);
|
|
397
|
-
let delta = null;
|
|
398
|
-
const result = domain.pinsRemove({ channel: asString(args.channel), timestamp: asString(args.timestamp) }, actorFrom(c), (d) => {
|
|
399
|
-
delta = d;
|
|
400
|
-
});
|
|
401
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
402
|
-
}));
|
|
403
|
-
const handlePinsList = async (c) => handle(c, recorder, runId, "pins.list", async () => {
|
|
404
|
-
const args = await readArgs(c);
|
|
405
|
-
const result = domain.pinsList({ channel: asString(args.channel) }, actorFrom(c));
|
|
406
|
-
return { body: slackOk(result) };
|
|
407
|
-
});
|
|
408
|
-
session.get("/pins.list", handlePinsList);
|
|
409
|
-
session.post("/pins.list", handlePinsList);
|
|
410
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
411
|
-
// Search
|
|
412
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
413
|
-
const handleSearchMessages = async (c) => handle(c, recorder, runId, "search.messages", async () => {
|
|
414
|
-
const args = await readArgs(c);
|
|
415
|
-
const result = domain.searchMessages({
|
|
416
|
-
query: asString(args.query),
|
|
417
|
-
count: args.count !== undefined ? asNumber(args.count, 20) : undefined,
|
|
418
|
-
page: args.page !== undefined ? asNumber(args.page, 1) : undefined,
|
|
419
|
-
sort: asOptionalString(args.sort),
|
|
420
|
-
sort_dir: asOptionalString(args.sort_dir),
|
|
421
|
-
highlight: asBool(args.highlight, false),
|
|
422
|
-
}, actorFrom(c));
|
|
423
|
-
return { body: slackOk(result) };
|
|
424
|
-
});
|
|
425
|
-
session.get("/search.messages", handleSearchMessages);
|
|
426
|
-
session.post("/search.messages", handleSearchMessages);
|
|
427
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
428
|
-
// Files (metadata-only)
|
|
429
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
430
|
-
session.post("/files.upload", async (c) => handle(c, recorder, runId, "files.upload", async () => {
|
|
431
|
-
const args = await readArgs(c);
|
|
432
|
-
let delta = null;
|
|
433
|
-
const result = domain.filesUpload({
|
|
434
|
-
channels: asOptionalString(args.channels),
|
|
435
|
-
channel: asOptionalString(args.channel),
|
|
436
|
-
filename: asOptionalString(args.filename),
|
|
437
|
-
title: asOptionalString(args.title),
|
|
438
|
-
filetype: asOptionalString(args.filetype),
|
|
439
|
-
content: asOptionalString(args.content),
|
|
440
|
-
initial_comment: asOptionalString(args.initial_comment),
|
|
441
|
-
thread_ts: asOptionalString(args.thread_ts),
|
|
442
|
-
}, actorFrom(c), (d) => {
|
|
443
|
-
delta = d;
|
|
444
|
-
});
|
|
445
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
446
|
-
}));
|
|
447
|
-
const handleFilesInfo = async (c) => handle(c, recorder, runId, "files.info", async () => {
|
|
448
|
-
const args = await readArgs(c);
|
|
449
|
-
const result = domain.filesInfo({ file: asString(args.file) });
|
|
450
|
-
return { body: slackOk(result) };
|
|
451
|
-
});
|
|
452
|
-
session.get("/files.info", handleFilesInfo);
|
|
453
|
-
session.post("/files.info", handleFilesInfo);
|
|
454
|
-
const handleFilesList = async (c) => handle(c, recorder, runId, "files.list", async () => {
|
|
455
|
-
const args = await readArgs(c);
|
|
456
|
-
const result = domain.filesList({
|
|
457
|
-
channel: asOptionalString(args.channel),
|
|
458
|
-
user: asOptionalString(args.user),
|
|
459
|
-
count: args.count !== undefined ? asNumber(args.count, 100) : undefined,
|
|
460
|
-
page: args.page !== undefined ? asNumber(args.page, 1) : undefined,
|
|
461
|
-
types: asOptionalString(args.types),
|
|
462
|
-
});
|
|
463
|
-
return { body: slackOk(result) };
|
|
464
|
-
});
|
|
465
|
-
session.get("/files.list", handleFilesList);
|
|
466
|
-
session.post("/files.list", handleFilesList);
|
|
467
|
-
session.post("/files.delete", async (c) => handle(c, recorder, runId, "files.delete", async () => {
|
|
468
|
-
const args = await readArgs(c);
|
|
469
|
-
let delta = null;
|
|
470
|
-
const result = domain.filesDelete({ file: asString(args.file) }, actorFrom(c), (d) => {
|
|
471
|
-
delta = d;
|
|
472
|
-
});
|
|
473
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
474
|
-
}));
|
|
475
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
476
|
-
// Bookmarks
|
|
477
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
478
|
-
session.post("/bookmarks.add", async (c) => handle(c, recorder, runId, "bookmarks.add", async () => {
|
|
479
|
-
const args = await readArgs(c);
|
|
480
|
-
let delta = null;
|
|
481
|
-
const result = domain.bookmarksAdd({
|
|
482
|
-
channel_id: asString(args.channel_id),
|
|
483
|
-
title: asString(args.title),
|
|
484
|
-
type: asOptionalString(args.type),
|
|
485
|
-
link: asOptionalString(args.link),
|
|
486
|
-
emoji: asOptionalString(args.emoji),
|
|
487
|
-
entity_id: asOptionalString(args.entity_id),
|
|
488
|
-
}, actorFrom(c), (d) => {
|
|
489
|
-
delta = d;
|
|
490
|
-
});
|
|
491
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
492
|
-
}));
|
|
493
|
-
session.post("/bookmarks.remove", async (c) => handle(c, recorder, runId, "bookmarks.remove", async () => {
|
|
494
|
-
const args = await readArgs(c);
|
|
495
|
-
let delta = null;
|
|
496
|
-
const result = domain.bookmarksRemove({ channel_id: asString(args.channel_id), bookmark_id: asString(args.bookmark_id) }, actorFrom(c), (d) => {
|
|
497
|
-
delta = d;
|
|
498
|
-
});
|
|
499
|
-
return { body: slackOk(result), delta, mutation: true };
|
|
500
|
-
}));
|
|
501
|
-
const handleBookmarksList = async (c) => handle(c, recorder, runId, "bookmarks.list", async () => {
|
|
502
|
-
const args = await readArgs(c);
|
|
503
|
-
const result = domain.bookmarksList({ channel_id: asString(args.channel_id) });
|
|
504
|
-
return { body: slackOk(result) };
|
|
505
|
-
});
|
|
506
|
-
session.get("/bookmarks.list", handleBookmarksList);
|
|
507
|
-
session.post("/bookmarks.list", handleBookmarksList);
|
|
508
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
509
|
-
// Team
|
|
510
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
511
|
-
const handleTeamInfo = async (c) => handle(c, recorder, runId, "team.info", async () => {
|
|
512
|
-
const args = await readArgs(c);
|
|
513
|
-
const result = domain.teamInfo({ team: asOptionalString(args.team) });
|
|
514
|
-
return { body: slackOk(result) };
|
|
515
|
-
});
|
|
516
|
-
session.get("/team.info", handleTeamInfo);
|
|
517
|
-
session.post("/team.info", handleTeamInfo);
|
|
518
|
-
// Catch-all 501. Twin-only fields (`fidelity`, `supported_surfaces`) live under
|
|
519
|
-
// the `_twin` namespace, matching twin-github / twin-stripe. Envelope defined
|
|
520
|
-
// once in ./unsupported-envelope.ts so the cross-twin namespace lint checks the
|
|
521
|
-
// shipped shape.
|
|
522
|
-
session.all("*", (c) => {
|
|
523
|
-
return c.json(unsupportedEnvelope.body, unsupportedEnvelope.status);
|
|
524
|
-
});
|
|
525
|
-
app.route("/s/:sid", session);
|
|
526
|
-
return app;
|
|
527
|
-
}
|
|
528
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
529
|
-
// Helpers
|
|
530
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
531
|
-
function actorFrom(c) {
|
|
532
|
-
const session = c.get("session");
|
|
533
|
-
return { login: session?.login };
|
|
534
|
-
}
|
|
535
|
-
async function readArgs(c) {
|
|
536
|
-
const method = c.req.method.toUpperCase();
|
|
537
|
-
if (method === "GET" || method === "HEAD") {
|
|
538
|
-
const query = c.req.query();
|
|
539
|
-
return { ...query };
|
|
540
|
-
}
|
|
541
|
-
// For POST/PUT — merge query and body so endpoints can accept either.
|
|
542
|
-
const body = await parseFormOrJson(c);
|
|
543
|
-
const query = c.req.query();
|
|
544
|
-
return { ...query, ...body };
|
|
545
|
-
}
|
|
546
|
-
function ensureOk(value) {
|
|
547
|
-
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
548
|
-
const obj = value;
|
|
549
|
-
if ("ok" in obj)
|
|
550
|
-
return obj;
|
|
551
|
-
return { ok: true, ...obj };
|
|
552
|
-
}
|
|
553
|
-
return { ok: true, result: value };
|
|
554
|
-
}
|
|
555
|
-
async function handle(c, recorder, runId, method, fn) {
|
|
556
|
-
const started = Date.now();
|
|
557
|
-
let status = 200;
|
|
558
|
-
let responseBody;
|
|
559
|
-
let stateDelta = null;
|
|
560
|
-
let mutation = false;
|
|
561
|
-
let errorString = null;
|
|
562
|
-
let outcomeResponse;
|
|
563
|
-
try {
|
|
564
|
-
const outcome = await fn();
|
|
565
|
-
responseBody = outcome.body;
|
|
566
|
-
stateDelta = outcome.delta ?? null;
|
|
567
|
-
mutation = Boolean(outcome.mutation && status < 400);
|
|
568
|
-
outcomeResponse = c.json(outcome.body);
|
|
569
|
-
}
|
|
570
|
-
catch (err) {
|
|
571
|
-
if (err instanceof TwinError) {
|
|
572
|
-
// Application-level Slack errors return HTTP 200 with {ok:false, error}.
|
|
573
|
-
// This matches real Slack and is required by every official SDK
|
|
574
|
-
// (@slack/web-api, @slack/bolt) — non-200 is treated as a transport
|
|
575
|
-
// failure, not a parseable response. Auth middleware errors keep their
|
|
576
|
-
// native 401 (handled in auth.ts, not here). Admin-gate restricted_action
|
|
577
|
-
// is a TwinError too — also keeps its native status because admin
|
|
578
|
-
// endpoints are twin-internal, not Slack API.
|
|
579
|
-
status = 200;
|
|
580
|
-
responseBody = { ok: false, error: err.code, ...(err.extra ?? {}) };
|
|
581
|
-
errorString = err.code;
|
|
582
|
-
outcomeResponse = c.json(responseBody, 200);
|
|
583
|
-
}
|
|
584
|
-
else if (err instanceof ZodError) {
|
|
585
|
-
// Slack returns 200 + {ok:false, error:"invalid_arguments", response_metadata.messages}
|
|
586
|
-
// for validation errors. Match that.
|
|
587
|
-
status = 200;
|
|
588
|
-
responseBody = {
|
|
589
|
-
ok: false,
|
|
590
|
-
error: "invalid_arguments",
|
|
591
|
-
response_metadata: {
|
|
592
|
-
messages: err.issues.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`),
|
|
593
|
-
},
|
|
594
|
-
};
|
|
595
|
-
errorString = "invalid_arguments";
|
|
596
|
-
outcomeResponse = c.json(responseBody, 200);
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
599
|
-
const mapped = twinErrorFromSqliteConstraint(method, err);
|
|
600
|
-
if (mapped) {
|
|
601
|
-
status = 200;
|
|
602
|
-
responseBody = { ok: false, error: mapped.code, ...(mapped.extra ?? {}) };
|
|
603
|
-
errorString = mapped.code;
|
|
604
|
-
outcomeResponse = c.json(responseBody, 200);
|
|
605
|
-
}
|
|
606
|
-
else {
|
|
607
|
-
// Genuine server bugs return 5xx so platform retries / alerting kick in.
|
|
608
|
-
status = 500;
|
|
609
|
-
const message = err instanceof Error ? err.message : "internal_error";
|
|
610
|
-
responseBody = { ok: false, error: "internal_error", warning: message };
|
|
611
|
-
errorString = message;
|
|
612
|
-
outcomeResponse = c.json(responseBody, 500);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
recordEvent(c, recorder, runId, method, {
|
|
617
|
-
started,
|
|
618
|
-
status,
|
|
619
|
-
body: responseBody,
|
|
620
|
-
delta: status < 400 && !errorString ? stateDelta : null,
|
|
621
|
-
mutation: status < 400 && !errorString && mutation,
|
|
622
|
-
error: errorString,
|
|
623
|
-
});
|
|
624
|
-
return outcomeResponse;
|
|
625
|
-
}
|
|
626
|
-
async function handleAdmin(c, recorder, runId, method, fn) {
|
|
627
|
-
const started = Date.now();
|
|
628
|
-
let status = 200;
|
|
629
|
-
let responseBody;
|
|
630
|
-
let stateDelta = null;
|
|
631
|
-
let errorString = null;
|
|
632
|
-
let outcomeResponse;
|
|
633
|
-
try {
|
|
634
|
-
const result = await fn();
|
|
635
|
-
responseBody = { ok: result.ok };
|
|
636
|
-
stateDelta = result.delta;
|
|
637
|
-
outcomeResponse = c.json({ ok: result.ok });
|
|
638
|
-
}
|
|
639
|
-
catch (err) {
|
|
640
|
-
status = 500;
|
|
641
|
-
const message = err instanceof Error ? err.message : "internal_error";
|
|
642
|
-
responseBody = { ok: false, error: "internal_error", warning: message };
|
|
643
|
-
errorString = message;
|
|
644
|
-
outcomeResponse = c.json(responseBody, 500);
|
|
645
|
-
}
|
|
646
|
-
recordEvent(c, recorder, runId, method, {
|
|
647
|
-
started,
|
|
648
|
-
status,
|
|
649
|
-
body: responseBody,
|
|
650
|
-
delta: stateDelta,
|
|
651
|
-
mutation: status < 400,
|
|
652
|
-
error: errorString,
|
|
653
|
-
});
|
|
654
|
-
return outcomeResponse;
|
|
655
|
-
}
|
|
656
|
-
function recordEvent(c, recorder, runId, method, fields) {
|
|
657
|
-
if (!recorder)
|
|
658
|
-
return;
|
|
659
|
-
const reqId = requestId();
|
|
660
|
-
recorder.record({
|
|
661
|
-
ts: nowIso(),
|
|
662
|
-
run_id: runId,
|
|
663
|
-
twin: "slack",
|
|
664
|
-
request_id: reqId,
|
|
665
|
-
correlation_id: reqId,
|
|
666
|
-
scenario_step_id: c.req.header("x-pome-scenario-step-id") ?? null,
|
|
667
|
-
step_id: null,
|
|
668
|
-
tool_call_id: null,
|
|
669
|
-
method: c.req.method,
|
|
670
|
-
path: new URL(c.req.url).pathname,
|
|
671
|
-
request_body: { route: method },
|
|
672
|
-
status: fields.status,
|
|
673
|
-
response_body: fields.body,
|
|
674
|
-
latency_ms: Date.now() - fields.started,
|
|
675
|
-
fidelity: "semantic",
|
|
676
|
-
state_mutation: fields.mutation,
|
|
677
|
-
state_delta: fields.delta,
|
|
678
|
-
error: fields.error,
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
function jsonSlackError(c, code, status) {
|
|
682
|
-
return c.json(slackError(code), status);
|
|
683
|
-
}
|