@orgsdk/cli 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +122 -0
- package/README.md +67 -2
- package/bin/configuration.mjs +60 -0
- package/bin/options.mjs +122 -0
- package/bin/orgsdk.mjs +97 -0
- package/bin/supervision.mjs +157 -0
- package/dist/runtime/LICENSE +122 -0
- package/dist/runtime/PROVENANCE.md +15 -0
- package/dist/runtime/README.md +112 -0
- package/dist/runtime/cli-options.js +41 -0
- package/dist/runtime/cli.js +81 -0
- package/dist/runtime/client.js +54 -0
- package/dist/runtime/contract.js +69 -0
- package/dist/runtime/embedded-plugin-loader.mjs +56 -0
- package/dist/runtime/engine/plugins/namespace.js +157 -0
- package/dist/runtime/engine/plugins/types.js +0 -0
- package/dist/runtime/engine/retry.js +67 -0
- package/dist/runtime/engine/sandbox/context.js +115 -0
- package/dist/runtime/engine/sandbox/cpu-budget.js +16 -0
- package/dist/runtime/engine/sandbox/executor.js +196 -0
- package/dist/runtime/engine/sandbox/function-proxy.js +177 -0
- package/dist/runtime/engine/sandbox/index.js +6 -0
- package/dist/runtime/engine/sandbox/secret-refs.js +116 -0
- package/dist/runtime/engine/sandbox/trace.js +65 -0
- package/dist/runtime/engine/sandbox/transpile.js +51 -0
- package/dist/runtime/engine/sandbox/types.js +0 -0
- package/dist/runtime/engine/sandbox/validate.js +63 -0
- package/dist/runtime/engine/sandbox/webhook-handler.js +69 -0
- package/dist/runtime/engine/shared.js +14 -0
- package/dist/runtime/executor-configuration.js +44 -0
- package/dist/runtime/generated/schema.d.ts +6443 -0
- package/dist/runtime/isolated-actions.js +189 -0
- package/dist/runtime/isolated-worker.js +227 -0
- package/dist/runtime/package-dependencies.js +144 -0
- package/dist/runtime/package-plugin.js +151 -0
- package/dist/runtime/plugin-module.js +22 -0
- package/dist/runtime/plugin-store.js +159 -0
- package/dist/runtime/plugins.js +124 -0
- package/dist/runtime/process-runtime.js +72 -0
- package/dist/runtime/project-data.js +97 -0
- package/dist/runtime/project-files.js +259 -0
- package/dist/runtime/runner.js +233 -0
- package/dist/runtime/sdk-declarations.js +197 -0
- package/dist/runtime/sessions/cell-request.js +79 -0
- package/dist/runtime/sessions/compiler/analysis.js +86 -0
- package/dist/runtime/sessions/compiler/binding-pattern.js +35 -0
- package/dist/runtime/sessions/compiler/bindings.js +60 -0
- package/dist/runtime/sessions/compiler/emit.js +111 -0
- package/dist/runtime/sessions/compiler/references.js +62 -0
- package/dist/runtime/sessions/compiler/source-policy.js +62 -0
- package/dist/runtime/sessions/compiler.js +34 -0
- package/dist/runtime/sessions/configuration.js +68 -0
- package/dist/runtime/sessions/events.js +72 -0
- package/dist/runtime/sessions/execute-cell.js +80 -0
- package/dist/runtime/sessions/function-broker.js +78 -0
- package/dist/runtime/sessions/index.js +9 -0
- package/dist/runtime/sessions/journal.js +86 -0
- package/dist/runtime/sessions/kernel.js +142 -0
- package/dist/runtime/sessions/manager.js +153 -0
- package/dist/runtime/sessions/process.js +209 -0
- package/dist/runtime/sessions/records.js +61 -0
- package/dist/runtime/sessions/redaction.js +33 -0
- package/dist/runtime/sessions/scope.js +46 -0
- package/dist/runtime/sessions/session-runtime.js +151 -0
- package/dist/runtime/sessions/types.js +12 -0
- package/dist/runtime/sessions/values.js +40 -0
- package/dist/runtime/sessions/worker.js +81 -0
- package/dist/runtime/supervisor.js +268 -0
- package/dist/runtime/validate-code.js +114 -0
- package/dist/runtime/worker.js +54 -0
- package/dist/server/bun-driver-JKOGHIVX.js +20 -0
- package/dist/server/chunk-WCVBLUNL.js +685 -0
- package/dist/server/index.js +8432 -0
- package/dist/server/migrations/0000_initial.sql +436 -0
- package/dist/server/migrations/0001_queue_indexes.sql +3 -0
- package/dist/server/migrations/0002_trpc_transport.sql +1 -0
- package/dist/server/migrations/meta/0000_snapshot.json +3233 -0
- package/dist/server/migrations/meta/0001_snapshot.json +3260 -0
- package/dist/server/migrations/meta/0002_snapshot.json +3262 -0
- package/dist/server/migrations/meta/_journal.json +27 -0
- package/dist/server/node-driver-FRDSYDBU.js +25 -0
- package/dist/server/out/192.png +0 -0
- package/dist/server/out/404/index.html +1 -0
- package/dist/server/out/404.html +1 -0
- package/dist/server/out/512.png +0 -0
- package/dist/server/out/LICENSE.txt +122 -0
- package/dist/server/out/THIRD_PARTY_NOTICES.md +13 -0
- package/dist/server/out/__next.!KHdvcmtzcGFjZSk.__PAGE__.txt +35 -0
- package/dist/server/out/__next._full.txt +29 -0
- package/dist/server/out/__next._tree.txt +4 -0
- package/dist/server/out/_next/static/F49bfPs3jKhcIuc95hqZh/_buildManifest.js +11 -0
- package/dist/server/out/_next/static/F49bfPs3jKhcIuc95hqZh/_clientMiddlewareManifest.js +1 -0
- package/dist/server/out/_next/static/F49bfPs3jKhcIuc95hqZh/_ssgManifest.js +1 -0
- package/dist/server/out/_next/static/chunks/016glzdsa3q5_.js +1 -0
- package/dist/server/out/_next/static/chunks/05i1qq0mw887k.js +1 -0
- package/dist/server/out/_next/static/chunks/06tt8wiyre1ez.js +1 -0
- package/dist/server/out/_next/static/chunks/0cm9i2msjsy--.js +1 -0
- package/dist/server/out/_next/static/chunks/0cz1d0mv5g_q7.js +1 -0
- package/dist/server/out/_next/static/chunks/0hq5dvj7fy64b.js +1 -0
- package/dist/server/out/_next/static/chunks/0ma4vl-fj0tmu.js +1 -0
- package/dist/server/out/_next/static/chunks/0noal-jqjivtf.js +1 -0
- package/dist/server/out/_next/static/chunks/0spckmsiek0gd.js +1 -0
- package/dist/server/out/_next/static/chunks/103sekujf0rxr.js +1 -0
- package/dist/server/out/_next/static/chunks/10h8kpcnjfe_v.js +1 -0
- package/dist/server/out/_next/static/chunks/16_aurf9162_6.js +1 -0
- package/dist/server/out/_next/static/chunks/1c48yx15nlt6w.js +1 -0
- package/dist/server/out/_next/static/chunks/1jp827_2p_wkf.js +1 -0
- package/dist/server/out/_next/static/chunks/1kdk-viqnjs3j.js +1 -0
- package/dist/server/out/_next/static/chunks/1mlfee105fhl7.js +1 -0
- package/dist/server/out/_next/static/chunks/1q9jpzm9b6zy9.js +1 -0
- package/dist/server/out/_next/static/chunks/1v0-a7pehktp9.js +22 -0
- package/dist/server/out/_next/static/chunks/24qxhh2dqvhaa.js +1 -0
- package/dist/server/out/_next/static/chunks/253gnn8ai3i89.js +1 -0
- package/dist/server/out/_next/static/chunks/27umf0z4povug.js +1 -0
- package/dist/server/out/_next/static/chunks/280w168xxgtwt.js +402 -0
- package/dist/server/out/_next/static/chunks/2a_c2xcjy62fq.css +1 -0
- package/dist/server/out/_next/static/chunks/2bbfbmv0vf3j0.js +1 -0
- package/dist/server/out/_next/static/chunks/2mvlvogrl6o0u.js +1 -0
- package/dist/server/out/_next/static/chunks/2xzrcwr9q6195.js +1 -0
- package/dist/server/out/_next/static/chunks/2yi6lq56xoijl.js +31 -0
- package/dist/server/out/_next/static/chunks/30g0jo299pr8e.js +1 -0
- package/dist/server/out/_next/static/chunks/36tf56rgybjz0.js +3 -0
- package/dist/server/out/_next/static/chunks/39dofrhzg_uju.js +1 -0
- package/dist/server/out/_next/static/chunks/3a8aanmz3kfof.js +1 -0
- package/dist/server/out/_next/static/chunks/3bd3k15tx3lj1.js +1 -0
- package/dist/server/out/_next/static/chunks/3d34pxerfr389.js +1 -0
- package/dist/server/out/_next/static/chunks/3dx108d0g6032.js +55 -0
- package/dist/server/out/_next/static/chunks/3elab9vgx7_ok.js +1 -0
- package/dist/server/out/_next/static/chunks/3gvae9c-5pi5z.js +1 -0
- package/dist/server/out/_next/static/chunks/3hzia782sc9pf.js +1 -0
- package/dist/server/out/_next/static/chunks/3jl4k-15i8847.js +1 -0
- package/dist/server/out/_next/static/chunks/3lb23el6qno6s.js +1 -0
- package/dist/server/out/_next/static/chunks/3prum3lr5470i.js +3 -0
- package/dist/server/out/_next/static/chunks/3prwkrciuqwjg.js +1 -0
- package/dist/server/out/_next/static/chunks/3txmqtuo5xgfd.js +3 -0
- package/dist/server/out/_next/static/chunks/3u7q5w03st-rs.js +1 -0
- package/dist/server/out/_next/static/chunks/turbopack-3-ry682tkyiqk.js +1 -0
- package/dist/server/out/_not-found/__next._full.txt +21 -0
- package/dist/server/out/_not-found/__next._not-found.__PAGE__.txt +27 -0
- package/dist/server/out/_not-found/__next._tree.txt +4 -0
- package/dist/server/out/_not-found/index.html +1 -0
- package/dist/server/out/_not-found/index.txt +21 -0
- package/dist/server/out/accounts/2fa/__next._full.txt +26 -0
- package/dist/server/out/accounts/2fa/__next._tree.txt +5 -0
- package/dist/server/out/accounts/2fa/__next.accounts.2fa.__PAGE__.txt +33 -0
- package/dist/server/out/accounts/2fa/index.html +1 -0
- package/dist/server/out/accounts/2fa/index.txt +26 -0
- package/dist/server/out/accounts/email/__next._full.txt +26 -0
- package/dist/server/out/accounts/email/__next._tree.txt +5 -0
- package/dist/server/out/accounts/email/__next.accounts.email.__PAGE__.txt +33 -0
- package/dist/server/out/accounts/email/index.html +1 -0
- package/dist/server/out/accounts/email/index.txt +26 -0
- package/dist/server/out/accounts/login/__next._full.txt +26 -0
- package/dist/server/out/accounts/login/__next._tree.txt +5 -0
- package/dist/server/out/accounts/login/__next.accounts.login.__PAGE__.txt +33 -0
- package/dist/server/out/accounts/login/index.html +1 -0
- package/dist/server/out/accounts/login/index.txt +26 -0
- package/dist/server/out/accounts/logout/__next._full.txt +26 -0
- package/dist/server/out/accounts/logout/__next._tree.txt +5 -0
- package/dist/server/out/accounts/logout/__next.accounts.logout.__PAGE__.txt +33 -0
- package/dist/server/out/accounts/logout/index.html +1 -0
- package/dist/server/out/accounts/logout/index.txt +26 -0
- package/dist/server/out/accounts/password/change/__next._full.txt +27 -0
- package/dist/server/out/accounts/password/change/__next._tree.txt +6 -0
- package/dist/server/out/accounts/password/change/__next.accounts.password.change.__PAGE__.txt +35 -0
- package/dist/server/out/accounts/password/change/index.html +1 -0
- package/dist/server/out/accounts/password/change/index.txt +27 -0
- package/dist/server/out/accounts/password/reset/__next._full.txt +25 -0
- package/dist/server/out/accounts/password/reset/__next._tree.txt +6 -0
- package/dist/server/out/accounts/password/reset/__next.accounts.password.reset.__PAGE__.txt +33 -0
- package/dist/server/out/accounts/password/reset/index.html +1 -0
- package/dist/server/out/accounts/password/reset/index.txt +25 -0
- package/dist/server/out/accounts/signup/__next._full.txt +26 -0
- package/dist/server/out/accounts/signup/__next._tree.txt +5 -0
- package/dist/server/out/accounts/signup/__next.accounts.signup.__PAGE__.txt +33 -0
- package/dist/server/out/accounts/signup/index.html +1 -0
- package/dist/server/out/accounts/signup/index.txt +26 -0
- package/dist/server/out/actions/__next.!KHdvcmtzcGFjZSk.actions.__PAGE__.txt +44 -0
- package/dist/server/out/actions/__next._full.txt +37 -0
- package/dist/server/out/actions/__next._tree.txt +5 -0
- package/dist/server/out/actions/index.html +1 -0
- package/dist/server/out/actions/index.txt +37 -0
- package/dist/server/out/agents/__next.!KHdvcmtzcGFjZSk.agents.__PAGE__.txt +39 -0
- package/dist/server/out/agents/__next._full.txt +32 -0
- package/dist/server/out/agents/__next._tree.txt +5 -0
- package/dist/server/out/agents/index.html +1 -0
- package/dist/server/out/agents/index.txt +32 -0
- package/dist/server/out/app-icon.svg +7 -0
- package/dist/server/out/apple-touch-icon.png +0 -0
- package/dist/server/out/approvals/__next.!KHdvcmtzcGFjZSk.approvals.__PAGE__.txt +39 -0
- package/dist/server/out/approvals/__next._full.txt +32 -0
- package/dist/server/out/approvals/__next._tree.txt +5 -0
- package/dist/server/out/approvals/index.html +1 -0
- package/dist/server/out/approvals/index.txt +32 -0
- package/dist/server/out/artifacts/__next.!KHdvcmtzcGFjZSk.artifacts.__PAGE__.txt +41 -0
- package/dist/server/out/artifacts/__next._full.txt +34 -0
- package/dist/server/out/artifacts/__next._tree.txt +5 -0
- package/dist/server/out/artifacts/index.html +1 -0
- package/dist/server/out/artifacts/index.txt +34 -0
- package/dist/server/out/audit/__next.!KHdvcmtzcGFjZSk.audit.__PAGE__.txt +36 -0
- package/dist/server/out/audit/__next._full.txt +29 -0
- package/dist/server/out/audit/__next._tree.txt +5 -0
- package/dist/server/out/audit/index.html +1 -0
- package/dist/server/out/audit/index.txt +29 -0
- package/dist/server/out/brand/logo/README.md +92 -0
- package/dist/server/out/brand/logo/app-icon.svg +7 -0
- package/dist/server/out/brand/logo/favicon.svg +8 -0
- package/dist/server/out/brand/logo/fonts/Inter-Bold.ttf +0 -0
- package/dist/server/out/brand/logo/fonts/Inter-Regular.ttf +0 -0
- package/dist/server/out/brand/logo/lockup-dark.svg +11 -0
- package/dist/server/out/brand/logo/lockup-integrated.svg +14 -0
- package/dist/server/out/brand/logo/lockup-light.svg +11 -0
- package/dist/server/out/brand/logo/og-image.svg +20 -0
- package/dist/server/out/brand/logo/primary-solid.svg +6 -0
- package/dist/server/out/brand/logo/primary.svg +7 -0
- package/dist/server/out/brand/logo/raster/banner-1500x500.png +0 -0
- package/dist/server/out/brand/logo/raster/profile-1024.png +0 -0
- package/dist/server/out/brand/logo/raster/profile-512.png +0 -0
- package/dist/server/out/brand/logo/raster/square-1080.png +0 -0
- package/dist/server/out/brand/tokens.md +74 -0
- package/dist/server/out/chat/__next.!KHdvcmtzcGFjZSk.chat.__PAGE__.txt +35 -0
- package/dist/server/out/chat/__next._full.txt +28 -0
- package/dist/server/out/chat/__next._tree.txt +5 -0
- package/dist/server/out/chat/index.html +1 -0
- package/dist/server/out/chat/index.txt +28 -0
- package/dist/server/out/connections/__next.!KHdvcmtzcGFjZSk.connections.__PAGE__.txt +39 -0
- package/dist/server/out/connections/__next._full.txt +32 -0
- package/dist/server/out/connections/__next._tree.txt +5 -0
- package/dist/server/out/connections/index.html +1 -0
- package/dist/server/out/connections/index.txt +32 -0
- package/dist/server/out/credentials/__next.!KHdvcmtzcGFjZSk.credentials.__PAGE__.txt +40 -0
- package/dist/server/out/credentials/__next._full.txt +33 -0
- package/dist/server/out/credentials/__next._tree.txt +5 -0
- package/dist/server/out/credentials/index.html +1 -0
- package/dist/server/out/credentials/index.txt +33 -0
- package/dist/server/out/documents/__next.!KHdvcmtzcGFjZSk.documents.__PAGE__.txt +39 -0
- package/dist/server/out/documents/__next._full.txt +32 -0
- package/dist/server/out/documents/__next._tree.txt +5 -0
- package/dist/server/out/documents/index.html +1 -0
- package/dist/server/out/documents/index.txt +32 -0
- package/dist/server/out/favicon.ico +0 -0
- package/dist/server/out/favicon.svg +8 -0
- package/dist/server/out/index.html +1 -0
- package/dist/server/out/index.txt +29 -0
- package/dist/server/out/logo.svg +12 -0
- package/dist/server/out/monaco/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/dist/server/out/monaco/vs/base/worker/workerMain.js +31 -0
- package/dist/server/out/monaco/vs/basic-languages/abap/abap.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/apex/apex.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/azcli/azcli.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/bat/bat.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/bicep/bicep.js +11 -0
- package/dist/server/out/monaco/vs/basic-languages/cameligo/cameligo.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/clojure/clojure.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/coffee/coffee.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/cpp/cpp.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/csharp/csharp.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/csp/csp.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/css/css.js +12 -0
- package/dist/server/out/monaco/vs/basic-languages/cypher/cypher.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/dart/dart.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/dockerfile/dockerfile.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/ecl/ecl.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/elixir/elixir.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/flow9/flow9.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/freemarker2/freemarker2.js +12 -0
- package/dist/server/out/monaco/vs/basic-languages/fsharp/fsharp.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/go/go.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/graphql/graphql.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/handlebars/handlebars.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/hcl/hcl.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/html/html.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/ini/ini.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/java/java.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/javascript/javascript.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/julia/julia.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/kotlin/kotlin.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/less/less.js +11 -0
- package/dist/server/out/monaco/vs/basic-languages/lexon/lexon.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/liquid/liquid.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/lua/lua.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/m3/m3.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/markdown/markdown.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/mdx/mdx.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/mips/mips.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/msdax/msdax.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/mysql/mysql.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/objective-c/objective-c.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/pascal/pascal.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/pascaligo/pascaligo.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/perl/perl.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/pgsql/pgsql.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/php/php.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/pla/pla.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/postiats/postiats.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/powerquery/powerquery.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/powershell/powershell.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/protobuf/protobuf.js +11 -0
- package/dist/server/out/monaco/vs/basic-languages/pug/pug.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/python/python.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/qsharp/qsharp.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/r/r.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/razor/razor.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/redis/redis.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/redshift/redshift.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/restructuredtext/restructuredtext.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/ruby/ruby.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/rust/rust.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/sb/sb.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/scala/scala.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/scheme/scheme.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/scss/scss.js +12 -0
- package/dist/server/out/monaco/vs/basic-languages/shell/shell.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/solidity/solidity.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/sophia/sophia.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/sparql/sparql.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/sql/sql.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/st/st.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/swift/swift.js +13 -0
- package/dist/server/out/monaco/vs/basic-languages/systemverilog/systemverilog.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/tcl/tcl.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/twig/twig.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/typescript/typescript.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/typespec/typespec.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/vb/vb.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/wgsl/wgsl.js +307 -0
- package/dist/server/out/monaco/vs/basic-languages/xml/xml.js +10 -0
- package/dist/server/out/monaco/vs/basic-languages/yaml/yaml.js +10 -0
- package/dist/server/out/monaco/vs/editor/editor.main.css +8 -0
- package/dist/server/out/monaco/vs/editor/editor.main.js +798 -0
- package/dist/server/out/monaco/vs/language/css/cssMode.js +13 -0
- package/dist/server/out/monaco/vs/language/css/cssWorker.js +77 -0
- package/dist/server/out/monaco/vs/language/html/htmlMode.js +13 -0
- package/dist/server/out/monaco/vs/language/html/htmlWorker.js +454 -0
- package/dist/server/out/monaco/vs/language/json/jsonMode.js +19 -0
- package/dist/server/out/monaco/vs/language/json/jsonWorker.js +42 -0
- package/dist/server/out/monaco/vs/language/typescript/tsMode.js +20 -0
- package/dist/server/out/monaco/vs/language/typescript/tsWorker.js +51328 -0
- package/dist/server/out/monaco/vs/loader.js +11 -0
- package/dist/server/out/monaco/vs/nls.messages.de.js +21 -0
- package/dist/server/out/monaco/vs/nls.messages.es.js +21 -0
- package/dist/server/out/monaco/vs/nls.messages.fr.js +19 -0
- package/dist/server/out/monaco/vs/nls.messages.it.js +19 -0
- package/dist/server/out/monaco/vs/nls.messages.ja.js +21 -0
- package/dist/server/out/monaco/vs/nls.messages.ko.js +19 -0
- package/dist/server/out/monaco/vs/nls.messages.ru.js +21 -0
- package/dist/server/out/monaco/vs/nls.messages.zh-cn.js +21 -0
- package/dist/server/out/monaco/vs/nls.messages.zh-tw.js +19 -0
- package/dist/server/out/og-image.png +0 -0
- package/dist/server/out/people/__next.!KHdvcmtzcGFjZSk.people.__PAGE__.txt +39 -0
- package/dist/server/out/people/__next._full.txt +32 -0
- package/dist/server/out/people/__next._tree.txt +5 -0
- package/dist/server/out/people/index.html +1 -0
- package/dist/server/out/people/index.txt +32 -0
- package/dist/server/out/plugins/__next.!KHdvcmtzcGFjZSk.plugins.__PAGE__.txt +42 -0
- package/dist/server/out/plugins/__next._full.txt +35 -0
- package/dist/server/out/plugins/__next._tree.txt +5 -0
- package/dist/server/out/plugins/index.html +1 -0
- package/dist/server/out/plugins/index.txt +35 -0
- package/dist/server/out/projects/__next.!KHdvcmtzcGFjZSk.projects.__PAGE__.txt +39 -0
- package/dist/server/out/projects/__next._full.txt +32 -0
- package/dist/server/out/projects/__next._tree.txt +5 -0
- package/dist/server/out/projects/index.html +1 -0
- package/dist/server/out/projects/index.txt +32 -0
- package/dist/server/out/runs/__next.!KHdvcmtzcGFjZSk.runs.__PAGE__.txt +41 -0
- package/dist/server/out/runs/__next._full.txt +34 -0
- package/dist/server/out/runs/__next._tree.txt +5 -0
- package/dist/server/out/runs/index.html +1 -0
- package/dist/server/out/runs/index.txt +34 -0
- package/dist/server/out/schedules/__next.!KHdvcmtzcGFjZSk.schedules.__PAGE__.txt +41 -0
- package/dist/server/out/schedules/__next._full.txt +34 -0
- package/dist/server/out/schedules/__next._tree.txt +5 -0
- package/dist/server/out/schedules/index.html +1 -0
- package/dist/server/out/schedules/index.txt +34 -0
- package/dist/server/out/settings/__next.!KHdvcmtzcGFjZSk.settings.__PAGE__.txt +39 -0
- package/dist/server/out/settings/__next._full.txt +32 -0
- package/dist/server/out/settings/__next._tree.txt +5 -0
- package/dist/server/out/settings/index.html +1 -0
- package/dist/server/out/settings/index.txt +32 -0
- package/dist/server/out/setup/__next._full.txt +28 -0
- package/dist/server/out/setup/__next._tree.txt +4 -0
- package/dist/server/out/setup/__next.setup.__PAGE__.txt +34 -0
- package/dist/server/out/setup/index.html +1 -0
- package/dist/server/out/setup/index.txt +28 -0
- package/dist/server/out/tables/__next.!KHdvcmtzcGFjZSk.tables.__PAGE__.txt +36 -0
- package/dist/server/out/tables/__next._full.txt +29 -0
- package/dist/server/out/tables/__next._tree.txt +5 -0
- package/dist/server/out/tables/index.html +1 -0
- package/dist/server/out/tables/index.txt +29 -0
- package/dist/server/out/third-party-licenses/monaco-editor.txt +21 -0
- package/dist/server/out/third-party-licenses/zod.txt +21 -0
- package/dist/server/out/webhooks/__next.!KHdvcmtzcGFjZSk.webhooks.__PAGE__.txt +39 -0
- package/dist/server/out/webhooks/__next._full.txt +32 -0
- package/dist/server/out/webhooks/__next._tree.txt +5 -0
- package/dist/server/out/webhooks/index.html +1 -0
- package/dist/server/out/webhooks/index.txt +32 -0
- package/dist/server/out/workspaces/invite/__next._full.txt +29 -0
- package/dist/server/out/workspaces/invite/__next._tree.txt +5 -0
- package/dist/server/out/workspaces/invite/__next.workspaces.invite.__PAGE__.txt +36 -0
- package/dist/server/out/workspaces/invite/index.html +1 -0
- package/dist/server/out/workspaces/invite/index.txt +29 -0
- package/docs/npm-distribution.md +76 -0
- package/package.json +79 -4
- package/runtime/LICENSE +122 -0
- package/runtime/README.md +112 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// src/sessions/cell-request.ts
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { canonicalJson, jsonValue, MAX_VALUE_BYTES } from "./values.js";
|
|
5
|
+
import { isTerminal } from "./records.js";
|
|
6
|
+
import {
|
|
7
|
+
SessionError
|
|
8
|
+
} from "./types.js";
|
|
9
|
+
function prepareCell(request) {
|
|
10
|
+
if (!z.uuid().safeParse(request.id).success || typeof request.source !== "string" || !request.source.trim() || !request.source.isWellFormed() || request.source.includes("\0") || Buffer.byteLength(request.source) > MAX_VALUE_BYTES)
|
|
11
|
+
throw new SessionError(
|
|
12
|
+
"invalid_cell",
|
|
13
|
+
"Cell requires a UUID and valid nonempty source of at most 200000 UTF-8 bytes"
|
|
14
|
+
);
|
|
15
|
+
const inputs = z.record(z.string(), z.unknown()).parse(jsonValue(request.inputs ?? {}));
|
|
16
|
+
return {
|
|
17
|
+
...request,
|
|
18
|
+
inputs,
|
|
19
|
+
digest: createHash("sha256").update(canonicalJson({ source: request.source, inputs })).digest("hex"),
|
|
20
|
+
sourceDigest: createHash("sha256").update(request.source).digest("hex")
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function existingCell(history, request) {
|
|
24
|
+
const previous = history.cells.find((cell) => cell.id === request.id);
|
|
25
|
+
if (previous && (previous.digest !== request.digest || request.expectedSequence !== previous.sequence - 1))
|
|
26
|
+
throw new SessionError(
|
|
27
|
+
"cell_conflict",
|
|
28
|
+
"Cell ID was already used with a different payload"
|
|
29
|
+
);
|
|
30
|
+
return previous;
|
|
31
|
+
}
|
|
32
|
+
function validateAppend(history, hasWorker, request, limits) {
|
|
33
|
+
if (isTerminal(history.status) || !hasWorker)
|
|
34
|
+
throw new SessionError(
|
|
35
|
+
"session_unavailable",
|
|
36
|
+
`Session is ${history.status}; live memory cannot be resumed`
|
|
37
|
+
);
|
|
38
|
+
if (request.expectedSequence !== history.cells.length)
|
|
39
|
+
throw new SessionError(
|
|
40
|
+
"stale_sequence",
|
|
41
|
+
"Cell sequence changed; inspect before appending"
|
|
42
|
+
);
|
|
43
|
+
const sourceBytes = history.cells.reduce(
|
|
44
|
+
(bytes, cell) => bytes + Buffer.byteLength(cell.source),
|
|
45
|
+
0
|
|
46
|
+
) + Buffer.byteLength(request.source);
|
|
47
|
+
if (history.cells.length >= limits.maxCells || sourceBytes > 2e6)
|
|
48
|
+
throw new SessionError(
|
|
49
|
+
"history_limit",
|
|
50
|
+
"Session source history limit reached"
|
|
51
|
+
);
|
|
52
|
+
const timeoutMs = request.timeoutMs ?? limits.cellTimeoutMs;
|
|
53
|
+
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > limits.cellTimeoutMs)
|
|
54
|
+
throw new SessionError(
|
|
55
|
+
"invalid_timeout",
|
|
56
|
+
"Cell timeout must be within the configured deadline"
|
|
57
|
+
);
|
|
58
|
+
return timeoutMs;
|
|
59
|
+
}
|
|
60
|
+
function newCell(history, request) {
|
|
61
|
+
return {
|
|
62
|
+
id: request.id,
|
|
63
|
+
sequence: history.cells.length + 1,
|
|
64
|
+
generation: history.generation,
|
|
65
|
+
source: request.source,
|
|
66
|
+
sourceDigest: request.sourceDigest,
|
|
67
|
+
digest: request.digest,
|
|
68
|
+
inputs: request.inputs,
|
|
69
|
+
status: "running",
|
|
70
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
71
|
+
startCursor: history.cursor
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
existingCell,
|
|
76
|
+
newCell,
|
|
77
|
+
prepareCell,
|
|
78
|
+
validateAppend
|
|
79
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// src/sessions/compiler/analysis.ts
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
var sourcePath = join(
|
|
6
|
+
fileURLToPath(new URL(".", import.meta.url)),
|
|
7
|
+
"__session_source__.ts"
|
|
8
|
+
);
|
|
9
|
+
var globalsPath = join(
|
|
10
|
+
fileURLToPath(new URL(".", import.meta.url)),
|
|
11
|
+
"__session_globals__.d.ts"
|
|
12
|
+
);
|
|
13
|
+
var prefix = "async function __orgsdk_cells__() {\n";
|
|
14
|
+
function globalDeclarations(functions) {
|
|
15
|
+
const namespaces = /* @__PURE__ */ new Set();
|
|
16
|
+
const declarations = [
|
|
17
|
+
"declare const actionParams: Record<string, any>;",
|
|
18
|
+
"declare const console: { log(...values: any[]): void; info(...values: any[]): void; warn(...values: any[]): void; error(...values: any[]): void; debug(...values: any[]): void };",
|
|
19
|
+
"declare const z: any; declare function defineParams(schema: any): any;"
|
|
20
|
+
];
|
|
21
|
+
for (const name of functions) {
|
|
22
|
+
if (name.includes(".")) namespaces.add(name.split(".")[0]);
|
|
23
|
+
else declarations.push(`declare function ${name}(...args: any[]): any;`);
|
|
24
|
+
}
|
|
25
|
+
for (const name of namespaces)
|
|
26
|
+
declarations.push(
|
|
27
|
+
`declare const ${name}: Record<string, (...args: any[]) => any>;`
|
|
28
|
+
);
|
|
29
|
+
return declarations.join("\n");
|
|
30
|
+
}
|
|
31
|
+
function diagnosticPosition(error, source, start) {
|
|
32
|
+
const offset = Math.max(
|
|
33
|
+
0,
|
|
34
|
+
Math.min(source.length, (error.start ?? start) - start)
|
|
35
|
+
);
|
|
36
|
+
const lines = source.slice(0, offset).split("\n");
|
|
37
|
+
return {
|
|
38
|
+
line: lines.length,
|
|
39
|
+
column: lines.at(-1).length + 1,
|
|
40
|
+
code: error.code,
|
|
41
|
+
message: ts.flattenDiagnosticMessageText(error.messageText, "\n").slice(0, 2e3)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function analyzeCell(history, source, functions) {
|
|
45
|
+
const earlier = history.length ? history.join("\n;\n") + "\n;\n" : "";
|
|
46
|
+
const start = prefix.length + earlier.length;
|
|
47
|
+
const wrapped = prefix + earlier + source + "\n}";
|
|
48
|
+
const options = {
|
|
49
|
+
target: ts.ScriptTarget.ESNext,
|
|
50
|
+
module: ts.ModuleKind.ESNext,
|
|
51
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
52
|
+
strict: true,
|
|
53
|
+
noImplicitAny: false,
|
|
54
|
+
noEmit: true,
|
|
55
|
+
skipLibCheck: true,
|
|
56
|
+
types: [],
|
|
57
|
+
lib: ["lib.esnext.d.ts"],
|
|
58
|
+
allowUnreachableCode: true
|
|
59
|
+
};
|
|
60
|
+
const host = ts.createCompilerHost(options);
|
|
61
|
+
const read = host.readFile.bind(host);
|
|
62
|
+
const exists = host.fileExists.bind(host);
|
|
63
|
+
host.readFile = (path) => path === sourcePath ? wrapped : path === globalsPath ? globalDeclarations(functions) : read(path);
|
|
64
|
+
host.fileExists = (path) => path === sourcePath || path === globalsPath || exists(path);
|
|
65
|
+
const program = ts.createProgram([sourcePath, globalsPath], options, host);
|
|
66
|
+
const file = program.getSourceFile(sourcePath);
|
|
67
|
+
const root = file.statements[0];
|
|
68
|
+
const statements = root.body?.statements ?? [];
|
|
69
|
+
const errors = [
|
|
70
|
+
...program.getSyntacticDiagnostics(file),
|
|
71
|
+
...program.getSemanticDiagnostics(file)
|
|
72
|
+
];
|
|
73
|
+
return {
|
|
74
|
+
file,
|
|
75
|
+
checker: program.getTypeChecker(),
|
|
76
|
+
statements,
|
|
77
|
+
start,
|
|
78
|
+
current: statements.filter(
|
|
79
|
+
(statement) => statement.getStart(file) >= start
|
|
80
|
+
),
|
|
81
|
+
diagnostics: errors.filter((error) => (error.start ?? start) >= start).slice(0, 100).map((error) => diagnosticPosition(error, source, start))
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
analyzeCell
|
|
86
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/sessions/compiler/binding-pattern.ts
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import { bindingAccess } from "./references.js";
|
|
4
|
+
function elementTarget(element, rewriter) {
|
|
5
|
+
const target = initializationTarget(element.name, rewriter);
|
|
6
|
+
return element.initializer ? ts.factory.createAssignment(target, rewriter.node(element.initializer)) : target;
|
|
7
|
+
}
|
|
8
|
+
function initializationTarget(name, rewriter) {
|
|
9
|
+
const f = ts.factory;
|
|
10
|
+
if (ts.isIdentifier(name)) return bindingAccess(name.text, true);
|
|
11
|
+
if (ts.isArrayBindingPattern(name))
|
|
12
|
+
return f.createArrayLiteralExpression(
|
|
13
|
+
name.elements.map((element) => {
|
|
14
|
+
if (ts.isOmittedExpression(element)) return element;
|
|
15
|
+
const value = elementTarget(element, rewriter);
|
|
16
|
+
return element.dotDotDotToken ? f.createSpreadElement(value) : value;
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
return f.createObjectLiteralExpression(
|
|
20
|
+
name.elements.map((element) => {
|
|
21
|
+
if (element.dotDotDotToken)
|
|
22
|
+
return f.createSpreadAssignment(
|
|
23
|
+
initializationTarget(element.name, rewriter)
|
|
24
|
+
);
|
|
25
|
+
const key = element.propertyName ?? element.name;
|
|
26
|
+
return f.createPropertyAssignment(
|
|
27
|
+
ts.isComputedPropertyName(key) ? rewriter.node(key) : key,
|
|
28
|
+
elementTarget(element, rewriter)
|
|
29
|
+
);
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
initializationTarget
|
|
35
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/sessions/compiler/bindings.ts
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
var BINDINGS_GLOBAL = "__orgsdk_session_bindings__";
|
|
4
|
+
function bindingNames(name) {
|
|
5
|
+
if (ts.isIdentifier(name)) return [name];
|
|
6
|
+
return name.elements.flatMap(
|
|
7
|
+
(element) => ts.isOmittedExpression(element) ? [] : bindingNames(element.name)
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
function declaredNames(statement) {
|
|
11
|
+
if (ts.isVariableStatement(statement)) {
|
|
12
|
+
const kind = statement.declarationList.flags & ts.NodeFlags.Const ? "const" : statement.declarationList.flags & ts.NodeFlags.Let ? "let" : "var";
|
|
13
|
+
return statement.declarationList.declarations.flatMap(
|
|
14
|
+
(declaration) => bindingNames(declaration.name).map((identifier) => ({
|
|
15
|
+
identifier,
|
|
16
|
+
kind
|
|
17
|
+
}))
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
if ((ts.isFunctionDeclaration(statement) || ts.isClassDeclaration(statement)) && statement.name)
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
identifier: statement.name,
|
|
24
|
+
kind: ts.isClassDeclaration(statement) ? "class" : "function"
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
function collectBindings(analysis, functions) {
|
|
30
|
+
const symbols = /* @__PURE__ */ new Map();
|
|
31
|
+
const definitions = [];
|
|
32
|
+
const diagnostics = [];
|
|
33
|
+
const reserved = /* @__PURE__ */ new Set([
|
|
34
|
+
"actionParams",
|
|
35
|
+
"defineParams",
|
|
36
|
+
"console",
|
|
37
|
+
"z",
|
|
38
|
+
...functions.map((name) => name.split(".")[0])
|
|
39
|
+
]);
|
|
40
|
+
for (const statement of analysis.statements) {
|
|
41
|
+
for (const { identifier, kind } of declaredNames(statement)) {
|
|
42
|
+
const symbol = analysis.checker.getSymbolAtLocation(identifier);
|
|
43
|
+
if (symbol) symbols.set(symbol, identifier.text);
|
|
44
|
+
if (statement.getStart(analysis.file) < analysis.start) continue;
|
|
45
|
+
if (reserved.has(identifier.text))
|
|
46
|
+
diagnostics.push({
|
|
47
|
+
line: 1,
|
|
48
|
+
column: 1,
|
|
49
|
+
code: "reserved_binding",
|
|
50
|
+
message: `The SDK binding '${identifier.text}' is reserved`
|
|
51
|
+
});
|
|
52
|
+
definitions.push({ name: identifier.text, kind });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return { symbols, definitions, diagnostics };
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
BINDINGS_GLOBAL,
|
|
59
|
+
collectBindings
|
|
60
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// src/sessions/compiler/emit.ts
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import { initializationTarget } from "./binding-pattern.js";
|
|
4
|
+
import { bindingAccess, ReferenceRewriter } from "./references.js";
|
|
5
|
+
function assignment(name, value) {
|
|
6
|
+
return ts.factory.createExpressionStatement(
|
|
7
|
+
ts.factory.createAssignment(bindingAccess(name, true), value)
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
function variables(statement, rewriter) {
|
|
11
|
+
return statement.declarationList.declarations.flatMap((declaration) => {
|
|
12
|
+
if (!declaration.initializer && !(statement.declarationList.flags & ts.NodeFlags.BlockScoped))
|
|
13
|
+
return [];
|
|
14
|
+
return [
|
|
15
|
+
ts.factory.createExpressionStatement(
|
|
16
|
+
ts.factory.createAssignment(
|
|
17
|
+
initializationTarget(declaration.name, rewriter),
|
|
18
|
+
declaration.initializer ? rewriter.node(declaration.initializer) : ts.factory.createVoidZero()
|
|
19
|
+
)
|
|
20
|
+
)
|
|
21
|
+
];
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function hoistedFunction(statement, rewriter) {
|
|
25
|
+
if (!statement.name || !statement.body) return void 0;
|
|
26
|
+
return assignment(
|
|
27
|
+
statement.name.text,
|
|
28
|
+
ts.factory.createFunctionExpression(
|
|
29
|
+
statement.modifiers?.filter(
|
|
30
|
+
(modifier) => modifier.kind === ts.SyntaxKind.AsyncKeyword
|
|
31
|
+
),
|
|
32
|
+
statement.asteriskToken,
|
|
33
|
+
void 0,
|
|
34
|
+
statement.typeParameters,
|
|
35
|
+
statement.parameters.map((parameter) => rewriter.node(parameter)),
|
|
36
|
+
statement.type,
|
|
37
|
+
rewriter.node(statement.body)
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function classDeclaration(statement, rewriter) {
|
|
42
|
+
const heritage = statement.heritageClauses?.map(
|
|
43
|
+
(clause) => rewriter.node(clause)
|
|
44
|
+
);
|
|
45
|
+
return assignment(
|
|
46
|
+
statement.name.text,
|
|
47
|
+
ts.factory.createClassExpression(
|
|
48
|
+
void 0,
|
|
49
|
+
statement.name,
|
|
50
|
+
statement.typeParameters,
|
|
51
|
+
heritage,
|
|
52
|
+
rewriter.classMembers(statement)
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
function transformCell(analysis, rewriter) {
|
|
57
|
+
const hoisted = [];
|
|
58
|
+
const body = [];
|
|
59
|
+
for (const statement of analysis.current) {
|
|
60
|
+
if (ts.isVariableStatement(statement)) {
|
|
61
|
+
body.push(...variables(statement, rewriter));
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (ts.isFunctionDeclaration(statement) && statement.name) {
|
|
65
|
+
const fn = hoistedFunction(statement, rewriter);
|
|
66
|
+
if (fn) hoisted.push(fn);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (ts.isClassDeclaration(statement) && statement.name) {
|
|
70
|
+
body.push(classDeclaration(statement, rewriter));
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
body.push(rewriter.node(statement));
|
|
74
|
+
}
|
|
75
|
+
const lastEmitted = body.at(-1);
|
|
76
|
+
const lastSource = analysis.current.at(-1);
|
|
77
|
+
if (lastEmitted && ts.isExpressionStatement(lastEmitted) && lastSource && ts.isExpressionStatement(lastSource))
|
|
78
|
+
body[body.length - 1] = ts.factory.createReturnStatement(
|
|
79
|
+
lastEmitted.expression
|
|
80
|
+
);
|
|
81
|
+
return ts.factory.updateSourceFile(analysis.file, [...hoisted, ...body]);
|
|
82
|
+
}
|
|
83
|
+
function emitCell(analysis, symbols) {
|
|
84
|
+
const transformed = ts.transform(analysis.file, [
|
|
85
|
+
(context) => {
|
|
86
|
+
const rewriter = new ReferenceRewriter(
|
|
87
|
+
context,
|
|
88
|
+
analysis.checker,
|
|
89
|
+
symbols
|
|
90
|
+
);
|
|
91
|
+
return () => transformCell(analysis, rewriter);
|
|
92
|
+
}
|
|
93
|
+
]);
|
|
94
|
+
try {
|
|
95
|
+
const printed = ts.createPrinter().printFile(transformed.transformed[0]);
|
|
96
|
+
const javascript = ts.transpileModule(printed, {
|
|
97
|
+
compilerOptions: {
|
|
98
|
+
target: ts.ScriptTarget.ESNext,
|
|
99
|
+
module: ts.ModuleKind.None
|
|
100
|
+
}
|
|
101
|
+
}).outputText;
|
|
102
|
+
return `(async () => {
|
|
103
|
+
${javascript}
|
|
104
|
+
})()`;
|
|
105
|
+
} finally {
|
|
106
|
+
transformed.dispose();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
export {
|
|
110
|
+
emitCell
|
|
111
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// src/sessions/compiler/references.ts
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import { BINDINGS_GLOBAL } from "./bindings.js";
|
|
4
|
+
function bindingAccess(name, initialize = false) {
|
|
5
|
+
return ts.factory.createElementAccessExpression(
|
|
6
|
+
ts.factory.createPropertyAccessExpression(
|
|
7
|
+
ts.factory.createIdentifier(BINDINGS_GLOBAL),
|
|
8
|
+
initialize ? "initializers" : "values"
|
|
9
|
+
),
|
|
10
|
+
ts.factory.createStringLiteral(name)
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
var ReferenceRewriter = class {
|
|
14
|
+
constructor(context, checker, symbols) {
|
|
15
|
+
this.context = context;
|
|
16
|
+
this.checker = checker;
|
|
17
|
+
this.symbols = symbols;
|
|
18
|
+
}
|
|
19
|
+
context;
|
|
20
|
+
checker;
|
|
21
|
+
symbols;
|
|
22
|
+
classSymbols = /* @__PURE__ */ new Set();
|
|
23
|
+
node(node) {
|
|
24
|
+
return ts.visitNode(node, this.visit);
|
|
25
|
+
}
|
|
26
|
+
classMembers(statement) {
|
|
27
|
+
const self = statement.name && this.checker.getSymbolAtLocation(statement.name);
|
|
28
|
+
if (self) this.classSymbols.add(self);
|
|
29
|
+
const members = statement.members.map((member) => this.node(member));
|
|
30
|
+
if (self) this.classSymbols.delete(self);
|
|
31
|
+
return members;
|
|
32
|
+
}
|
|
33
|
+
name(symbol) {
|
|
34
|
+
return symbol && !this.classSymbols.has(symbol) ? this.symbols.get(symbol) : void 0;
|
|
35
|
+
}
|
|
36
|
+
visit = (node) => {
|
|
37
|
+
if (ts.isTypeNode(node) && !ts.isExpressionWithTypeArguments(node))
|
|
38
|
+
return node;
|
|
39
|
+
if (ts.isShorthandPropertyAssignment(node)) {
|
|
40
|
+
const name = this.name(
|
|
41
|
+
this.checker.getShorthandAssignmentValueSymbol(node)
|
|
42
|
+
);
|
|
43
|
+
if (name)
|
|
44
|
+
return ts.factory.createPropertyAssignment(
|
|
45
|
+
node.name,
|
|
46
|
+
node.objectAssignmentInitializer ? ts.factory.createAssignment(
|
|
47
|
+
bindingAccess(name),
|
|
48
|
+
this.node(node.objectAssignmentInitializer)
|
|
49
|
+
) : bindingAccess(name)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
if (ts.isIdentifier(node)) {
|
|
53
|
+
const name = this.name(this.checker.getSymbolAtLocation(node));
|
|
54
|
+
if (name) return bindingAccess(name);
|
|
55
|
+
}
|
|
56
|
+
return ts.visitEachChild(node, this.visit, this.context);
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
ReferenceRewriter,
|
|
61
|
+
bindingAccess
|
|
62
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// src/sessions/compiler/source-policy.ts
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
function sourceRestrictions(source) {
|
|
4
|
+
const file = ts.createSourceFile(
|
|
5
|
+
"cell.ts",
|
|
6
|
+
source,
|
|
7
|
+
ts.ScriptTarget.Latest,
|
|
8
|
+
true
|
|
9
|
+
);
|
|
10
|
+
const errors = [];
|
|
11
|
+
const reject = (node, message) => {
|
|
12
|
+
const position = file.getLineAndCharacterOfPosition(node.getStart(file));
|
|
13
|
+
errors.push({
|
|
14
|
+
line: position.line + 1,
|
|
15
|
+
column: position.character + 1,
|
|
16
|
+
code: "unsupported_source",
|
|
17
|
+
message
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
if (file.referencedFiles.length || file.typeReferenceDirectives.length || file.libReferenceDirectives.length || file.hasNoDefaultLib)
|
|
21
|
+
reject(
|
|
22
|
+
file,
|
|
23
|
+
"Compiler reference directives are unavailable in session cells"
|
|
24
|
+
);
|
|
25
|
+
function visit(node, inFunction = false) {
|
|
26
|
+
const moduleModifier = ts.canHaveModifiers(node) && ts.getModifiers(node)?.some(
|
|
27
|
+
(m) => m.kind === ts.SyntaxKind.ExportKeyword || m.kind === ts.SyntaxKind.DefaultKeyword
|
|
28
|
+
);
|
|
29
|
+
if (ts.isImportDeclaration(node) || ts.isImportEqualsDeclaration(node) || ts.isImportTypeNode(node) || ts.isExportDeclaration(node) || ts.isExportAssignment(node) || ts.isMetaProperty(node) || moduleModifier)
|
|
30
|
+
reject(node, "Imports and exports are unavailable in session cells");
|
|
31
|
+
if (ts.isEnumDeclaration(node) || ts.isModuleDeclaration(node))
|
|
32
|
+
reject(
|
|
33
|
+
node,
|
|
34
|
+
"Use type/interface declarations and const objects instead of enums or namespaces in session cells"
|
|
35
|
+
);
|
|
36
|
+
if (ts.canHaveModifiers(node) && ts.getModifiers(node)?.some((modifier) => modifier.kind === ts.SyntaxKind.DeclareKeyword))
|
|
37
|
+
reject(
|
|
38
|
+
node,
|
|
39
|
+
"Ambient value declarations are unavailable in session cells"
|
|
40
|
+
);
|
|
41
|
+
if (ts.isIdentifier(node) && node.text.startsWith("__orgsdk_"))
|
|
42
|
+
reject(node, "Internal session names are reserved");
|
|
43
|
+
if (ts.isCallExpression(node) && (node.expression.kind === ts.SyntaxKind.ImportKeyword || ts.isIdentifier(node.expression) && ["require", "eval", "Function"].includes(node.expression.text)))
|
|
44
|
+
reject(
|
|
45
|
+
node,
|
|
46
|
+
"Dynamic loading and dynamic code evaluation are unavailable in session cells"
|
|
47
|
+
);
|
|
48
|
+
if (ts.isVariableDeclarationList(node) && !inFunction && !(node.flags & ts.NodeFlags.BlockScoped) && !ts.isVariableStatement(node.parent))
|
|
49
|
+
reject(node, "Use let or const in loop declarations in session cells");
|
|
50
|
+
if (ts.isVariableStatement(node) && !inFunction && !(node.declarationList.flags & ts.NodeFlags.BlockScoped) && !ts.isSourceFile(node.parent))
|
|
51
|
+
reject(node, "Use let or const for block declarations in session cells");
|
|
52
|
+
ts.forEachChild(
|
|
53
|
+
node,
|
|
54
|
+
(child) => visit(child, inFunction || ts.isFunctionLike(node))
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
visit(file);
|
|
58
|
+
return errors.slice(0, 100);
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
sourceRestrictions
|
|
62
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/sessions/compiler.ts
|
|
2
|
+
import { analyzeCell } from "./compiler/analysis.js";
|
|
3
|
+
import { collectBindings } from "./compiler/bindings.js";
|
|
4
|
+
import { emitCell } from "./compiler/emit.js";
|
|
5
|
+
import { sourceRestrictions } from "./compiler/source-policy.js";
|
|
6
|
+
import { BINDINGS_GLOBAL } from "./compiler/bindings.js";
|
|
7
|
+
function compileCell(history, source, functions = []) {
|
|
8
|
+
const restrictions = sourceRestrictions(source);
|
|
9
|
+
if (restrictions.length)
|
|
10
|
+
return { javascript: "", definitions: [], diagnostics: restrictions };
|
|
11
|
+
const analysis = analyzeCell(history, source, functions);
|
|
12
|
+
if (analysis.diagnostics.length)
|
|
13
|
+
return {
|
|
14
|
+
javascript: "",
|
|
15
|
+
definitions: [],
|
|
16
|
+
diagnostics: analysis.diagnostics
|
|
17
|
+
};
|
|
18
|
+
const bindings = collectBindings(analysis, functions);
|
|
19
|
+
if (bindings.diagnostics.length)
|
|
20
|
+
return {
|
|
21
|
+
javascript: "",
|
|
22
|
+
definitions: [],
|
|
23
|
+
diagnostics: bindings.diagnostics
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
javascript: emitCell(analysis, bindings.symbols),
|
|
27
|
+
definitions: bindings.definitions,
|
|
28
|
+
diagnostics: []
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
BINDINGS_GLOBAL,
|
|
33
|
+
compileCell
|
|
34
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// src/sessions/configuration.ts
|
|
2
|
+
import { isAbsolute, relative, sep } from "node:path";
|
|
3
|
+
import { SessionError } from "./types.js";
|
|
4
|
+
function sessionLimits(options) {
|
|
5
|
+
const limits = {
|
|
6
|
+
idleTimeoutMs: options.idleTimeoutMs ?? 15 * 6e4,
|
|
7
|
+
cellTimeoutMs: options.cellTimeoutMs ?? 3e5,
|
|
8
|
+
startTimeoutMs: options.startTimeoutMs ?? 3e4,
|
|
9
|
+
maxSessions: options.maxSessions ?? 16,
|
|
10
|
+
maxCells: options.maxCells ?? 128,
|
|
11
|
+
maxOutputEvents: options.maxOutputEvents ?? 1e3,
|
|
12
|
+
maxOutputBytes: options.maxOutputBytes ?? 1e6
|
|
13
|
+
};
|
|
14
|
+
for (const [name, value] of Object.entries(limits))
|
|
15
|
+
if (!Number.isSafeInteger(value) || value < 1)
|
|
16
|
+
throw new SessionError(
|
|
17
|
+
"invalid_options",
|
|
18
|
+
`${name} must be a positive integer`
|
|
19
|
+
);
|
|
20
|
+
return limits;
|
|
21
|
+
}
|
|
22
|
+
function validateWorkspace(workspaceDirectory, historyDirectory) {
|
|
23
|
+
if (!isAbsolute(workspaceDirectory))
|
|
24
|
+
throw new SessionError(
|
|
25
|
+
"invalid_directory",
|
|
26
|
+
"Workspace directory must be absolute"
|
|
27
|
+
);
|
|
28
|
+
const storage = relative(workspaceDirectory, historyDirectory);
|
|
29
|
+
const parentDirectory = storage === ".." || storage.startsWith(`..${sep}`);
|
|
30
|
+
const historyInsideWorkspace = !parentDirectory && !isAbsolute(storage);
|
|
31
|
+
if (historyInsideWorkspace)
|
|
32
|
+
throw new SessionError(
|
|
33
|
+
"invalid_directory",
|
|
34
|
+
"History must be stored outside the project workspace"
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function validateOpen(request, historyDirectory) {
|
|
38
|
+
const identity = [
|
|
39
|
+
request.workspaceId,
|
|
40
|
+
request.projectId,
|
|
41
|
+
request.ownerId,
|
|
42
|
+
request.configurationRevision
|
|
43
|
+
];
|
|
44
|
+
if (identity.some(
|
|
45
|
+
(value) => typeof value !== "string" || !value || value.length > 256
|
|
46
|
+
))
|
|
47
|
+
throw new SessionError(
|
|
48
|
+
"invalid_scope",
|
|
49
|
+
"A bounded workspace, project, owner and configuration revision are required"
|
|
50
|
+
);
|
|
51
|
+
validateWorkspace(request.workspaceDirectory, historyDirectory);
|
|
52
|
+
}
|
|
53
|
+
function validateReset(request, generation, historyDirectory) {
|
|
54
|
+
if (generation !== request.expectedGeneration)
|
|
55
|
+
throw new SessionError("stale_generation", "Session generation changed");
|
|
56
|
+
if (!isAbsolute(request.workspaceDirectory) || !request.configurationRevision || request.configurationRevision.length > 256)
|
|
57
|
+
throw new SessionError(
|
|
58
|
+
"invalid_reset",
|
|
59
|
+
"Reset requires an absolute workspace and configuration revision"
|
|
60
|
+
);
|
|
61
|
+
validateWorkspace(request.workspaceDirectory, historyDirectory);
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
sessionLimits,
|
|
65
|
+
validateOpen,
|
|
66
|
+
validateReset,
|
|
67
|
+
validateWorkspace
|
|
68
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// src/sessions/events.ts
|
|
2
|
+
import { traceData } from "./values.js";
|
|
3
|
+
import { SessionError } from "./types.js";
|
|
4
|
+
var SessionEvents = class {
|
|
5
|
+
constructor(history, limits, redactor) {
|
|
6
|
+
this.history = history;
|
|
7
|
+
this.limits = limits;
|
|
8
|
+
this.redactor = redactor;
|
|
9
|
+
const output = history.events.filter(
|
|
10
|
+
(event) => event.kind === "execution.log" || event.kind === "execution.step"
|
|
11
|
+
);
|
|
12
|
+
this.outputEvents = output.length;
|
|
13
|
+
this.outputBytes = output.reduce(
|
|
14
|
+
(bytes, event) => bytes + Buffer.byteLength(JSON.stringify(event.data)),
|
|
15
|
+
0
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
history;
|
|
19
|
+
limits;
|
|
20
|
+
redactor;
|
|
21
|
+
outputEvents;
|
|
22
|
+
outputBytes;
|
|
23
|
+
append(cellId, kind, data, output = false) {
|
|
24
|
+
if (output && this.history.outputTruncated) return false;
|
|
25
|
+
const bounded = traceData(this.redactor.redact(data));
|
|
26
|
+
const bytes = Buffer.byteLength(JSON.stringify(bounded));
|
|
27
|
+
const outputFull = this.outputEvents >= this.limits.maxOutputEvents || this.outputBytes + bytes > this.limits.maxOutputBytes;
|
|
28
|
+
if (output && outputFull) {
|
|
29
|
+
this.history.outputTruncated = true;
|
|
30
|
+
this.append(cellId, "execution.truncated", {
|
|
31
|
+
reason: "Session output retention limit reached"
|
|
32
|
+
});
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
if (output) {
|
|
36
|
+
this.outputEvents++;
|
|
37
|
+
this.outputBytes += bytes;
|
|
38
|
+
}
|
|
39
|
+
this.history.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
40
|
+
this.history.events.push({
|
|
41
|
+
cursor: ++this.history.cursor,
|
|
42
|
+
generation: this.history.generation,
|
|
43
|
+
cellId,
|
|
44
|
+
kind,
|
|
45
|
+
data: bounded,
|
|
46
|
+
timestamp: this.history.updatedAt
|
|
47
|
+
});
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
page(options = {}) {
|
|
51
|
+
const after = options.after ?? 0;
|
|
52
|
+
const limit = options.limit ?? 100;
|
|
53
|
+
if (!Number.isSafeInteger(after) || after < 0 || after > this.history.cursor || !Number.isSafeInteger(limit) || limit < 1 || limit > 1e3)
|
|
54
|
+
throw new SessionError(
|
|
55
|
+
"invalid_cursor",
|
|
56
|
+
"Cursor must be within the retained history and limit must be 1\u20131000"
|
|
57
|
+
);
|
|
58
|
+
const remaining = this.history.events.filter(
|
|
59
|
+
(event) => event.cursor > after && (!options.cellId || event.cellId === options.cellId)
|
|
60
|
+
);
|
|
61
|
+
const events = remaining.slice(0, limit);
|
|
62
|
+
return {
|
|
63
|
+
events: structuredClone(events),
|
|
64
|
+
nextCursor: events.at(-1)?.cursor ?? after,
|
|
65
|
+
tailCursor: this.history.cursor,
|
|
66
|
+
hasMore: remaining.length > events.length
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
export {
|
|
71
|
+
SessionEvents
|
|
72
|
+
};
|