offsite 0.0.2 → 0.0.4
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/README.md +18 -7
- package/apps/server/dist/main.mjs +5767 -0
- package/apps/server/dist/main.mjs.map +1 -0
- package/apps/web/dist/assets/{angular-html-Oa9dnZbT.js → angular-html-prQpjz7s.js} +1 -1
- package/apps/web/dist/assets/{angular-ts-F_BIbY2H.js → angular-ts-BE4HJ5Uh.js} +1 -1
- package/apps/web/dist/assets/{apl-D7AuiKiV.js → apl-CJ-NIQ-7.js} +1 -1
- package/apps/web/dist/assets/{astro-DnpymQyW.js → astro-CVkyXRVY.js} +1 -1
- package/apps/web/dist/assets/{blade-CZZrW0iI.js → blade-CQFMHse_.js} +1 -1
- package/apps/web/dist/assets/{c-V_Rix0w2.js → c-gqNWYRL8.js} +1 -1
- package/apps/web/dist/assets/{chapel-fGtLLMYq.js → chapel-CQ9_BV4j.js} +1 -1
- package/apps/web/dist/assets/{cobol-BFOTnbFa.js → cobol-D-9v184m.js} +1 -1
- package/apps/web/dist/assets/{coffee-BdvfipEg.js → coffee-BE0tIOLL.js} +1 -1
- package/apps/web/dist/assets/{cpp-D_NFR3H2.js → cpp-CzOLC-NF.js} +1 -1
- package/apps/web/dist/assets/{crystal-BM2vkBPa.js → crystal-f1GcBNi_.js} +1 -1
- package/apps/web/dist/assets/{css-Byur6C5q.js → css-DlqRAumc.js} +1 -1
- package/apps/web/dist/assets/{edge-CP-KL2DQ.js → edge-DQkkPJaW.js} +1 -1
- package/apps/web/dist/assets/{elixir-CiO075Fh.js → elixir-ClG78o74.js} +1 -1
- package/apps/web/dist/assets/{elm-DIyG-d95.js → elm-DZDmCmuw.js} +1 -1
- package/apps/web/dist/assets/{erb-DHZK6WKc.js → erb-B1mu0-DN.js} +1 -1
- package/apps/web/dist/assets/{git-rebase-CxXKbwiy.js → git-rebase-x1gs-rK2.js} +1 -1
- package/apps/web/dist/assets/{glimmer-js-BUhQC_gD.js → glimmer-js-Cjos1igW.js} +1 -1
- package/apps/web/dist/assets/{glimmer-ts-D2lLByyw.js → glimmer-ts-CrR-PFvn.js} +1 -1
- package/apps/web/dist/assets/{glsl-BMvlWqE_.js → glsl-DR0G8e99.js} +1 -1
- package/apps/web/dist/assets/{graphql-D9UFk_fJ.js → graphql-DKmrBZt7.js} +1 -1
- package/apps/web/dist/assets/{hack-BZAO0Jc2.js → hack-Brs_j9Xv.js} +1 -1
- package/apps/web/dist/assets/{haml-Dm5wroII.js → haml-8Lc-lF96.js} +1 -1
- package/apps/web/dist/assets/{handlebars-C9L1Bn7f.js → handlebars-Ds8WdPdv.js} +1 -1
- package/apps/web/dist/assets/{html-Bz91Luf0.js → html-C0gvYDho.js} +1 -1
- package/apps/web/dist/assets/{html-derivative-hIdjVrpA.js → html-derivative-CU9dkErg.js} +1 -1
- package/apps/web/dist/assets/{http-AWG6aeFM.js → http-BE0w0Fty.js} +1 -1
- package/apps/web/dist/assets/{hurl-pSGcpqgh.js → hurl-DqZk6YcW.js} +1 -1
- package/apps/web/dist/assets/index-0B-Gdd7b.css +2 -0
- package/apps/web/dist/assets/index-rgKS_aMw.js +1148 -0
- package/apps/web/dist/assets/{java-D_CyC-X4.js → java-PSSQ0YmM.js} +1 -1
- package/apps/web/dist/assets/{javascript-PK4jkG9t.js → javascript-Ci3r4rzs.js} +1 -1
- package/apps/web/dist/assets/{jinja-Cu3wzgkz.js → jinja-lLTko9Wl.js} +1 -1
- package/apps/web/dist/assets/{jison-CHevE1W8.js → jison-1BpHD5UK.js} +1 -1
- package/apps/web/dist/assets/{json-DPTkd0bP.js → json-BAUn76M4.js} +1 -1
- package/apps/web/dist/assets/{jsx-DcsDzCOA.js → jsx-B8sFp1vz.js} +1 -1
- package/apps/web/dist/assets/{julia-B9tMVOL0.js → julia-C4TZ4EL9.js} +1 -1
- package/apps/web/dist/assets/{just-BHIhrE9N.js → just-D5qIrqkp.js} +1 -1
- package/apps/web/dist/assets/{latex-CY05HK-G.js → latex-BL7XYxFg.js} +1 -1
- package/apps/web/dist/assets/{liquid-DJaL8XK2.js → liquid-DBx9Hq7B.js} +1 -1
- package/apps/web/dist/assets/{lua-BfaWUinJ.js → lua-BqjicQyd.js} +1 -1
- package/apps/web/dist/assets/{marko-0Lc0z7w6.js → marko-CHgy7yaY.js} +1 -1
- package/apps/web/dist/assets/{mdc-DEhXNYDZ.js → mdc-DOloBwb8.js} +1 -1
- package/apps/web/dist/assets/{nginx-DLuBebI5.js → nginx-g7I1HPwV.js} +1 -1
- package/apps/web/dist/assets/{nim-BIJh7lZB.js → nim-O6zJV1LD.js} +1 -1
- package/apps/web/dist/assets/{org-BFpxb2WJ.js → org-HLg4-757.js} +1 -1
- package/apps/web/dist/assets/{perl-DHbDMq2q.js → perl-B3cDKTai.js} +1 -1
- package/apps/web/dist/assets/{php-BcVbiJpZ.js → php-2eDApoU3.js} +1 -1
- package/apps/web/dist/assets/{pug-bdfyK-rS.js → pug-itzGn-nK.js} +1 -1
- package/apps/web/dist/assets/{qml-BC2D8eWk.js → qml-sU0VtUmf.js} +1 -1
- package/apps/web/dist/assets/{r-O3zbZ-YT.js → r-C6mhPqgr.js} +1 -1
- package/apps/web/dist/assets/{razor-Ffnu5_vD.js → razor-CSzRtbW7.js} +1 -1
- package/apps/web/dist/assets/{regexp-dnbUAgjx.js → regexp-BmdBJRV9.js} +1 -1
- package/apps/web/dist/assets/{rst-DJfy2dSm.js → rst-BRxUd6sp.js} +1 -1
- package/apps/web/dist/assets/{ruby-DGEpA0mD.js → ruby-CQHHOfmX.js} +1 -1
- package/apps/web/dist/assets/{sas-CZvL8X8k.js → sas-DlaL8b25.js} +1 -1
- package/apps/web/dist/assets/{scss-BtNSCzZB.js → scss-Cc71ABWp.js} +1 -1
- package/apps/web/dist/assets/{shellscript-uR-sOZlr.js → shellscript-CzA_LIIm.js} +1 -1
- package/apps/web/dist/assets/{shellsession-BT-Jl4S5.js → shellsession-DESJlgp3.js} +1 -1
- package/apps/web/dist/assets/{soy-BjfL_vrj.js → soy-Nkvq88YN.js} +1 -1
- package/apps/web/dist/assets/{sql-fa1gAeRF.js → sql-CtPxrO7T.js} +1 -1
- package/apps/web/dist/assets/{stata-DgTOpGhg.js → stata-BacEfVTr.js} +1 -1
- package/apps/web/dist/assets/{surrealql-DVqEkJeu.js → surrealql-CYW10JNe.js} +1 -1
- package/apps/web/dist/assets/{svelte-CyQ5sU9I.js → svelte-D3_tCKGs.js} +1 -1
- package/apps/web/dist/assets/{templ-DrztMbAf.js → templ-BGKIfY_b.js} +1 -1
- package/apps/web/dist/assets/{tex-NAwM8Kkh.js → tex-BkkYOaXX.js} +1 -1
- package/apps/web/dist/assets/{ts-tags-DX96dDxh.js → ts-tags-B02tnbpZ.js} +1 -1
- package/apps/web/dist/assets/{tsx-D3PnhDHK.js → tsx-D3MB1IUf.js} +1 -1
- package/apps/web/dist/assets/{twig-FG0P9evf.js → twig-CPhw2wGK.js} +1 -1
- package/apps/web/dist/assets/{typescript-Crqeuw0P.js → typescript-B7U4faGm.js} +1 -1
- package/apps/web/dist/assets/{typst-CO_2MFRr.js → typst-CN9EZswy.js} +1 -1
- package/apps/web/dist/assets/{vue-fTNrS0Q3.js → vue-YH8dfjo_.js} +1 -1
- package/apps/web/dist/assets/{vue-html-E0ptmXwc.js → vue-html-NwX2xzgp.js} +1 -1
- package/apps/web/dist/assets/{vue-vine-C34_rJIu.js → vue-vine-DoRmnjLj.js} +1 -1
- package/apps/web/dist/assets/{xml-BB9WbMMU.js → xml-DgfgLpPc.js} +1 -1
- package/apps/web/dist/assets/{xsl-B3w2P7LL.js → xsl-CEwQRUK_.js} +1 -1
- package/apps/web/dist/assets/{yaml-BKGRKqBA.js → yaml-CEFOzF95.js} +1 -1
- package/apps/web/dist/icon.svg +5 -0
- package/apps/web/dist/index.html +2 -2
- package/apps/web/dist/sw.js +19 -8
- package/bin/offsite.js +1 -1
- package/package.json +6 -1
- package/apps/server/dist/args.js +0 -11
- package/apps/server/dist/claude.js +0 -207
- package/apps/server/dist/config.js +0 -185
- package/apps/server/dist/content.js +0 -172
- package/apps/server/dist/db.js +0 -13
- package/apps/server/dist/files.js +0 -50
- package/apps/server/dist/git.js +0 -133
- package/apps/server/dist/history.js +0 -137
- package/apps/server/dist/hub.js +0 -10
- package/apps/server/dist/main.js +0 -64
- package/apps/server/dist/projects.js +0 -92
- package/apps/server/dist/protocol.js +0 -20
- package/apps/server/dist/push.js +0 -152
- package/apps/server/dist/run.js +0 -375
- package/apps/server/dist/runs.js +0 -102
- package/apps/server/dist/schemes.js +0 -262
- package/apps/server/dist/sessions.js +0 -65
- package/apps/server/dist/socket.js +0 -149
- package/apps/server/dist/storage.js +0 -22
- package/apps/server/dist/terminal/alerts.js +0 -145
- package/apps/server/dist/terminal/process.js +0 -207
- package/apps/server/dist/terminal/shell-check.js +0 -91
- package/apps/server/dist/terminal/shell-integration.js +0 -112
- package/apps/server/dist/terminal/terminal.js +0 -402
- package/apps/web/dist/assets/index-BiLbXfDN.js +0 -899
- package/apps/web/dist/assets/index-DQIK-TpZ.css +0 -2
- /package/apps/server/src/{terminal → services/terminal}/shell-integration/bash/offsite.bash +0 -0
- /package/apps/server/src/{terminal → services/terminal}/shell-integration/fish/offsite.fish +0 -0
- /package/apps/server/src/{terminal → services/terminal}/shell-integration/zsh/.zshenv +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./index-
|
|
1
|
+
import{t as e}from"./index-rgKS_aMw.js";import{t}from"./java-PSSQ0YmM.js";var n=e({default:()=>i}),r=Object.freeze(JSON.parse(`{"displayName":"XML","name":"xml","patterns":[{"begin":"(<\\\\?)\\\\s*([-0-9A-Z_a-z]+)","captures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"entity.name.tag.xml"}},"end":"(\\\\?>)","name":"meta.tag.preprocessor.xml","patterns":[{"match":" ([-A-Za-z]+)","name":"entity.other.attribute-name.xml"},{"include":"#doublequotedString"},{"include":"#singlequotedString"}]},{"begin":"(<!)(DOCTYPE)\\\\s+([:A-Z_a-z][-.0-:A-Z_a-z]*)","captures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"keyword.other.doctype.xml"},"3":{"name":"variable.language.documentroot.xml"}},"end":"\\\\s*(>)","name":"meta.tag.sgml.doctype.xml","patterns":[{"include":"#internalSubset"}]},{"include":"#comments"},{"begin":"(<)((?:([-0-9A-Z_a-z]+)(:))?([-0-:A-Z_a-z]+))(?=(\\\\s[^>]*)?></\\\\2>)","beginCaptures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"entity.name.tag.xml"},"3":{"name":"entity.name.tag.namespace.xml"},"4":{"name":"punctuation.separator.namespace.xml"},"5":{"name":"entity.name.tag.localname.xml"}},"end":"(>)(</)((?:([-0-9A-Z_a-z]+)(:))?([-0-:A-Z_a-z]+))(>)","endCaptures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"punctuation.definition.tag.xml"},"3":{"name":"entity.name.tag.xml"},"4":{"name":"entity.name.tag.namespace.xml"},"5":{"name":"punctuation.separator.namespace.xml"},"6":{"name":"entity.name.tag.localname.xml"},"7":{"name":"punctuation.definition.tag.xml"}},"name":"meta.tag.no-content.xml","patterns":[{"include":"#tagStuff"}]},{"begin":"(</?)(?:([-.\\\\w]+)((:)))?([-.:\\\\w]+)","captures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"entity.name.tag.namespace.xml"},"3":{"name":"entity.name.tag.xml"},"4":{"name":"punctuation.separator.namespace.xml"},"5":{"name":"entity.name.tag.localname.xml"}},"end":"(/?>)","name":"meta.tag.xml","patterns":[{"include":"#tagStuff"}]},{"include":"#entity"},{"include":"#bare-ampersand"},{"begin":"<%@","beginCaptures":{"0":{"name":"punctuation.section.embedded.begin.xml"}},"end":"%>","endCaptures":{"0":{"name":"punctuation.section.embedded.end.xml"}},"name":"source.java-props.embedded.xml","patterns":[{"match":"page|include|taglib","name":"keyword.other.page-props.xml"}]},{"begin":"<%[!=]?(?!--)","beginCaptures":{"0":{"name":"punctuation.section.embedded.begin.xml"}},"end":"(?!--)%>","endCaptures":{"0":{"name":"punctuation.section.embedded.end.xml"}},"name":"source.java.embedded.xml","patterns":[{"include":"source.java"}]},{"begin":"<!\\\\[CDATA\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.xml"}},"end":"]]>","endCaptures":{"0":{"name":"punctuation.definition.string.end.xml"}},"name":"string.unquoted.cdata.xml"}],"repository":{"EntityDecl":{"begin":"(<!)(ENTITY)\\\\s+(%\\\\s+)?([:A-Z_a-z][-.0-:A-Z_a-z]*)(\\\\s+(?:SYSTEM|PUBLIC)\\\\s+)?","captures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"keyword.other.entity.xml"},"3":{"name":"punctuation.definition.entity.xml"},"4":{"name":"variable.language.entity.xml"},"5":{"name":"keyword.other.entitytype.xml"}},"end":"(>)","patterns":[{"include":"#doublequotedString"},{"include":"#singlequotedString"}]},"bare-ampersand":{"match":"&","name":"invalid.illegal.bad-ampersand.xml"},"comments":{"patterns":[{"begin":"<%--","captures":{"0":{"name":"punctuation.definition.comment.xml"},"end":"--%>","name":"comment.block.xml"}},{"begin":"<!--","captures":{"0":{"name":"punctuation.definition.comment.xml"}},"end":"-->","name":"comment.block.xml","patterns":[{"begin":"--(?!>)","captures":{"0":{"name":"invalid.illegal.bad-comments-or-CDATA.xml"}}}]}]},"doublequotedString":{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.xml"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.xml"}},"name":"string.quoted.double.xml","patterns":[{"include":"#entity"},{"include":"#bare-ampersand"}]},"entity":{"captures":{"1":{"name":"punctuation.definition.constant.xml"},"3":{"name":"punctuation.definition.constant.xml"}},"match":"(&)([:A-Z_a-z][-.0-:A-Z_a-z]*|#[0-9]+|#x\\\\h+)(;)","name":"constant.character.entity.xml"},"internalSubset":{"begin":"(\\\\[)","captures":{"1":{"name":"punctuation.definition.constant.xml"}},"end":"(])","name":"meta.internalsubset.xml","patterns":[{"include":"#EntityDecl"},{"include":"#parameterEntity"},{"include":"#comments"}]},"parameterEntity":{"captures":{"1":{"name":"punctuation.definition.constant.xml"},"3":{"name":"punctuation.definition.constant.xml"}},"match":"(%)([:A-Z_a-z][-.0-:A-Z_a-z]*)(;)","name":"constant.character.parameter-entity.xml"},"singlequotedString":{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.xml"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.string.end.xml"}},"name":"string.quoted.single.xml","patterns":[{"include":"#entity"},{"include":"#bare-ampersand"}]},"tagStuff":{"patterns":[{"captures":{"1":{"name":"entity.other.attribute-name.namespace.xml"},"2":{"name":"entity.other.attribute-name.xml"},"3":{"name":"punctuation.separator.namespace.xml"},"4":{"name":"entity.other.attribute-name.localname.xml"}},"match":"(?:^|\\\\s+)(?:([-.\\\\w]+)((:)))?([-.:\\\\w]+)\\\\s*="},{"include":"#doublequotedString"},{"include":"#singlequotedString"}]}},"scopeName":"text.xml","embeddedLangs":["java"]}`)),i=[...t,r];export{n,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./xml-
|
|
1
|
+
import{t as e}from"./xml-DgfgLpPc.js";var t=Object.freeze(JSON.parse(`{"displayName":"XSL","name":"xsl","patterns":[{"begin":"(<)(xsl)((:))(template)","captures":{"1":{"name":"punctuation.definition.tag.xml"},"2":{"name":"entity.name.tag.namespace.xml"},"3":{"name":"entity.name.tag.xml"},"4":{"name":"punctuation.separator.namespace.xml"},"5":{"name":"entity.name.tag.localname.xml"}},"end":"(>)","name":"meta.tag.xml.template","patterns":[{"captures":{"1":{"name":"entity.other.attribute-name.namespace.xml"},"2":{"name":"entity.other.attribute-name.xml"},"3":{"name":"punctuation.separator.namespace.xml"},"4":{"name":"entity.other.attribute-name.localname.xml"}},"match":" (?:([-0-9A-Z_a-z]+)((:)))?([-A-Za-z]+)"},{"include":"#doublequotedString"},{"include":"#singlequotedString"}]},{"include":"text.xml"}],"repository":{"doublequotedString":{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.xml"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.xml"}},"name":"string.quoted.double.xml"},"singlequotedString":{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.xml"}},"end":"'","endCaptures":{"0":{"name":"punctuation.definition.string.end.xml"}},"name":"string.quoted.single.xml"}},"scopeName":"text.xml.xsl","embeddedLangs":["xml"]}`)),n=[...e,t];export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./index-BiLbXfDN.js";var t=e({default:()=>n}),n=[Object.freeze(JSON.parse(`{"displayName":"YAML","fileTypes":["yaml","yml","rviz","reek","clang-format","yaml-tmlanguage","syntax","sublime-syntax"],"firstLineMatch":"^%YAML( ?1.\\\\d+)?","name":"yaml","patterns":[{"include":"#comment"},{"include":"#property"},{"include":"#directive"},{"match":"^---","name":"entity.other.document.begin.yaml"},{"match":"^\\\\.{3}","name":"entity.other.document.end.yaml"},{"include":"#node"}],"repository":{"block-collection":{"patterns":[{"include":"#block-sequence"},{"include":"#block-mapping"}]},"block-mapping":{"patterns":[{"include":"#block-pair"}]},"block-node":{"patterns":[{"include":"#prototype"},{"include":"#block-scalar"},{"include":"#block-collection"},{"include":"#flow-scalar-plain-out"},{"include":"#flow-node"}]},"block-pair":{"patterns":[{"begin":"\\\\?","beginCaptures":{"1":{"name":"punctuation.definition.key-value.begin.yaml"}},"end":"(?=\\\\?)|^ *(:)|(:)","endCaptures":{"1":{"name":"punctuation.separator.key-value.mapping.yaml"},"2":{"name":"invalid.illegal.expected-newline.yaml"}},"name":"meta.block-mapping.yaml","patterns":[{"include":"#block-node"}]},{"begin":"(?=(?:[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?]\\\\S)([^:\\\\s]|:\\\\S|\\\\s+(?![#\\\\s]))*\\\\s*:(\\\\s|$))","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))","patterns":[{"include":"#flow-scalar-plain-out-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?]\\\\S","beginCaptures":{"0":{"name":"entity.name.tag.yaml"}},"contentName":"entity.name.tag.yaml","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))","name":"string.unquoted.plain.out.yaml"}]},{"match":":(?=\\\\s|$)","name":"punctuation.separator.key-value.mapping.yaml"}]},"block-scalar":{"begin":"(?:(\\\\|)|(>))([1-9])?([-+])?(.*\\\\n?)","beginCaptures":{"1":{"name":"keyword.control.flow.block-scalar.literal.yaml"},"2":{"name":"keyword.control.flow.block-scalar.folded.yaml"},"3":{"name":"constant.numeric.indentation-indicator.yaml"},"4":{"name":"storage.modifier.chomping-indicator.yaml"},"5":{"patterns":[{"include":"#comment"},{"match":".+","name":"invalid.illegal.expected-comment-or-newline.yaml"}]}},"end":"^(?=\\\\S)|(?!\\\\G)","patterns":[{"begin":"^( +)(?! )","end":"^(?!\\\\1|\\\\s*$)","name":"string.unquoted.block.yaml"}]},"block-sequence":{"match":"(-)(?!\\\\S)","name":"punctuation.definition.block.sequence.item.yaml"},"comment":{"begin":"(?:^([\\\\t ]*)|[\\\\t ]+)(?=#\\\\p{print}*$)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.yaml"}},"end":"(?!\\\\G)","patterns":[{"begin":"#","beginCaptures":{"0":{"name":"punctuation.definition.comment.yaml"}},"end":"\\\\n","name":"comment.line.number-sign.yaml"}]},"directive":{"begin":"^%","beginCaptures":{"0":{"name":"punctuation.definition.directive.begin.yaml"}},"end":"(?=$|[\\\\t ]+($|#))","name":"meta.directive.yaml","patterns":[{"captures":{"1":{"name":"keyword.other.directive.yaml.yaml"},"2":{"name":"constant.numeric.yaml-version.yaml"}},"match":"\\\\G(YAML)[\\\\t ]+(\\\\d+\\\\.\\\\d+)"},{"captures":{"1":{"name":"keyword.other.directive.tag.yaml"},"2":{"name":"storage.type.tag-handle.yaml"},"3":{"name":"support.type.tag-prefix.yaml"}},"match":"\\\\G(TAG)(?:[\\\\t ]+(!(?:[-0-9A-Za-z]*!)?)(?:[\\\\t ]+(!(?:%\\\\h{2}|[]!#$\\\\&-;=?-\\\\[_a-z~])*|(?![]!,\\\\[{}])(?:%\\\\h{2}|[]!#$\\\\&-;=?-\\\\[_a-z~])+))?)?"},{"captures":{"1":{"name":"support.other.directive.reserved.yaml"},"2":{"name":"string.unquoted.directive-name.yaml"},"3":{"name":"string.unquoted.directive-parameter.yaml"}},"match":"\\\\G(\\\\w+)(?:[\\\\t ]+(\\\\w+)(?:[\\\\t ]+(\\\\w+))?)?"},{"match":"\\\\S+","name":"invalid.illegal.unrecognized.yaml"}]},"flow-alias":{"captures":{"1":{"name":"keyword.control.flow.alias.yaml"},"2":{"name":"punctuation.definition.alias.yaml"},"3":{"name":"variable.other.alias.yaml"},"4":{"name":"invalid.illegal.character.anchor.yaml"}},"match":"((\\\\*))([^],/\\\\[{}\\\\s]+)([^],}\\\\s]\\\\S*)?"},"flow-collection":{"patterns":[{"include":"#flow-sequence"},{"include":"#flow-mapping"}]},"flow-mapping":{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.definition.mapping.begin.yaml"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.mapping.end.yaml"}},"name":"meta.flow-mapping.yaml","patterns":[{"include":"#prototype"},{"match":",","name":"punctuation.separator.mapping.yaml"},{"include":"#flow-pair"}]},"flow-node":{"patterns":[{"include":"#prototype"},{"include":"#flow-alias"},{"include":"#flow-collection"},{"include":"#flow-scalar"}]},"flow-pair":{"patterns":[{"begin":"\\\\?","beginCaptures":{"0":{"name":"punctuation.definition.key-value.begin.yaml"}},"end":"(?=[],}])","name":"meta.flow-pair.explicit.yaml","patterns":[{"include":"#prototype"},{"include":"#flow-pair"},{"include":"#flow-node"},{"begin":":(?=\\\\s|$|[],\\\\[{}])","beginCaptures":{"0":{"name":"punctuation.separator.key-value.mapping.yaml"}},"end":"(?=[],}])","patterns":[{"include":"#flow-value"}]}]},{"begin":"(?=(?:[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?][^],\\\\[{}\\\\s])([^],:\\\\[{}\\\\s]|:[^],\\\\[{}\\\\s]|\\\\s+(?![#\\\\s]))*\\\\s*:(\\\\s|$))","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])","name":"meta.flow-pair.key.yaml","patterns":[{"include":"#flow-scalar-plain-in-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?][^],\\\\[{}\\\\s]","beginCaptures":{"0":{"name":"entity.name.tag.yaml"}},"contentName":"entity.name.tag.yaml","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])","name":"string.unquoted.plain.in.yaml"}]},{"include":"#flow-node"},{"begin":":(?=\\\\s|$|[],\\\\[{}])","captures":{"0":{"name":"punctuation.separator.key-value.mapping.yaml"}},"end":"(?=[],}])","name":"meta.flow-pair.yaml","patterns":[{"include":"#flow-value"}]}]},"flow-scalar":{"patterns":[{"include":"#flow-scalar-double-quoted"},{"include":"#flow-scalar-single-quoted"},{"include":"#flow-scalar-plain-in"}]},"flow-scalar-double-quoted":{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.yaml"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.yaml"}},"name":"string.quoted.double.yaml","patterns":[{"match":"\\\\\\\\([ \\"/0LN\\\\\\\\_abefnprtv]|x\\\\d\\\\d|u\\\\d{4}|U\\\\d{8})","name":"constant.character.escape.yaml"},{"match":"\\\\\\\\\\\\n","name":"constant.character.escape.double-quoted.newline.yaml"}]},"flow-scalar-plain-in":{"patterns":[{"include":"#flow-scalar-plain-in-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?][^],\\\\[{}\\\\s]","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])","name":"string.unquoted.plain.in.yaml"}]},"flow-scalar-plain-in-implicit-type":{"patterns":[{"captures":{"1":{"name":"constant.language.null.yaml"},"2":{"name":"constant.language.boolean.yaml"},"3":{"name":"constant.numeric.integer.yaml"},"4":{"name":"constant.numeric.float.yaml"},"5":{"name":"constant.other.timestamp.yaml"},"6":{"name":"constant.language.value.yaml"},"7":{"name":"constant.language.merge.yaml"}},"match":"(?:(null|Null|NULL|~)|([Yy]|yes|Yes|YES|[Nn]|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)|([-+]?0b[01_]+|[-+]?0[0-7_]+|[-+]?(?:0|[1-9][0-9_]*)|[-+]?0x[_\\\\h]+|[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)|([-+]?(?:[0-9][0-9_]*)?\\\\.[.0-9]*(?:[Ee][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\\\.[0-9_]*|[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))|(\\\\d{4}-\\\\d{2}-\\\\d{2}|\\\\d{4}-\\\\d{1,2}-\\\\d{1,2}(?:[Tt]|[\\\\t ]+)\\\\d{1,2}:\\\\d{2}:\\\\d{2}(?:\\\\.\\\\d*)?(?:[\\\\t ]*Z|[-+]\\\\d{1,2}(?::\\\\d{1,2})?)?)|(=)|(<<))(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])"}]},"flow-scalar-plain-out":{"patterns":[{"include":"#flow-scalar-plain-out-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?]\\\\S","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))","name":"string.unquoted.plain.out.yaml"}]},"flow-scalar-plain-out-implicit-type":{"patterns":[{"captures":{"1":{"name":"constant.language.null.yaml"},"2":{"name":"constant.language.boolean.yaml"},"3":{"name":"constant.numeric.integer.yaml"},"4":{"name":"constant.numeric.float.yaml"},"5":{"name":"constant.other.timestamp.yaml"},"6":{"name":"constant.language.value.yaml"},"7":{"name":"constant.language.merge.yaml"}},"match":"(?:(null|Null|NULL|~)|([Yy]|yes|Yes|YES|[Nn]|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)|([-+]?0b[01_]+|[-+]?0[0-7_]+|[-+]?(?:0|[1-9][0-9_]*)|[-+]?0x[_\\\\h]+|[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)|([-+]?(?:[0-9][0-9_]*)?\\\\.[.0-9]*(?:[Ee][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\\\.[0-9_]*|[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))|(\\\\d{4}-\\\\d{2}-\\\\d{2}|\\\\d{4}-\\\\d{1,2}-\\\\d{1,2}(?:[Tt]|[\\\\t ]+)\\\\d{1,2}:\\\\d{2}:\\\\d{2}(?:\\\\.\\\\d*)?(?:[\\\\t ]*Z|[-+]\\\\d{1,2}(?::\\\\d{1,2})?)?)|(=)|(<<))(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))"}]},"flow-scalar-single-quoted":{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.yaml"}},"end":"'(?!')","endCaptures":{"0":{"name":"punctuation.definition.string.end.yaml"}},"name":"string.quoted.single.yaml","patterns":[{"match":"''","name":"constant.character.escape.single-quoted.yaml"}]},"flow-sequence":{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.sequence.begin.yaml"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.sequence.end.yaml"}},"name":"meta.flow-sequence.yaml","patterns":[{"include":"#prototype"},{"match":",","name":"punctuation.separator.sequence.yaml"},{"include":"#flow-pair"},{"include":"#flow-node"}]},"flow-value":{"patterns":[{"begin":"\\\\G(?![],}])","end":"(?=[],}])","name":"meta.flow-pair.value.yaml","patterns":[{"include":"#flow-node"}]}]},"node":{"patterns":[{"include":"#block-node"}]},"property":{"begin":"(?=[!\\\\&])","end":"(?!\\\\G)","name":"meta.property.yaml","patterns":[{"captures":{"1":{"name":"keyword.control.property.anchor.yaml"},"2":{"name":"punctuation.definition.anchor.yaml"},"3":{"name":"entity.name.type.anchor.yaml"},"4":{"name":"invalid.illegal.character.anchor.yaml"}},"match":"\\\\G((&))([^],/\\\\[{}\\\\s]+)(\\\\S+)?"},{"match":"\\\\G!(?:<(?:%\\\\h{2}|[]!#$\\\\&-;=?-\\\\[_a-z~])+>|(?:[-0-9A-Za-z]*!)?(?:%\\\\h{2}|[#$\\\\&-+\\\\--;=?-Z_a-z~])+|)(?=[\\\\t ]|$)","name":"storage.type.tag-handle.yaml"},{"match":"\\\\S+","name":"invalid.illegal.tag-handle.yaml"}]},"prototype":{"patterns":[{"include":"#comment"},{"include":"#property"}]}},"scopeName":"source.yaml","aliases":["yml"]}`))];export{t as n,n as t};
|
|
1
|
+
import{t as e}from"./index-rgKS_aMw.js";var t=e({default:()=>n}),n=[Object.freeze(JSON.parse(`{"displayName":"YAML","fileTypes":["yaml","yml","rviz","reek","clang-format","yaml-tmlanguage","syntax","sublime-syntax"],"firstLineMatch":"^%YAML( ?1.\\\\d+)?","name":"yaml","patterns":[{"include":"#comment"},{"include":"#property"},{"include":"#directive"},{"match":"^---","name":"entity.other.document.begin.yaml"},{"match":"^\\\\.{3}","name":"entity.other.document.end.yaml"},{"include":"#node"}],"repository":{"block-collection":{"patterns":[{"include":"#block-sequence"},{"include":"#block-mapping"}]},"block-mapping":{"patterns":[{"include":"#block-pair"}]},"block-node":{"patterns":[{"include":"#prototype"},{"include":"#block-scalar"},{"include":"#block-collection"},{"include":"#flow-scalar-plain-out"},{"include":"#flow-node"}]},"block-pair":{"patterns":[{"begin":"\\\\?","beginCaptures":{"1":{"name":"punctuation.definition.key-value.begin.yaml"}},"end":"(?=\\\\?)|^ *(:)|(:)","endCaptures":{"1":{"name":"punctuation.separator.key-value.mapping.yaml"},"2":{"name":"invalid.illegal.expected-newline.yaml"}},"name":"meta.block-mapping.yaml","patterns":[{"include":"#block-node"}]},{"begin":"(?=(?:[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?]\\\\S)([^:\\\\s]|:\\\\S|\\\\s+(?![#\\\\s]))*\\\\s*:(\\\\s|$))","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))","patterns":[{"include":"#flow-scalar-plain-out-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?]\\\\S","beginCaptures":{"0":{"name":"entity.name.tag.yaml"}},"contentName":"entity.name.tag.yaml","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))","name":"string.unquoted.plain.out.yaml"}]},{"match":":(?=\\\\s|$)","name":"punctuation.separator.key-value.mapping.yaml"}]},"block-scalar":{"begin":"(?:(\\\\|)|(>))([1-9])?([-+])?(.*\\\\n?)","beginCaptures":{"1":{"name":"keyword.control.flow.block-scalar.literal.yaml"},"2":{"name":"keyword.control.flow.block-scalar.folded.yaml"},"3":{"name":"constant.numeric.indentation-indicator.yaml"},"4":{"name":"storage.modifier.chomping-indicator.yaml"},"5":{"patterns":[{"include":"#comment"},{"match":".+","name":"invalid.illegal.expected-comment-or-newline.yaml"}]}},"end":"^(?=\\\\S)|(?!\\\\G)","patterns":[{"begin":"^( +)(?! )","end":"^(?!\\\\1|\\\\s*$)","name":"string.unquoted.block.yaml"}]},"block-sequence":{"match":"(-)(?!\\\\S)","name":"punctuation.definition.block.sequence.item.yaml"},"comment":{"begin":"(?:^([\\\\t ]*)|[\\\\t ]+)(?=#\\\\p{print}*$)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.yaml"}},"end":"(?!\\\\G)","patterns":[{"begin":"#","beginCaptures":{"0":{"name":"punctuation.definition.comment.yaml"}},"end":"\\\\n","name":"comment.line.number-sign.yaml"}]},"directive":{"begin":"^%","beginCaptures":{"0":{"name":"punctuation.definition.directive.begin.yaml"}},"end":"(?=$|[\\\\t ]+($|#))","name":"meta.directive.yaml","patterns":[{"captures":{"1":{"name":"keyword.other.directive.yaml.yaml"},"2":{"name":"constant.numeric.yaml-version.yaml"}},"match":"\\\\G(YAML)[\\\\t ]+(\\\\d+\\\\.\\\\d+)"},{"captures":{"1":{"name":"keyword.other.directive.tag.yaml"},"2":{"name":"storage.type.tag-handle.yaml"},"3":{"name":"support.type.tag-prefix.yaml"}},"match":"\\\\G(TAG)(?:[\\\\t ]+(!(?:[-0-9A-Za-z]*!)?)(?:[\\\\t ]+(!(?:%\\\\h{2}|[]!#$\\\\&-;=?-\\\\[_a-z~])*|(?![]!,\\\\[{}])(?:%\\\\h{2}|[]!#$\\\\&-;=?-\\\\[_a-z~])+))?)?"},{"captures":{"1":{"name":"support.other.directive.reserved.yaml"},"2":{"name":"string.unquoted.directive-name.yaml"},"3":{"name":"string.unquoted.directive-parameter.yaml"}},"match":"\\\\G(\\\\w+)(?:[\\\\t ]+(\\\\w+)(?:[\\\\t ]+(\\\\w+))?)?"},{"match":"\\\\S+","name":"invalid.illegal.unrecognized.yaml"}]},"flow-alias":{"captures":{"1":{"name":"keyword.control.flow.alias.yaml"},"2":{"name":"punctuation.definition.alias.yaml"},"3":{"name":"variable.other.alias.yaml"},"4":{"name":"invalid.illegal.character.anchor.yaml"}},"match":"((\\\\*))([^],/\\\\[{}\\\\s]+)([^],}\\\\s]\\\\S*)?"},"flow-collection":{"patterns":[{"include":"#flow-sequence"},{"include":"#flow-mapping"}]},"flow-mapping":{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.definition.mapping.begin.yaml"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.mapping.end.yaml"}},"name":"meta.flow-mapping.yaml","patterns":[{"include":"#prototype"},{"match":",","name":"punctuation.separator.mapping.yaml"},{"include":"#flow-pair"}]},"flow-node":{"patterns":[{"include":"#prototype"},{"include":"#flow-alias"},{"include":"#flow-collection"},{"include":"#flow-scalar"}]},"flow-pair":{"patterns":[{"begin":"\\\\?","beginCaptures":{"0":{"name":"punctuation.definition.key-value.begin.yaml"}},"end":"(?=[],}])","name":"meta.flow-pair.explicit.yaml","patterns":[{"include":"#prototype"},{"include":"#flow-pair"},{"include":"#flow-node"},{"begin":":(?=\\\\s|$|[],\\\\[{}])","beginCaptures":{"0":{"name":"punctuation.separator.key-value.mapping.yaml"}},"end":"(?=[],}])","patterns":[{"include":"#flow-value"}]}]},{"begin":"(?=(?:[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?][^],\\\\[{}\\\\s])([^],:\\\\[{}\\\\s]|:[^],\\\\[{}\\\\s]|\\\\s+(?![#\\\\s]))*\\\\s*:(\\\\s|$))","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])","name":"meta.flow-pair.key.yaml","patterns":[{"include":"#flow-scalar-plain-in-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?][^],\\\\[{}\\\\s]","beginCaptures":{"0":{"name":"entity.name.tag.yaml"}},"contentName":"entity.name.tag.yaml","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])","name":"string.unquoted.plain.in.yaml"}]},{"include":"#flow-node"},{"begin":":(?=\\\\s|$|[],\\\\[{}])","captures":{"0":{"name":"punctuation.separator.key-value.mapping.yaml"}},"end":"(?=[],}])","name":"meta.flow-pair.yaml","patterns":[{"include":"#flow-value"}]}]},"flow-scalar":{"patterns":[{"include":"#flow-scalar-double-quoted"},{"include":"#flow-scalar-single-quoted"},{"include":"#flow-scalar-plain-in"}]},"flow-scalar-double-quoted":{"begin":"\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.yaml"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.yaml"}},"name":"string.quoted.double.yaml","patterns":[{"match":"\\\\\\\\([ \\"/0LN\\\\\\\\_abefnprtv]|x\\\\d\\\\d|u\\\\d{4}|U\\\\d{8})","name":"constant.character.escape.yaml"},{"match":"\\\\\\\\\\\\n","name":"constant.character.escape.double-quoted.newline.yaml"}]},"flow-scalar-plain-in":{"patterns":[{"include":"#flow-scalar-plain-in-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?][^],\\\\[{}\\\\s]","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])","name":"string.unquoted.plain.in.yaml"}]},"flow-scalar-plain-in-implicit-type":{"patterns":[{"captures":{"1":{"name":"constant.language.null.yaml"},"2":{"name":"constant.language.boolean.yaml"},"3":{"name":"constant.numeric.integer.yaml"},"4":{"name":"constant.numeric.float.yaml"},"5":{"name":"constant.other.timestamp.yaml"},"6":{"name":"constant.language.value.yaml"},"7":{"name":"constant.language.merge.yaml"}},"match":"(?:(null|Null|NULL|~)|([Yy]|yes|Yes|YES|[Nn]|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)|([-+]?0b[01_]+|[-+]?0[0-7_]+|[-+]?(?:0|[1-9][0-9_]*)|[-+]?0x[_\\\\h]+|[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)|([-+]?(?:[0-9][0-9_]*)?\\\\.[.0-9]*(?:[Ee][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\\\.[0-9_]*|[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))|(\\\\d{4}-\\\\d{2}-\\\\d{2}|\\\\d{4}-\\\\d{1,2}-\\\\d{1,2}(?:[Tt]|[\\\\t ]+)\\\\d{1,2}:\\\\d{2}:\\\\d{2}(?:\\\\.\\\\d*)?(?:[\\\\t ]*Z|[-+]\\\\d{1,2}(?::\\\\d{1,2})?)?)|(=)|(<<))(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$)|\\\\s*:[],\\\\[{}]|\\\\s*[],\\\\[{}])"}]},"flow-scalar-plain-out":{"patterns":[{"include":"#flow-scalar-plain-out-implicit-type"},{"begin":"[^-\\\\]!\\"#%\\\\&'*,:>?@\\\\[\`{|}\\\\s]|[-:?]\\\\S","end":"(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))","name":"string.unquoted.plain.out.yaml"}]},"flow-scalar-plain-out-implicit-type":{"patterns":[{"captures":{"1":{"name":"constant.language.null.yaml"},"2":{"name":"constant.language.boolean.yaml"},"3":{"name":"constant.numeric.integer.yaml"},"4":{"name":"constant.numeric.float.yaml"},"5":{"name":"constant.other.timestamp.yaml"},"6":{"name":"constant.language.value.yaml"},"7":{"name":"constant.language.merge.yaml"}},"match":"(?:(null|Null|NULL|~)|([Yy]|yes|Yes|YES|[Nn]|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)|([-+]?0b[01_]+|[-+]?0[0-7_]+|[-+]?(?:0|[1-9][0-9_]*)|[-+]?0x[_\\\\h]+|[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)|([-+]?(?:[0-9][0-9_]*)?\\\\.[.0-9]*(?:[Ee][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\\\.[0-9_]*|[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))|(\\\\d{4}-\\\\d{2}-\\\\d{2}|\\\\d{4}-\\\\d{1,2}-\\\\d{1,2}(?:[Tt]|[\\\\t ]+)\\\\d{1,2}:\\\\d{2}:\\\\d{2}(?:\\\\.\\\\d*)?(?:[\\\\t ]*Z|[-+]\\\\d{1,2}(?::\\\\d{1,2})?)?)|(=)|(<<))(?=\\\\s*$|\\\\s+#|\\\\s*:(\\\\s|$))"}]},"flow-scalar-single-quoted":{"begin":"'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.yaml"}},"end":"'(?!')","endCaptures":{"0":{"name":"punctuation.definition.string.end.yaml"}},"name":"string.quoted.single.yaml","patterns":[{"match":"''","name":"constant.character.escape.single-quoted.yaml"}]},"flow-sequence":{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.sequence.begin.yaml"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.sequence.end.yaml"}},"name":"meta.flow-sequence.yaml","patterns":[{"include":"#prototype"},{"match":",","name":"punctuation.separator.sequence.yaml"},{"include":"#flow-pair"},{"include":"#flow-node"}]},"flow-value":{"patterns":[{"begin":"\\\\G(?![],}])","end":"(?=[],}])","name":"meta.flow-pair.value.yaml","patterns":[{"include":"#flow-node"}]}]},"node":{"patterns":[{"include":"#block-node"}]},"property":{"begin":"(?=[!\\\\&])","end":"(?!\\\\G)","name":"meta.property.yaml","patterns":[{"captures":{"1":{"name":"keyword.control.property.anchor.yaml"},"2":{"name":"punctuation.definition.anchor.yaml"},"3":{"name":"entity.name.type.anchor.yaml"},"4":{"name":"invalid.illegal.character.anchor.yaml"}},"match":"\\\\G((&))([^],/\\\\[{}\\\\s]+)(\\\\S+)?"},{"match":"\\\\G!(?:<(?:%\\\\h{2}|[]!#$\\\\&-;=?-\\\\[_a-z~])+>|(?:[-0-9A-Za-z]*!)?(?:%\\\\h{2}|[#$\\\\&-+\\\\--;=?-Z_a-z~])+|)(?=[\\\\t ]|$)","name":"storage.type.tag-handle.yaml"},{"match":"\\\\S+","name":"invalid.illegal.tag-handle.yaml"}]},"prototype":{"patterns":[{"include":"#comment"},{"include":"#property"}]}},"scopeName":"source.yaml","aliases":["yml"]}`))];export{t as n,n as t};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
2
|
+
<rect width="512" height="512" rx="112" fill="#0a0a0a"/>
|
|
3
|
+
<path d="M365.4 242.8A136 136 0 1 1 269.2 146.6" fill="none" stroke="#e6e6e6" stroke-width="56" stroke-linecap="round"/>
|
|
4
|
+
<circle cx="398" cy="114" r="44" fill="#61afef"/>
|
|
5
|
+
</svg>
|
package/apps/web/dist/index.html
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
name="viewport"
|
|
9
9
|
content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content"
|
|
10
10
|
/>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
12
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-rgKS_aMw.js"></script>
|
|
12
|
+
<link rel="stylesheet" crossorigin href="/assets/index-0B-Gdd7b.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
15
|
<div id="root"></div>
|
package/apps/web/dist/sw.js
CHANGED
|
@@ -4,7 +4,7 @@ self.addEventListener('push', (event) => {
|
|
|
4
4
|
message
|
|
5
5
|
? self.registration.showNotification(message.title, {
|
|
6
6
|
body: message.body,
|
|
7
|
-
data: { cwd: message.cwd, tabId: message.tabId },
|
|
7
|
+
data: { machine: null, cwd: message.cwd, tabId: message.tabId },
|
|
8
8
|
})
|
|
9
9
|
: self.registration.showNotification('offsite', { data: null })
|
|
10
10
|
)
|
|
@@ -43,7 +43,7 @@ async function subscribeWithServerKey() {
|
|
|
43
43
|
function call(method, params) {
|
|
44
44
|
return new Promise((resolve, reject) => {
|
|
45
45
|
const socket = new WebSocket(
|
|
46
|
-
`${self.location.protocol === 'https:' ? 'wss' : 'ws'}://${self.location.host}/ws`
|
|
46
|
+
`${self.location.protocol === 'https:' ? 'wss' : 'ws'}://${self.location.host}/ws${self.location.search}`
|
|
47
47
|
)
|
|
48
48
|
socket.onopen = () => socket.send(JSON.stringify({ id: 1, method, params }))
|
|
49
49
|
socket.onmessage = (event) => {
|
|
@@ -69,13 +69,24 @@ async function openTab(tab) {
|
|
|
69
69
|
})
|
|
70
70
|
const page = windows[0]
|
|
71
71
|
if (!page) {
|
|
72
|
-
await self.clients.openWindow(
|
|
73
|
-
tab
|
|
74
|
-
? `/?${new URLSearchParams({ cwd: tab.cwd, terminal: String(tab.tabId) })}`
|
|
75
|
-
: '/'
|
|
76
|
-
)
|
|
72
|
+
await self.clients.openWindow(tab ? `/?${tabParams(tab)}` : '/')
|
|
77
73
|
return
|
|
78
74
|
}
|
|
79
|
-
if (tab)
|
|
75
|
+
if (tab)
|
|
76
|
+
page.postMessage({
|
|
77
|
+
type: 'select',
|
|
78
|
+
machine: tab.machine,
|
|
79
|
+
cwd: tab.cwd,
|
|
80
|
+
tabId: tab.tabId,
|
|
81
|
+
})
|
|
80
82
|
await page.focus()
|
|
81
83
|
}
|
|
84
|
+
|
|
85
|
+
function tabParams(tab) {
|
|
86
|
+
const params = new URLSearchParams()
|
|
87
|
+
if (tab.machine !== null && tab.machine !== self.location.origin)
|
|
88
|
+
params.set('machine', tab.machine)
|
|
89
|
+
params.set('cwd', tab.cwd)
|
|
90
|
+
params.set('terminal', String(tab.tabId))
|
|
91
|
+
return params
|
|
92
|
+
}
|
package/bin/offsite.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import '../apps/server/dist/main.
|
|
2
|
+
import '../apps/server/dist/main.mjs'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "offsite",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -15,7 +15,12 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@anthropic-ai/claude-agent-sdk": "^0.3.296",
|
|
18
|
+
"@commander-js/extra-typings": "^15.0.0",
|
|
18
19
|
"@lydell/node-pty": "1.2.0-beta.15",
|
|
20
|
+
"@opencode/client": "2.0.30",
|
|
21
|
+
"commander": "^15.0.0",
|
|
22
|
+
"consola": "^3.4.2",
|
|
23
|
+
"effect": "4.0.1",
|
|
19
24
|
"web-push": "^3.6.7",
|
|
20
25
|
"ws": "^8.22.0"
|
|
21
26
|
}
|
package/apps/server/dist/args.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import os from 'node:os';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { parseArgs } from 'node:util';
|
|
4
|
-
const { values } = parseArgs({
|
|
5
|
-
options: {
|
|
6
|
-
host: { type: 'string', default: '127.0.0.1' },
|
|
7
|
-
port: { type: 'string', default: '47841' },
|
|
8
|
-
dir: { type: 'string', default: path.join(os.homedir(), '.offsite') },
|
|
9
|
-
},
|
|
10
|
-
});
|
|
11
|
-
export const args = { ...values, dir: path.resolve(values.dir) };
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { statSync } from 'node:fs';
|
|
3
|
-
import os from 'node:os';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import { query, } from '@anthropic-ai/claude-agent-sdk';
|
|
6
|
-
import { broadcast } from './hub.js';
|
|
7
|
-
import { readJson, writeJson } from './storage.js';
|
|
8
|
-
const probes = new Map();
|
|
9
|
-
const limits = new Map();
|
|
10
|
-
let executable = '';
|
|
11
|
-
export function findClaude() {
|
|
12
|
-
const name = process.platform === 'win32' ? 'claude.exe' : 'claude';
|
|
13
|
-
for (const dir of (process.env.PATH ?? '').split(path.delimiter)) {
|
|
14
|
-
const candidate = path.join(dir, name);
|
|
15
|
-
if (statSync(candidate, { throwIfNoEntry: false })?.isFile()) {
|
|
16
|
-
executable = candidate;
|
|
17
|
-
return candidate;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
export function claudeOptions(accountId, cwd) {
|
|
23
|
-
if (accountId === null)
|
|
24
|
-
throw new Error('Add a Claude account in Settings → Accounts');
|
|
25
|
-
const account = storedAccounts().find((item) => item.id === accountId);
|
|
26
|
-
if (account === undefined)
|
|
27
|
-
throw new Error('That account was removed');
|
|
28
|
-
return {
|
|
29
|
-
cwd,
|
|
30
|
-
env: {
|
|
31
|
-
...process.env,
|
|
32
|
-
CLAUDE_CODE_ENTRYPOINT: 'offsite',
|
|
33
|
-
CLAUDE_CONFIG_DIR: account.configDir,
|
|
34
|
-
},
|
|
35
|
-
pathToClaudeCodeExecutable: executable,
|
|
36
|
-
systemPrompt: { type: 'preset', preset: 'claude_code' },
|
|
37
|
-
hooks: {
|
|
38
|
-
PostToolUse: [
|
|
39
|
-
{
|
|
40
|
-
matcher: 'PushNotification',
|
|
41
|
-
hooks: [
|
|
42
|
-
async (input) => {
|
|
43
|
-
if (input.hook_event_name !== 'PostToolUse' ||
|
|
44
|
-
typeof input.tool_input !== 'object' ||
|
|
45
|
-
input.tool_input === null ||
|
|
46
|
-
!('message' in input.tool_input) ||
|
|
47
|
-
typeof input.tool_input.message !== 'string')
|
|
48
|
-
throw new Error('Unexpected PushNotification hook input');
|
|
49
|
-
broadcast({
|
|
50
|
-
type: 'notification',
|
|
51
|
-
sessionId: input.session_id,
|
|
52
|
-
message: input.tool_input.message,
|
|
53
|
-
});
|
|
54
|
-
return {
|
|
55
|
-
hookSpecificOutput: {
|
|
56
|
-
hookEventName: 'PostToolUse',
|
|
57
|
-
updatedToolOutput: {
|
|
58
|
-
message: input.tool_input.message,
|
|
59
|
-
localSent: true,
|
|
60
|
-
disabledReason: 'no_transport',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
export async function capabilities(accountId, cwd) {
|
|
72
|
-
const result = await initialization(accountId, cwd);
|
|
73
|
-
return {
|
|
74
|
-
models: result.models.map((model) => ({
|
|
75
|
-
value: model.value,
|
|
76
|
-
name: model.displayName,
|
|
77
|
-
description: model.description,
|
|
78
|
-
efforts: model.supportedEffortLevels ?? [],
|
|
79
|
-
})),
|
|
80
|
-
commands: result.commands.map((command) => ({
|
|
81
|
-
name: command.name,
|
|
82
|
-
description: command.description,
|
|
83
|
-
hint: command.argumentHint,
|
|
84
|
-
})),
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
export async function accounts() {
|
|
88
|
-
return Promise.all(storedAccounts().map(async (account) => {
|
|
89
|
-
try {
|
|
90
|
-
const info = (await initialization(account.id, os.homedir())).account;
|
|
91
|
-
return {
|
|
92
|
-
...account,
|
|
93
|
-
email: info.email ?? null,
|
|
94
|
-
plan: info.subscriptionType ?? null,
|
|
95
|
-
error: null,
|
|
96
|
-
limits: accountLimits(account.id),
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
100
|
-
return {
|
|
101
|
-
...account,
|
|
102
|
-
email: null,
|
|
103
|
-
plan: null,
|
|
104
|
-
error: error instanceof Error ? error.message : String(error),
|
|
105
|
-
limits: accountLimits(account.id),
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}));
|
|
109
|
-
}
|
|
110
|
-
export function addAccount(name, configDir) {
|
|
111
|
-
saveAccounts([
|
|
112
|
-
...storedAccounts(),
|
|
113
|
-
{ id: randomUUID(), ...validAccount(name, configDir) },
|
|
114
|
-
]);
|
|
115
|
-
}
|
|
116
|
-
export function updateAccount(id, name, configDir) {
|
|
117
|
-
const account = validAccount(name, configDir);
|
|
118
|
-
saveAccounts(storedAccounts().map((item) => (item.id === id ? { id, ...account } : item)));
|
|
119
|
-
forget(id);
|
|
120
|
-
}
|
|
121
|
-
export function removeAccount(id) {
|
|
122
|
-
saveAccounts(storedAccounts().filter((item) => item.id !== id));
|
|
123
|
-
forget(id);
|
|
124
|
-
}
|
|
125
|
-
export function recordLimit(accountId, info) {
|
|
126
|
-
const current = limits.get(accountId) ?? new Map();
|
|
127
|
-
const windows = info.unifiedWindows;
|
|
128
|
-
if (isRecord(windows))
|
|
129
|
-
for (const [name, value] of Object.entries(windows))
|
|
130
|
-
if (isRecord(value))
|
|
131
|
-
current.set(name, {
|
|
132
|
-
window: name,
|
|
133
|
-
utilization: typeof value.utilization === 'number' ? value.utilization : null,
|
|
134
|
-
resetsAt: typeof value.resetsAt === 'number' ? value.resetsAt : null,
|
|
135
|
-
rejected: current.get(name)?.rejected ?? false,
|
|
136
|
-
});
|
|
137
|
-
if (info.rateLimitType !== undefined) {
|
|
138
|
-
const existing = current.get(info.rateLimitType);
|
|
139
|
-
current.set(info.rateLimitType, {
|
|
140
|
-
window: info.rateLimitType,
|
|
141
|
-
utilization: info.utilization ?? existing?.utilization ?? null,
|
|
142
|
-
resetsAt: info.resetsAt ?? existing?.resetsAt ?? null,
|
|
143
|
-
rejected: info.status === 'rejected',
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
limits.set(accountId, current);
|
|
147
|
-
return accountLimits(accountId);
|
|
148
|
-
}
|
|
149
|
-
function validAccount(name, configDir) {
|
|
150
|
-
if (name.trim() === '')
|
|
151
|
-
throw new Error('Give the account a name');
|
|
152
|
-
const dir = configDir.trim();
|
|
153
|
-
if (dir === '~' || dir.startsWith('~/'))
|
|
154
|
-
return {
|
|
155
|
-
name: name.trim(),
|
|
156
|
-
configDir: path.join(os.homedir(), dir.slice(1)),
|
|
157
|
-
};
|
|
158
|
-
if (path.isAbsolute(dir))
|
|
159
|
-
return { name: name.trim(), configDir: dir };
|
|
160
|
-
throw new Error('Use an absolute config directory or one starting with ~/');
|
|
161
|
-
}
|
|
162
|
-
function forget(accountId) {
|
|
163
|
-
for (const key of probes.keys())
|
|
164
|
-
if (key.startsWith(`${accountId}\n`))
|
|
165
|
-
probes.delete(key);
|
|
166
|
-
limits.delete(accountId);
|
|
167
|
-
}
|
|
168
|
-
function accountLimits(accountId) {
|
|
169
|
-
return [...(limits.get(accountId)?.values() ?? [])];
|
|
170
|
-
}
|
|
171
|
-
function initialization(accountId, cwd) {
|
|
172
|
-
const key = `${accountId}\n${cwd}`;
|
|
173
|
-
const existing = probes.get(key);
|
|
174
|
-
if (existing !== undefined)
|
|
175
|
-
return existing;
|
|
176
|
-
const probe = runProbe(accountId, cwd);
|
|
177
|
-
probes.set(key, probe);
|
|
178
|
-
probe.catch(() => probes.delete(key));
|
|
179
|
-
return probe;
|
|
180
|
-
}
|
|
181
|
-
async function runProbe(accountId, cwd) {
|
|
182
|
-
const closed = Promise.withResolvers();
|
|
183
|
-
const probe = query({
|
|
184
|
-
prompt: idle(closed.promise),
|
|
185
|
-
options: claudeOptions(accountId, cwd),
|
|
186
|
-
});
|
|
187
|
-
try {
|
|
188
|
-
return await probe.initializationResult();
|
|
189
|
-
}
|
|
190
|
-
finally {
|
|
191
|
-
closed.resolve();
|
|
192
|
-
probe.close();
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
async function* idle(until) {
|
|
196
|
-
await until;
|
|
197
|
-
yield* [];
|
|
198
|
-
}
|
|
199
|
-
function storedAccounts() {
|
|
200
|
-
return readJson('accounts.json') ?? [];
|
|
201
|
-
}
|
|
202
|
-
function saveAccounts(items) {
|
|
203
|
-
writeJson('accounts.json', items);
|
|
204
|
-
}
|
|
205
|
-
function isRecord(value) {
|
|
206
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
207
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import os from 'node:os';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { broadcast } from './hub.js';
|
|
4
|
-
import { schemes } from './schemes.js';
|
|
5
|
-
import { home, readJson, writeJson } from './storage.js';
|
|
6
|
-
export const version = '0.0.0';
|
|
7
|
-
const configFile = path.join(home, 'config.json');
|
|
8
|
-
export const defaults = {
|
|
9
|
-
theme: schemes[0].id,
|
|
10
|
-
composer: {
|
|
11
|
-
accountId: null,
|
|
12
|
-
model: 'haiku',
|
|
13
|
-
effort: 'low',
|
|
14
|
-
permissionMode: 'bypassPermissions',
|
|
15
|
-
},
|
|
16
|
-
terminal: {
|
|
17
|
-
shell: { macos: null, linux: null, windows: null },
|
|
18
|
-
font: {
|
|
19
|
-
family: 'FiraCode Nerd Font',
|
|
20
|
-
size: 14,
|
|
21
|
-
lineHeight: 1.35,
|
|
22
|
-
ligatures: true,
|
|
23
|
-
},
|
|
24
|
-
cursor: { style: 'bar', blink: true },
|
|
25
|
-
padding: { top: 4, right: 4, bottom: 0, left: 4 },
|
|
26
|
-
scrollback: 1000,
|
|
27
|
-
boldIsBright: true,
|
|
28
|
-
behavior: {
|
|
29
|
-
modernizeShiftEnter: true,
|
|
30
|
-
pasteBrowserImages: true,
|
|
31
|
-
showGitBranch: true,
|
|
32
|
-
captureShortcuts: true,
|
|
33
|
-
bellFlash: true,
|
|
34
|
-
bellSound: true,
|
|
35
|
-
terminalIdentity: 'offsite',
|
|
36
|
-
shellIntegration: true,
|
|
37
|
-
clickToMoveCursor: true,
|
|
38
|
-
optionAsMeta: 'off',
|
|
39
|
-
confirmCloseBusyTab: true,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
const choices = {
|
|
44
|
-
theme: schemes.map((scheme) => scheme.id),
|
|
45
|
-
'composer.effort': ['low', 'medium', 'high', 'xhigh', 'max'],
|
|
46
|
-
'composer.permissionMode': [
|
|
47
|
-
'default',
|
|
48
|
-
'acceptEdits',
|
|
49
|
-
'bypassPermissions',
|
|
50
|
-
'plan',
|
|
51
|
-
'dontAsk',
|
|
52
|
-
'auto',
|
|
53
|
-
],
|
|
54
|
-
'terminal.cursor.style': ['block', 'bar', 'underline'],
|
|
55
|
-
'terminal.behavior.terminalIdentity': ['offsite', 'ghostty', 'iterm2'],
|
|
56
|
-
'terminal.behavior.optionAsMeta': ['off', 'left', 'right', 'both'],
|
|
57
|
-
};
|
|
58
|
-
const nullable = [
|
|
59
|
-
'composer.accountId',
|
|
60
|
-
'composer.model',
|
|
61
|
-
'composer.effort',
|
|
62
|
-
'composer.permissionMode',
|
|
63
|
-
'terminal.shell.macos',
|
|
64
|
-
'terminal.shell.linux',
|
|
65
|
-
'terminal.shell.windows',
|
|
66
|
-
];
|
|
67
|
-
const integers = [
|
|
68
|
-
'terminal.scrollback',
|
|
69
|
-
'terminal.padding.top',
|
|
70
|
-
'terminal.padding.right',
|
|
71
|
-
'terminal.padding.bottom',
|
|
72
|
-
'terminal.padding.left',
|
|
73
|
-
];
|
|
74
|
-
export function platform() {
|
|
75
|
-
if (process.platform === 'darwin')
|
|
76
|
-
return 'macos';
|
|
77
|
-
if (process.platform === 'linux')
|
|
78
|
-
return 'linux';
|
|
79
|
-
if (process.platform === 'win32')
|
|
80
|
-
return 'windows';
|
|
81
|
-
throw new Error(`unsupported platform ${process.platform}`);
|
|
82
|
-
}
|
|
83
|
-
export function defaultShell() {
|
|
84
|
-
if (process.platform === 'win32')
|
|
85
|
-
return process.env.COMSPEC ?? 'cmd.exe';
|
|
86
|
-
return os.userInfo().shell ?? '/bin/sh';
|
|
87
|
-
}
|
|
88
|
-
export function configInfo() {
|
|
89
|
-
return {
|
|
90
|
-
config: readConfig(),
|
|
91
|
-
defaults,
|
|
92
|
-
platform: platform(),
|
|
93
|
-
version,
|
|
94
|
-
defaultShell: defaultShell(),
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
export function readConfig() {
|
|
98
|
-
let user;
|
|
99
|
-
try {
|
|
100
|
-
user = readJson('config.json');
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
console.warn(`invalid ${configFile}, using the default config: ${error}`);
|
|
104
|
-
return structuredClone(defaults);
|
|
105
|
-
}
|
|
106
|
-
if (user === null)
|
|
107
|
-
return structuredClone(defaults);
|
|
108
|
-
if (!isObject(user)) {
|
|
109
|
-
console.warn(`${configFile} is not an object, using the default config`);
|
|
110
|
-
return structuredClone(defaults);
|
|
111
|
-
}
|
|
112
|
-
let config = structuredClone(defaults);
|
|
113
|
-
for (const [key, value] of Object.entries(user))
|
|
114
|
-
config = merge(config, [key], value);
|
|
115
|
-
return config;
|
|
116
|
-
}
|
|
117
|
-
export function saveConfig(value) {
|
|
118
|
-
const error = invalid(value, defaults, []);
|
|
119
|
-
if (error !== null)
|
|
120
|
-
throw new Error(error);
|
|
121
|
-
writeJson('config.json', value);
|
|
122
|
-
broadcast({ type: 'config', config: value });
|
|
123
|
-
return value;
|
|
124
|
-
}
|
|
125
|
-
function merge(config, keys, user) {
|
|
126
|
-
const template = keys.reduce((value, key) => (isObject(value) ? value[key] : undefined), config);
|
|
127
|
-
if (isObject(template) && isObject(user)) {
|
|
128
|
-
let next = config;
|
|
129
|
-
for (const [key, value] of Object.entries(user))
|
|
130
|
-
next = merge(next, [...keys, key], value);
|
|
131
|
-
return next;
|
|
132
|
-
}
|
|
133
|
-
const candidate = structuredClone(config);
|
|
134
|
-
const parent = keys
|
|
135
|
-
.slice(0, -1)
|
|
136
|
-
.reduce((value, key) => value[key], candidate);
|
|
137
|
-
parent[keys[keys.length - 1]] = user;
|
|
138
|
-
const error = invalid(candidate, defaults, []);
|
|
139
|
-
if (error === null)
|
|
140
|
-
return candidate;
|
|
141
|
-
console.warn(`invalid ${keys.join('.')} in ${configFile}, using its default: ${error}`);
|
|
142
|
-
return config;
|
|
143
|
-
}
|
|
144
|
-
function invalid(value, template, keys) {
|
|
145
|
-
const name = keys.join('.');
|
|
146
|
-
if (isObject(template)) {
|
|
147
|
-
if (!isObject(value))
|
|
148
|
-
return `${name || 'config'} must be an object`;
|
|
149
|
-
for (const key of Object.keys(value))
|
|
150
|
-
if (!(key in template))
|
|
151
|
-
return `unknown setting ${[...keys, key].join('.')}`;
|
|
152
|
-
for (const key of Object.keys(template)) {
|
|
153
|
-
if (!(key in value))
|
|
154
|
-
return `missing setting ${[...keys, key].join('.')}`;
|
|
155
|
-
const error = invalid(value[key], template[key], [...keys, key]);
|
|
156
|
-
if (error !== null)
|
|
157
|
-
return error;
|
|
158
|
-
}
|
|
159
|
-
return null;
|
|
160
|
-
}
|
|
161
|
-
if (nullable.includes(name) && value === null)
|
|
162
|
-
return null;
|
|
163
|
-
if (name in choices) {
|
|
164
|
-
if (choices[name].includes(value))
|
|
165
|
-
return null;
|
|
166
|
-
return `${name} must be one of ${choices[name].join(', ')}`;
|
|
167
|
-
}
|
|
168
|
-
if (template === null) {
|
|
169
|
-
if (typeof value === 'string')
|
|
170
|
-
return null;
|
|
171
|
-
return `${name} must be text or null`;
|
|
172
|
-
}
|
|
173
|
-
if (typeof value !== typeof template)
|
|
174
|
-
return `${name} must be a ${typeof template}`;
|
|
175
|
-
if (typeof value !== 'number')
|
|
176
|
-
return null;
|
|
177
|
-
if (!Number.isFinite(value) || value < 0)
|
|
178
|
-
return `${name} must be a number of at least 0`;
|
|
179
|
-
if (integers.includes(name) && !Number.isInteger(value))
|
|
180
|
-
return `${name} must be a whole number`;
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
function isObject(value) {
|
|
184
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
185
|
-
}
|